Question

In: Computer Science

<<<<<<<<. I need the UML diagram for all classes.java below. >>>>> // Vehicle.java public class Vehicle...

<<<<<<<<. 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;
   }

}

Solutions

Expert Solution

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


Related Solutions

Draw a UML diagram for the classes. Code for UML: // Date.java public class Date {...
Draw a UML diagram for the classes. Code for UML: // Date.java public class Date {       public int month;    public int day;    public int year;    public Date(int month, int day, int year) {    this.month = month;    this.day = day;    this.year = year;    }       public Date() {    this.month = 0;    this.day = 0;    this.year = 0;    } } //end of Date.java // Name.java public class Name...
I need a pseudocode and UML for this program. import java.util.Random; public class SortandSwapCount {   ...
I need a pseudocode and UML for this program. import java.util.Random; public class SortandSwapCount {    public static void main(String[] args) {        //Generate random array for test and copy that into 3 arrays        int[] arr1=new int[20];        int[] arr2=new int[20];        int[] arr3=new int[20];        int[] arr4=new int[20];        Random rand = new Random();        for (int i = 0; i < arr1.length; i++) {            //Generate random array...
draw a uml diagram for a class
draw a uml diagram for a class
C++ Code (I just need the dieselLocomotive Class) Vehicle Class The vehicle class is the parent...
C++ Code (I just need the dieselLocomotive Class) Vehicle Class The vehicle class is the parent class of the derived class: dieselLocomotive. Their inheritance will be public inheritance so reflect that appropriately in their .h files. The description of the vehicle class is given in the simple UML diagram below: vehicle -map: char** -name: string -size:int -------------------------- +vehicle() +getSize():int +setName(s:string):void +getName():string +getMap():char** +setMap(s: string):void +getMapAt(x:int, y:int):char +~vehicle() +operator--():void +determineRouteStatistics()=0:void The class variables are as follows: map: A 2D array of...
Complete the following class UML design class diagram by filling in all the sections based on...
Complete the following class UML design class diagram by filling in all the sections based on the information given below.         The class name is Boat, and it is a concrete entity class. All three attributes are private strings with initial null values. The attribute boat identifier has the property of “key.” The other attributes are the manufacturer of the boat and the model of the boat. Provide at least two methods for this class. Class Name: Attribute Names: Method...
I need a uml diagram of password manager and little explaining about it as a project...
I need a uml diagram of password manager and little explaining about it as a project report
create the UML Diagram to model a Movie/TV viewing site. Draw a complete UML class diagram...
create the UML Diagram to model a Movie/TV viewing site. Draw a complete UML class diagram which shows: Classes (Only the ones listed in bold below) Attributes in classes (remember to indicate privacy level, and type) No need to write methods Relationships between classes (has is, is a, ...) Use a program like Lucid Cart and then upload your diagram. Each movie has: name, description, length, list of actors, list of prequals and sequals Each TV Show has: name, description,...
I need a java flowchart diagram for the following code: import java.util.*; public class Main {...
I need a java flowchart diagram for the following code: import java.util.*; public class Main {    public static void main(String[] args) {    Scanner sc=new Scanner(System.in);           System.out.print("Enter the input size: ");        int n=sc.nextInt();        int arr[]=new int[n];        System.out.print("Enter the sequence: ");        for(int i=0;i<n;i++)        arr[i]=sc.nextInt();        if(isConsecutiveFour(arr))        {        System.out.print("yes the array contain consecutive number:");        for(int i=0;i<n;i++)        System.out.print(arr[i]+" ");   ...
A UML class diagram can be used to model UML by considering each graphical component of...
A UML class diagram can be used to model UML by considering each graphical component of the notation to be a class. For example, a class diagram contains a collection of classes. Your problem is to construct and draw one class diagram with the below UML elements. That is, there will be a class for each of the elements listed. You must also provide ALL of the relationships between each of these classes. The elements to model in the class...
Draw a UML diagram that describes a class that will be used to describe a product...
Draw a UML diagram that describes a class that will be used to describe a product for sale on Glamazon.com. The product has a name, a description, a price, ratings by many customers (1 to 5 stars), and a group of customer comments. New products have no ratings or comments by customers, but do have a name, description and price. The price can be changed and more customer ratings and comments can be added. A global average rating of all...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT