In: Computer Science
<<<<<<<<. I need the UML diagram for all classes.java below. >>>>>
// Vehicle.java
public class Vehicle {
// data members declared as private
private String make;
private double weight;
private double height;
private double length;
private int maxSpeed;
private int noOfDoors;
private int numberSeats;
/**
* @param make
* @param weight
* @param height
* @param length
* @param maxSpeed
* @param noOfDoors
* @param maxPassengers
* @param numberSeats
*/
public Vehicle(String make, double weight, double
height, double length,
int maxSpeed,
int noOfDoors, int numberSeats) {
this.make = make;
this.weight = weight;
this.height = height;
this.length = length;
this.maxSpeed = maxSpeed;
this.noOfDoors = noOfDoors;
this.numberSeats = numberSeats;
}
/**
* @return the make
*/
public String getMake() {
return make;
}
/**
* @param make
* the make to set
*/
public void setMake(String make) {
this.make = make;
}
/**
* @return the weight
*/
public double getWeight() {
return weight;
}
/**
* @param weight
* the weight to set
*/
public void setWeight(double weight) {
this.weight = weight;
}
/**
* @return the height
*/
public double getHeight() {
return height;
}
/**
* @param height
* the height to set
*/
public void setHeight(double height) {
this.height = height;
}
/**
* @return the length
*/
public double getLength() {
return length;
}
/**
* @param length
* the length to set
*/
public void setLength(double length) {
this.length = length;
}
/**
* @return the maxSpeed
*/
public int getMaxSpeed() {
return maxSpeed;
}
/**
* @param maxSpeed
* the maxSpeed to set
*/
public void setMaxSpeed(int maxSpeed) {
this.maxSpeed = maxSpeed;
}
/**
* @return the noOfDoors
*/
public int getNoOfDoors() {
return noOfDoors;
}
/**
* @param noOfDoors
* the noOfDoors to set
*/
public void setNoOfDoors(int noOfDoors) {
this.noOfDoors = noOfDoors;
}
/**
* @return the numberSeats
*/
public int getNumberSeats() {
return numberSeats;
}
/**
* @param numberSeats
* the numberSeats to set
*/
public void setNumberSeats(int numberSeats) {
this.numberSeats =
numberSeats;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Make=" + make + ", weight="
+ weight + ", height=" + height
+ ", length=" + length + ", maxSpeed=" +
maxSpeed
+ ", noOfDoors=" + noOfDoors + ", Number of
Seats ="
+ numberSeats;
}
}
==========================================
// Car.java
public class Car extends Vehicle {
private int maxPassengers;
private boolean isConvertable;
public Car(String make, double weight,
double height, double length,
int maxSpeed, int noOfDoors, int maxPassengers,
int numberSeats,
boolean
isConvertable) {
super(make, weight, height,
length, maxSpeed, noOfDoors, numberSeats);
this.maxPassengers =
maxPassengers;
}
/**
* @return the
maxPassengers
*/
public int getMaxPassengers() {
return
maxPassengers;
}
/**
* @param
maxPassengers
* the maxPassengers to set
*/
public void setMaxPassengers(int
maxPassengers) {
this.maxPassengers =
maxPassengers;
}
/**
* @return the
isConvertable
*/
public boolean isConvertable()
{
return
isConvertable;
}
/**
* @param
isConvertable
* the isConvertable to set
*/
public void setConvertable(boolean
isConvertable) {
this.isConvertable =
isConvertable;
}
/*
* (non-Javadoc)
*
* @see
java.lang.Object#toString()
*/
@Override
public String toString() {
return "Car ::" +
super.toString() + ", MaxPassengers=" +
maxPassengers
+ ", isConvertable=" +
isConvertable;
}
}
==========================================
// Bus.java
public class Bus extends Vehicle
{
private int
numberAxles;
public Bus(String make, double weight,
double height, double length,
int maxSpeed, int noOfDoors, int numberSeats,
int numberAxles) {
super(make, weight, height,
length, maxSpeed, noOfDoors, numberSeats);
this.numberAxles =
numberAxles;
}
/**
* @return the
numberAxles
*/
public int getNumberAxles() {
return
numberAxles;
}
/**
* @param
numberAxles
* the numberAxles to set
*/
public void setNumberAxles(int numberAxles)
{
this.numberAxles =
numberAxles;
}
/*
* (non-Javadoc)
*
* @see
java.lang.Object#toString()
*/
@Override
public String toString() {
return "Bus ::" +
super.toString() + ", Number Axles=" + numberAxles;
}
}
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me