nus-cs2113-AY2425S1 / forum

3 stars 0 forks source link

Exercise 4.3: Ouput identical with expected output but testcase failed #12

Closed kennethSty closed 2 weeks ago

kennethSty commented 2 weeks ago

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())

DanLinhHuynh-Niwashi commented 2 weeks ago

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?

jemehgoh commented 2 weeks ago

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)

skylee03 commented 2 weeks ago

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.

DanLinhHuynh-Niwashi commented 2 weeks ago

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.