pls try:
public String getAnswer(HashSet wishwords, int cnt){
int count=cnt; //cnt is needed for the standard answers
Iterator it=wishwords.iterator();
while(it.hasNext() && (aday==0 || aroom==0)){ //HIER
SOLL DIE KLAMMER FEHLEN!!!
String wishword=(String)it.next(); //get the
next word
for(day=1; day<366; day++){
if(answers[day-1][0]==wishword){aday=day;}
day++;
}
switch(wishword){
case "single":
case "1":
case "one":
aroom=1;
break;
case "double":
case "2":
case "two":
aroom=2;
break;
}
}
if(aday!=0 && aroom!=0){
if(answers[aday-1][aroom]>0){
answers[aday-1][aroom]--;
return "We could book you a room for
"+aroom+" persons on "+answers[aday-1][0];
}
else {return "Unfortunately all rooms on
"+answers[aday-1][0]+" for "+aroom+" persons are already booked";}
}
return chStdAnswer(count); //if not understood, return
a standard answer
}
> -----Urspr�ngliche Nachricht-----
> Von: Moritz Bellach [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 6. Januar 2005 13:57
> An: [email protected]
> Betreff: [PUG] java mal wieder
>
>
> hi liste!
> ich hab versucht in mein (inzwischen lauff�higes)
> hotel-buchungs-programm
> ein neues feature einzuf�gen: die unterscheidung von einzel und
> doppelzimmern. theoretisch sollte alles klappen, allerdings sagt der
> compiler er w�rde an unten angezeigter stelle ein ')' klammer
> erwarten. ich
> habe keine idee wie so. hier ist mal die methode:
>
> public String getAnswer(HashSet wishwords, int cnt){
> int count=cnt; //cnt is needed for the standard answers
> Iterator it=wishwords.iterator();
> while(it.hasNext() and (aday==0 or aroom==0)){
> //HIER SOLL DIE KLAMMER
> FEHLEN!!!
> String wishword=(String)it.next(); //get the next word
> for(day=1; day<366; day++){
> if(answers[day-1][0]==wishword){aday=day;}
> day++;
> }
> switch(wishword){
> case "single":
> case "1":
> case "one":
> aroom=1;
> break;
> case "double":
> case "2":
> case "two":
> aroom=2;
> break;
> }
> }
> if(aday!=0 and aroom!=0){
> if(answers[aday-1][aroom]>0){
> answers[aday-1][aroom]--;
> return "We could book you a room for
> "+aroom+" persons on
> "+answers[aday-1][0];
> }
> else {return "Unfortunately all rooms on
> "+answers[aday-1][0]+" for
> "+aroom+" persons are already booked";}
> }
> return chStdAnswer(count); //if not understood,
> return a standard
> answer
> }
>
> ich wei� nicht wie verst�ndlich diese einzelne methode ist
> deshalb erl�utere
> ich grade mal die variablen:
> cnt bzw count: der wie vielte eingabe versuch. wenn ich eine standard
> antwort ausgebe ist es beim ersten versuch immer die gleiche
> aday: nummer des tages an dem gebucht werden soll
> aroom: 1 oder 2 je nachdem ob einzel oder doppelzimmer
> wishword: jeweils abzupr�fender schnipsel der anfrage (wort f�r wort)
> day: sollte klar sein, nur eine z�hlvariabe.
> answers[][]: [0 bis 364][0]= die tage als Strings im format yyyy-mm-dd
> [][1 oder 2] zahl der einzel bzw doppelzimmer am jeweiligen tag
> mir f�llt grade auf das [][1 und 2] auch als strings
> behandelt werden m�ssen
> (konvertierung) aber daran sollte es nict liegen. wenn doch
> bekommt ihr
> bescheid. irgendwelche ideen?
> gru�, moritz
>
> --
> Moritz Bellach
>
> Baumgartenstr. 36
> 65232 Taunusstein
>
> +++ Sparen Sie mit GMX DSL +++ http://www.gmx.net/de/go/dsl
> AKTION f�r Wechsler: DSL-Tarife ab 3,99 EUR/Monat + Startguthaben
>
----------------------------------------------------------------------------
PUG - Penguin User Group Wiesbaden - http://www.pug.org