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...
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...
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...
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,...
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...
NEed UML diagram for this java code: import java.util.ArrayList; import java.util.Scanner; class ToDoList { private ArrayList<Task>...
NEed UML diagram for this java code: import java.util.ArrayList; import java.util.Scanner; class ToDoList { private ArrayList<Task> list;//make private array public ToDoList() { //this keyword refers to the current object in a method or constructor this.list = new ArrayList<>(); } public Task[] getSortedList() { Task[] sortedList = new Task[this.list.size()];//.size: gives he number of elements contained in the array //fills array with given values by using a for loop for (int i = 0; i < this.list.size(); i++) { sortedList[i] = this.list.get(i);...
Use the UML tool to draw a UML class diagrambased on the descriptions provided below....
Use the UML tool to draw a UML class diagrambased on the descriptions provided below.The diagram should be drawn with a UML toolIt should include all the classes listed below and use appropriate arrows to identify the class relationshipsEach class should include all the described attributes and operations but nothing elseEach constructor and method should include the described parameters and return types - no more and no lessPlease do one of the following in JavaDescriptions of a PriceBecause of the...
What would the pseudocode look like for this UML class diagram? Class - oranges: String -...
What would the pseudocode look like for this UML class diagram? Class - oranges: String - bananas: String - grapes: String - apples: String + Class(String bananas, String grapes, String apples) + oranges( ): void + isValidGrapes( ): boolean + isValidApples( ): boolean + getOranges( ): String + getBananas( ): String + setBananas(String bananas): void + getGrapes( ): String + setGrapes(String grapes): void + getApples( ): String + setApples(String apples): void
Given the following UML class diagram, implement the class as described by the model. Use your...
Given the following UML class diagram, implement the class as described by the model. Use your best judgment when implementing the code inside of each method. +---------------------------------------------------+ | Polygon | +---------------------------------------------------+ | - side_count : int = 3 | | - side_length : double = 1.0 | +---------------------------------------------------+ | + Polygon() | | + Polygon(side_count : int) | | + Polygon(side_count : int, side_length : double) | | + getSides() : int | | + setSides(side_count : int) | |...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT