Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

book: objects first with java intro to object oriented programing chapter 8 We h

ID: 3570439 • Letter: B

Question

book: objects first with java

intro to object oriented programing

chapter 8

We have seen that, with suitable parameterization, the collection classes can store objects of

any object type. There remains one problem: Java has some types that are not object types.

As we know, the simple types

8.9:

We have seen that, with suitable parameterization, the collection classes can store objects of

any object type. There remains one problem: Java has some types that are not object types.

As we know, the simple types

Explanation / Answer

// Do let me know if you have any issues

class Vehicle {

}

class Car extends Vehicle {

   int maxSpeed;
   String make;
   String model;
  
}

class Bicycle extends Vehicle {

   String brand;
   double price;
   String type;
  
}

class Motorcycle extends Vehicle {

   int horsePower;
   int engineCapcity;
   int weight;
  
}

class Plane extends Vehicle {

   int maxAltitude;
   String manufacturer;
   String airLineCompany;
  
}

class Ship extends Vehicle {

   String type;
   String owner;
   String sonarType;
  
}

class Train extends Vehicle {

   int lenght;
   int noOfCoaches;
   String brakeType;
  
}