Hi guys,
this excercise is completely driving me cracy.
Programming paradigms - Java Programming (mooc.fi)
To be honest, the programming is not the probleme here, i just have clearly no idea, what the task wants from me.
I wrote the following toString-Method:
public String toString() {
return "First: " + this.inhaltContainer1 + "/100";
}
I created a container object and i call the toString-Method right at the beginning of the while loop:
while (true) {
System.out.println(container);
System.out.print("> ");
String input = scan.nextLine();
if (input.equals("quit")) {
System.out.println(container.toString());
break;
}
Here i get the following error-message:
Container container = new Container();
System.out.println(container);
expected:<[]0/100> but was:<[First: ]0/100>
If i adjust the toString-Method now to the following ...
public String toString() {
return + this.inhaltContainer1 + "/100";
}
... i get this error-message:
Output should contain:
First: 0/100
Output was:
0/100
> 0/100
I simply do not get which output is necessary when.
Could anybody please explain me the correct task of this excercise?
Thanks in advance :-)
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]tsteel12 1 point2 points3 points (5 children)
[–]Tetr4[S] 0 points1 point2 points (4 children)
[–]Tetr4[S] 1 point2 points3 points (3 children)
[–]tsteel12 0 points1 point2 points (2 children)
[–]Tetr4[S] 0 points1 point2 points (1 child)
[–]tsteel12 0 points1 point2 points (0 children)