Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

20. (16 points) Refer to the Auto class diagram and Tester algorithm on the Supplement Page. You will write the complete code for a AutoTester

image text in transcribed
image text in transcribed
20. (16 points) Refer to the Auto class diagram and Tester algorithm on the Supplement Page. You will write the complete code for a AutoTester class to test the use of the Auto class. You are NOT to write code for the Auto class. Comments are not required. Algorithm for application/tester class with main method: DECLARE all variables Instantiate an instance of the Auto Class CALL the setter method to set the make of the car to Subaru CALL the setter method to set the model of the car to Forester CALL the setter method to set the speed to 10 CALL the setter method to set the total miles to 25434 CALL decelerate and pass 5 CALL accelerate and pass 20 CALL the method to update total number of miles and pass 35 DISPLAY the Auto information like below as in the example output below. Example output: Make and Model: Subaru, Forester Last speed: 25 Total Miles: 25469 public class AutoTester bad the public static void main(String[] args) For Question 20: Auto - make: String - model: String - speed: int - totalMiles: int + getMake(): String + getModel(): String + getSpeed() : int + get TotalMiles() : int + setMake (String make): void + setModel (String model):void + setSpeed (int speed) : void + setTotalMiles (int totalMiles): void + accelerate(int speedIncrease): void + decelerate (int speedDecrease) : void update TotalMiles (int additionalMiles): int Partial Method Description A method accelerate that accepts one parameter that represent the number of miles that the speed should be increased to. Ex. if 5 miles is passed in, 5 miles will be added to speed. A method decelerate that accepts one parameter that represent the number of miles that the speed should be decreased by. A method update TotalMiles that accepts the number of miles the car has traveled and this will be added to the total miles

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

Expert Performance Indexing In SQL Server

Authors: Jason Strate, Grant Fritchey

2nd Edition

1484211189, 9781484211182

More Books

Students also viewed these Databases questions

Question

Briefly explain the various types of leadership ?

Answered: 1 week ago

Question

Explain the need for and importance of co-ordination?

Answered: 1 week ago

Question

Explain the contribution of Peter F. Drucker to Management .

Answered: 1 week ago

Question

What is meant by organisational theory ?

Answered: 1 week ago

Question

2. Explain how the role of training is changing.

Answered: 1 week ago

Question

7. General Mills

Answered: 1 week ago