Java - Anfängeraufgabe |
29.10.2015, 04:39 | Auf diesen Beitrag antworten » | |||||
SixFeetUnder | Java - Anfängeraufgabe Meine Frage: Hallo, folgende CodingBat - Aufgabe, wo mir Probleme bereitet: You and your date are trying to get a table at a restaurant. The parameter "you" is the stylishness of your clothes, in the range 0..10, and "date" is the stylishness of your date's clothes. The result getting the table is encoded as an int value with 0=no, 1=maybe, 2=yes. If either of you is very stylish, 8 or more, then the result is 2 (yes). With the exception that if either of you has style of 2 or less, then the result is 0 (no). Otherwise the result is 1 (maybe). dateFashion(5, 10) ? 2 dateFashion(5, 2) ? 0 dateFashion(5, 5) ? 1 Meine Ideen:
Mein Code stimmt so natürlich nicht, aber ich kann doch nicht mit drei aufeinander folgenden if-Abfragen programmieren? |
|||||
|
||||||
29.10.2015, 05:12 | Auf diesen Beitrag antworten » | |||||
SixFeetUnder | Hab es jetzt weiterhin versucht, aber so ganz will es noch nicht funktionieren. Hier mal mein aktueller Code:
|
|||||
29.10.2015, 06:04 | Auf diesen Beitrag antworten » | |||||
eulerscheZahl |
Du musst erst <=2 prüfen. Ansonsten sollte dein Code passen, eben einfach die Reihenfolge der if tauschen. |
|
Verwandte Themen
Die Beliebtesten » |
Die Größten » |
|
Die Neuesten » |
|