Question: Please follow the instructions and solve the programming problems using the most appropriate implementation method. Each problem may have different requirements. If required, please draw
Please follow the instructions and solve the programming problems using the most appropriate implementation method. Each problem may have different requirements. If required, please draw a diagram illustrating the program architecture, indicating the interfaces and classes you used.
When writing your Java code, please use good programming practices by adding comments to your code to clarify various steps in your program.
Take at least one screenshot of the output of each of your programs that shows the results. If you want to test a program using different inputs, feel free to do so and take screenshots of those outputs as well. Make sure to include executions that would trigger exceptions or fall outside of the normal range.
Create a folder for the programming assignment and name it as ModPAYour First InitialYour last name, for example, ModPAJSmith. This is your root folder for the assignment. Add a subfolder for each problem in the root folder and save all the Java source code including interfaces and classes you use for each problem in the appropriate subfolders.
Embed the screenshots in a Word document, and save the file in the root folder created for this assignment. Archive the root folder and submit it
JUnit is a simple framework to test Java programs with a set of test cases to see if the programs are implemented correctly under the testing case scenarios. It is a common approach testdriven development process. JUnit is an open source concluded in a jar file. The jar file contains test runner, which is used to run JUnit tests.
hough you may run a JUnit from some Java IDEs, it is required to run a JUnit from the command
line in this project.
Triangle Class
The following example illustrates how to use testing cases to examine the implementations of
Triangle class.
Assume in the Triangle class, the method triangleType takes three string parameters representing
three sides of a triangle. The three sides are considered as integers. This method produces
different outputs under different conditions.
If the three sides are the same, it returns This is an equilateral triangle
If two sides are the same, it returns This is an isosceles triangle
For other cases with valid input, the method returns the word This is a scalene triangle
If three sides do not form a valid triangle, such as the method returns Not a valid
triangle
If one or more sides are not a valid integer, the method returns an error message.
For example:
arguments triangleType
This is an equilateral triangle.
This is an isosceles triangle.
This is a scalene triangle.
Not a valid triangle.
Triangle Testing
You are about to test the implementations of triangleType method with JUnit Testing. To test this
Triangle class, you write a JUnit test class named TriangleTest.java. This test class contains
multiple test cases in the format of methods. The test runner executes TriangleTest to generate a
JUnit test report.
In this project, you do not need to write the code for this Triangle class. Instead, you will write
JUnit test cases to make sure that the implementation of triangelType method meets the
requirements. The main method will not be tested; you may use it any way you want.
Download Triangle.java and the template TriangleTests.txt Rename the template as
FirstnameLastnameTriangleTest.java ex JohnSmithTriangleTest.java The template file contains
test cases. The first three test cases are given; you need to complete rest of the test cases. Do
NOVA Online
not remove any test cases from the template, just change the contents of the methods to test
various situations. The goal is to write a comprehensive set of test cases ie reasonable and non
repeated that covers all the different possible situations. For example, and are
considered repeated test cases with equilateral type of arguments.
Your test cases will be graded based on the output from JUnit. A Triangle class file will be
provided for testing purpose. You cannot modify the Triangle class.
There are two types of test cases:
A Valid types You will receive credit for submitting a test set for a correct implementation of
the triangleType method from the class provided ie an equilateral, isosceles or scalene
triangle The JUnit test run tells you which of your test numbers is failing.
B Invalid typeserror messages You will need to design your test set for some bugs that we
have intentionally placed into the triangleType method ie error message This part
measures the quality of your test set. Have too few or too similar tests, and you won't be
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
