Question
Please use java computer programming language and add comments so I can follow along and understand code. Thank you. Think of what a dealership has,
Please use java computer programming language and add comments so I can follow along and understand code. Thank you.
Think of what a dealership has, Cars, SalePersons, Manager and more objects.
We are only concerned for Car, SalesPerson, Manager and Dealership.
Write a class for Car and have the following private fields or members: make , price, year and vinNumber.
Write a class for SalesPerson and have the following private fields or members: First name, last name, Bonus, address, date of hiring.
Write a class for Manager and have the following private fields or members: First name, last name, address, date of hiring.
Write a class for Dealership and have the following private fields or members: Array of SalesPerson, Array of Car, and one Manager.
Provide constructor and methods for all of above classes. You should have setters and getters, and method toString() that returns states of objects that is what it knows about object (example: First name, last...).
Dealership class should have methods: addSalesPerson, removeSalesPerson, carSold , removeCar, addCar, and toString().
toString() should print state of Dealership: manager, SalesPersons, Cars, and number of car sold.
The Following shows a possible layout of Dearship class:
public class Dealership {
private ArrayList sp = new ArrayList (); private ArrayList cars= new ArrayList ();
private Manager mg;
public Dealership() {
}
public void addCar(Car another) {
}
public void addSalesPerson(SalesPerson s) {
}
public void removeSalesPerson(SalesPerson s) {
} public void carSold (SalesPerson s) {
} public void removeCar(Car aCar) {
}
public SalesPerson getPersonOfTheMonth() {
}
public String toString() {
}
An ArrayList class is used because we have no clue of how many cars, or SalesPerson the Dealership has.
Dealership must only be created when you associate a Manager with it, there is no other way.
Method getPersonOfTheMonth() Should return SalesPerson that makes highest bonus.
Diver class that you must use:
public class TestDealership {
public static void main(String [] args) {
// Create one manager
// Create at least 5 SalesPerson
// Create at Least 10 Cars
// Create one Dealership and associates manager with it.
// Use Dealership to add SalesPerson and Cars
// now test your program for all the method that was given in Dealership
// Example carSold, reamoveCar, reamoveSalesPerson.... // Note if the Car was sold you should not sell again
System.exit(0); }
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started