Question: I Need Help Adding On To What I Have In My Part A We Are Starting Part B I Will Post My Part A Code
I Need Help Adding On To What I Have In My Part A We Are Starting Part B I Will Post My Part A Code At The Bottom I Used Vehicle
You are making use of what you know about the following concepts: Class, Object, Inheritance, Polymorphism, Searching/Sorting, ArrayLists, Dependency, Aggregation. Make Sure There Are Comments In Your Program.
Here is my Part A Code
Vehicle.Java
public class Vehicle { protected String name; // The model name of the vehicle protected int number_of_wheels; // Stores the number of wheels the Vehicle has protected String make; // the make of the vehicle protected String type; // the type of vehicle (car or truck) protected int mpg; // mileage per gallon // Parameterized Constructor public Vehicle(String name, int number_of_wheels, String make, String type, int mpg) { super(); this.name = name; this.number_of_wheels = number_of_wheels; this.make = make; this.type = type; this.mpg = mpg; } /** * * @return name - The Name of the Vehicle * */ public String getName() { return name; } /** * * @param name - Sets the Vehicle Name * */ public void setName(String name) { this.name = name; } /** * * @return number_of_wheels - No. of wheels the Vehicle has * */ public int getNumber_of_wheels() { return number_of_wheels; } /** * * @param number_of_wheels - Sets the No. of wheels for the Vehicle * */ public void setNumber_of_wheels(int number_of_wheels) { this.number_of_wheels = number_of_wheels; } /** * * @return make - The company name who made the Vehicle * */ public String getMake() { return make; } /** * * @param make - Sets the company Name who made the Vehicle * */ public void setMake(String make) { this.make = make; } public String getType() { return type; } public void setType(String type) { this.type = type; } public int getMpg() { return mpg; } public void setMpg(int mpg) { this.mpg = mpg; } // Display all the Vehicle Attributes @Override public String toString() { return "Vehicle [name=" + name + ", number_of_wheels=" + number_of_wheels + ", make=" + make + ", type=" + type + ", mpg=" + mpg + "]"; } VehicleMain.java
import java.util.ArrayList; public class VehicleMain { public static void main(String[] args) { // Create 4 Vehicle instances Vehicle car1 = new Vehicle("VOLVO SUV", 4, "VOLVO", "Car", 60); Vehicle car2 = new Vehicle("Honda Ciaz", 4, "Honda", "Car", 80); Vehicle truck1 = new Vehicle("EX-235", 10, "TATA MOTORS", "Truck", 40); Vehicle truck2 = new Vehicle("DUMPER", 8, "ASHOK LEYLAND", "Truck", 50); // Create an ArrayList of Vehicle, so that we can add different Vehicle instances to it ArrayList
Picture Of Part B Assignment.
For this part, you will use the class you created in part A (if you had errors, be sure to correct em Parent/child classes: Depending on whether the class you created in part A can be used as a parent or a child, will depend on what classes you will need to create in this part. You need to show a hierarchy of at least 3 classes. You can determine the relationship, but you need to specify and define why you chose the relationship (such as dependency and/or aggregation). Put the information in the header of each class file. You must use inheritance. When writing your class system, you need to show completeness meaning be a "completely useable" set of classes. Tester class: Create a menu that will allow the user to choose between being an administrator and a regular user. The administrator will configure the system. For example, for an inventory system, the administrator would input the initial quantities for each item. The regular user will use the system. For example, the inventory system may be used for a store, where the user will make a purchase. However, you decide to implement the interface into your class system, you will need to show the logic in pseudocode in the header of your tester class Programming Note: You may use any concepts that are covered from chapters 1 to 12 (we skipped chapters 10 and 11) of your textbook. Remember that your code needs to clear and easy to read. The logic in your tester should be easy to follow Possible implementations: When reviewing the classes submitted in part A, here are some suggestions for menu-driven systems A patient portal, record keeping system (Person, Animal, ComputerShop) A student management system (Student) .A store inventory system, a general inventory system (Hats, Motorcycle, Dairy, Shoe Cheese, ComputerShop) Game system (SportsTeam, Counterstrike, Nbateams) .Ticket sales (SportsTeam, Nbateams) .Online food ordering, restaurant inventory managment (Dairy, Cheese)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
