Question: Part I: Write a Java class named Car.java to represent a Car type Create a new Java class named Car that has the following fields:

 Part I: Write a Java class named Car.java to represent a

Part I: Write a Java class named Car.java to represent a Car type Create a new Java class named Car that has the following fields: year The year field is an int that holds a cars year model (e.g. 2018) make The make field is a string object that holds the make of the car (e.g. "Porsche") speed The speed field is an double that holds a cars current speed (e.g. 25.0) In addition, the Car class should have the following methods. Constructor The constructor should accept the cars year, make, and beginning speed as arguments These values should be used to initialize the Cars year, make, and speed fields Getter Methods - write three accessor (getter) methods to get the values stored in an object fields: getYear), getMake(), getspeed() accelerate Write an accelerate method that has no arguments (parameters) passed to it and adds 1 to the speed field each time it is called For example: if the car was going 3 mph, accelerate would set the speed to 4 mph Part II named CarTester. java that uses your car class: 1. create a new Car object 2. call accelerate method twice 3. printout car speed P W

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!