Question: In Java please, Without using throws Write a class called Vehicle containing the following fields: - make: (i.e. Ford) - model: (i.e. Taurus) - year

In Java please, Without using throws In Java please, Without using throws Write a class called Vehicle containing

Write a class called Vehicle containing the following fields: - make: (i.e. Ford) - model: (i.e. Taurus) - year - speed - distance (Distance traveled in race) It should include a constructor that takes make, model, and year and initializes the proper fields with this data. Zero out the speed and distance. The methods a Vehicle should have are: - accessor (getters) - methods that return the values of these private fields. (setDistance is a bit different.) - mutators (setters) - methods that change the values of these private fields. Make sure bad data does not enter the object. - make should not be empty or null - model should not be empty or null - year >=1950 - speed >=0 - setDistance is special and is described next - setDistance () - that takes a time in minutes, calculates the distance traveled by the car based on the current speed and time input and adds it to the total distance traveled by the car. - toString() - So you can print the object properly If written correctly, your Vehicle class should work plug and play into both driver projects! Submit a gist of the Vehicle class as well as the drivers. Make sure you include the proper global header. Look at the Project Template for that header. Driver Description Sample loop: private static void raceThemCars(Vehicle car1, Vehicle car2) \{ while (car1.getDistance ()

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!