Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

package Lab 2 ; / * * * This class and its method is designed to * help students practice automated testing * @author Marzieh

package Lab2;
/**
* This class and its method is designed to
* help students practice "automated testing"
* @author Marzieh Ahmadzadeh
*/
public class TestingExample {
/**
* This method calculates the number of points a driver gets based on how far they have gone over the maximum allowed speed.
* @param actualSpeed This parameter shows the current speed of the car that is caught by camera/police
* @param maxSpeed This parameter shows the maximum allowed speed in an area.
* @param stuntDriving This parameter is true if a driver is caught in stunt driving.
* @return
*/
public static int LicencePoints(int actualSpeed, int maxSpeed, boolean stuntDriving){
int points =0;
if (actualSpeed <0|| maxSpeed <0) return -1;
else if (actualSpeed - maxSpeed <0) return -1;
else if (stuntDriving || actualSpeed - maxSpeed >=50) points =6;
else if (actualSpeed - maxSpeed >=30 && actualSpeed - maxSpeed <=49) points =4;
else if (actualSpeed - maxSpeed >=16 && actualSpeed - maxSpeed <=29) points =3;
return points;
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

General Purpose of Your Speech Analyzing Your Audience

Answered: 1 week ago

Question

Ethical Speaking: Taking Responsibility for Your Speech?

Answered: 1 week ago