CMSC335 – Project 2 Test Cases Solved

$ 24.99
Category:

Description

Polynomial Order Test Cases
Test Case Input Output expected Output Messages Pass?
1 (circle) 1, “abc”,
-100, 12, n 452.39 area: pi * 144
=
452.39 “invalid
input…”
“number must be above 0” yes
2 (rectangle) 2, “qwerty”,
5.5, -4, 4, y,
10 22 area: 5.5 * 4 =
22 “invalid
input…”
“number must be above 0” yes
3 (square) “abc”, 12,
“haha”, n 144 area: 12*12 = 144 “invalid
input…”
“invalid input.” yes
4 (triangle) 4, 4.4, 7.7, y,
10 16.94 area: (4.4 *
7.7) / 2 =
16.94 yes
5 (sphere) 5, -4.23, “lol”,
5, n 523.6 area: (4/3)pi (5^3) = 523.59 “number must be above 0”
“invalid input” yes
6 (cube, cone, cylinder) 6, 10, 7, 3.7, 7, y, 8, 9, 14,
n 1000, 100.35,
3562.57 area: (10^3) = 1000, pi *
(3.7^2) * (7/3) = 100.35, pi * (9^2) * 14
= 3562.56 yes
7 (torus) 9, 3, 6, 6, 3, n 1065.92 area: (pi (3^2))
* (2 * pi * 6) =
1065.92 “minor radius can’t be yes

bigger than or equal to major
radius. try again”

Project 1 Test Cases:
Test Case 1:

Test Case 2:

Test Case 4:

Test Case 6:

UML Diagram:

Lessons Learned
I learned about inheritance in Java and the relationship between parent and child classes. The parent class’s methods can be overridden by its children to produce a different implementation of that method. In this case it was the procedure to calculate the area or volume of a shape that differed from shape to shape. I also learned about overloaded constructors as not every shape had the same number of input parameters. Some required 2 or 3 parameters in their construction. This project further solidified my java knowledge and cemented these concepts in my head.

Reviews

There are no reviews yet.

Be the first to review “CMSC335 – Project 2 Test Cases Solved”

Your email address will not be published. Required fields are marked *