Question: Java language only **Make JavaDoc witht text pad with code below** public class Car { //initializing variables private int yearModel; private String make; private int
Java language only
**Make JavaDoc witht text pad with code below**
public class Car { //initializing variables private int yearModel; private String make; private int speed;
//constructor to initialize the car //year of car manufacure //car makers name public Car(int yearModel, String make) { this.yearModel = yearModel; this.make = make; // setting speed to 0 speed = 0; }
// method to get make of car public String getMake() { return make; }
// method to get year of car manufacture public int getYearModel() { return yearModel; }
// method to get current speed of car public int getSpeed() { return speed; } //method to accelerate the car (increase the speed by 5) public void accelerate() { speed += 5; }
//method to decelerate the car (reduce the speed by 5) public void brake() { speed -= 5;
// preventing speed being negative if (speed < 0) { speed = 0; } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
