nus-cs2113-AY2425S1/forum

Exercise 4.3: Ouput identical with expected output but testcase failed

Closed this issue · 4 comments

The expected output of the task:
78
12
314
78
12
314
16

My output:
image

Why do I fail this test case? Are any specific whitespaces required? For reference: I print the area directly via System.out.println(s.area())

There is no white space required, I just directly printed it out just like you.

You may check if your output has an extra return or sth like that?

Check your code for the Rectangle() and Circle() classes on Coursemology. Did you inherit from the Shape() class? (I had this problem with this exercise)

In addition to public test cases, there are also hidden test cases. Your error may be caused by your OOP implementation not meeting the requirements, such as not having extends Shape.

If the program was successfully built, i think this may not the case.

As you store all of your instances in a list/ array of type Shape.