Question: / * * * * @author Alexandra Vaschillo * / public class TwoMethodsA 0 2 { / * * * Method checks if a triangle

/**
*
* @author Alexandra Vaschillo
*/
public class TwoMethodsA02
{
/**
* Method checks if a triangle with given lengths of sides is a right triangle
* @param a triangle side
* @param b triangle side
* @param c triangle side
* @return true if the triangle is right, false if it is not
*/
public static boolean isRightTri(int a, int b, int c)
{
return false;
}
/**
* The method takes hour, minute, and "am","pm" components of the time stamp of the moment when car crosses the bridge and calculates the toll rate.
* If any of the time stamp components are invalid, -1 is being returned as an error code.
* @param hour hour component of the time stamp
* @param min minute component of the time stamp
* @param amPm either string "am" or "pm", component of the time stamp
* @return the toll rate for the passed time
*/
public static double toll520Bridge(int hour, int min, String amPm)
{
return -1;
}
public static void testIsRightTri()
{
//*** Test 1***//
if(isRightTri(3,4,5)) System.out.println("Test 1 for isRightTri() PASSED");
else System.out.println("Test 1 for isRightTri() Failed");
//*** Test 2***//
if(isRightTri(4,5,3)) System.out.println("Test 2 for isRightTri() PASSED");
else System.out.println("Test 2 for isRightTri() Failed");
//*** Test 3***//
if(isRightTri(5,4,3)) System.out.println("Test 3 for isRightTri()) PASSED");
else System.out.println("Test 3 for isRightTri() Failed");
//*** Test 4***//
if(isRightTri(3,5,4)) System.out.println("Test 4 for isRightTri() PASSED");
else System.out.println("Test 4 for isRightTri() Failed");
//*** Test 5***//
if(isRightTri(5,3,4)) System.out.println("Test 5 for isRightTri() PASSED");
else System.out.println("Test 5 for isRightTri() Failed");
//*** Test 6***//
if(isRightTri(4,3,5)) System.out.println("Test 6 for isRightTri() PASSED");
else System.out.println("Test 6 for isRightTri() Failed");
//*** Test 7***//
if(!isRightTri(4,4,5)) System.out.println("Test 7 for isRightTri() PASSED");
else System.out.println("Test 7 for isRightTri() Failed");
}
public static void testToll520Bridge()
{
final double OFF_PEAK =1.75;
final double LOW_RUSH =2.40;
final double RUSH_HOURS =3.95;
final double MID_DAY =2.65;
//*** Test 1***//
if(toll520Bridge(5,20,"aa")==-1) System.out.println("Test 1 for toll520Bridge() PASSED");
else System.out.println("Test 1 for toll520Bridge() Failed");
//*** Test 2***//
if(toll520Bridge(5,65,"am")==-1) System.out.println("Test 2 for toll520Bridge() PASSED");
else System.out.println("Test 2 for toll520Bridge() Failed");
//*** Test 3***//
if(toll520Bridge(15,15,"am")==-1 && toll520Bridge(0,59,"am")==-1) System.out.println("Test 3 for toll520Bridge() PASSED");
else System.out.println("Test 3 for toll520Bridge() Failed");
//*** Test 4***//
if(toll520Bridge(12,0,"am")==OFF_PEAK && toll520Bridge(4,59,"am")== OFF_PEAK &&toll520Bridge(3,35,"am")== OFF_PEAK) System.out.println("Test 4 for toll520Bridge() PASSED");
else System.out.println("Test 4 for toll520Bridge() Failed");
//*** Test 5***//
if(toll520Bridge(5,0,"am")==LOW_RUSH && toll520Bridge(6,59,"am")== LOW_RUSH && toll520Bridge(6,03,"am")== LOW_RUSH) System.out.println("Test 5 for toll520Bridge() PASSED");
else System.out.println("Test 5 for toll520Bridge() Failed");
//*** Test 6***//
if(toll520Bridge(7,0,"am")==RUSH_HOURS && toll520Bridge(9,59,"am")== RUSH_HOURS && toll520Bridge(9,15,"am")== RUSH_HOURS) System.out.println("Test 6 for toll520Bridge() PASSED");
else System.out.println("Test 6 for toll520Bridge() Failed");
//*** Test 7***//
if(toll520Bridge(10,0,"am")==MID_DAY && toll520Bridge(3,59,"pm")== MID_DAY && toll520Bridge(3,55,"pm")==MID_DAY) System.out.println("Test 7 for toll520Bridge() PASSED");
else System.out.println("Test 7 for toll520Bridge() Failed");
//*** Test 8***//
if(toll520Bridge(4,0,"pm")==RUSH_HOURS && toll520Bridge(7,59,"pm")==RUSH_HOURS && toll520Bridge(6,15,"pm")==RUSH_HOURS) System.out.println("Test 8 for toll520Bridge() PASSED");
else System.out.println("Test 8 for toll520Bridge() Failed");
//*** Test 9***//
if(toll520Bridge(8,0,"pm")==LOW_RUSH && toll520Bridge(10,59,"pm")==LOW_RUSH && tol

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!