ik ben bezig om een programma te maken om een dna sequentie in te voeren en vervolgens te modificeren. Het invoeren en modificeren werkt. Enkel bij het uitlezen uit de class krijg ik de volgende foutmelding terwijl uit dezelfde class(rij_motif) wel het totaal aantal ingelezen records wel kan uitlezen.
de volgende fotmelding verschijnt.
MotifCreate.java:34: cannot resolve symbol
symbol : variable giveData
location: class rij_motif
out.print(orginele_motif.giveData[p].motif);
(waarschijnlijk is het en
fout maar ik ben er 4 uur naar op zoek.)
de volgende fotmelding verschijnt.
MotifCreate.java:34: cannot resolve symbol
symbol : variable giveData
location: class rij_motif
out.print(orginele_motif.giveData[p].motif);
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
| class MotifCreate {
static final String FILE="motif.txt";
static final int maxMotif=100;
Input dataFile;
Output out;
Input in;
rij_motif orginele_motif;
MotifCreate() {
out = new Output();
in = new Input();
}
rij_motif leesenverwerk (Input in,rij_motif overzicht, int maxMotif){
overzicht = new rij_motif(maxMotif);
Motifgegevens Motifgegevens;
while(!in.eof())
{
Motifgegevens=leesGegevensMotif(in);
in.readln();
overzicht.voegToe(Motifgegevens);
}
return overzicht;
}
void weergeven(){
int max;
max=orginele_motif.aantalmotifs();
for(int p=0;p<=max;p++)
{
out.print(orginele_motif.giveData[p].motif);
out.println(p);
//out.println(orginele_motif.giveData[p].motif);
}
}
Motifgegevens leesGegevensMotif(Input in)
{
int id=0;
while(in.nextChar()!='|'){
id=in.readInt();
}
in.readChar();
String motif="";
while(in.nextChar()!='|'){
motif+=in.readChar();
}
return new Motifgegevens(id,motif);
}
Input kijkFileAanwezig (String File ){
dataFile=null;
try {
dataFile = new Input (File);
} catch (Exception e) {
out.println(e);
System.exit(1);
}
return dataFile;
}
public void start() {
//open bestand zoals gegeven in college week 46
in=kijkFileAanwezig(FILE);
orginele_motif = leesenverwerk(dataFile, orginele_motif,maxMotif );
weergeven();
}
public static void main(String argv[]) {
new MotifCreate().start();
}
} |
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| class rij_motif{
Motifgegevens[] array_motif;
int aantalmotifs;
Motifgegevens gegevens;
rij_motif(int maxAantalRecords){
array_motif = new Motifgegevens [maxAantalRecords];
aantalmotifs = 0;
}
void voegToe(Motifgegevens gegevens){
array_motif [aantalmotifs]= gegevens;
aantalmotifs++;
}
public Motifgegevens giveData(int number)
{
Motifgegevens data;
data =array_motif[number];
return data;
}
public int aantalmotifs()
{
return aantalmotifs;
}
} |
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
| class Motifgegevens{
int id;
String motif;
public Motifgegevens(int newID,String newMotif) {
this.id=newID;
this.motif=newMotif;
}
Motifgegevens(){
}
} |
(waarschijnlijk is het en