Requirements: 1. Class - Vehicle Constructors: Methods: о Create a class named Vehicle. 。 Define private string variables for the vehicle's color, make, and model. o о Define a private integer variable for the number of doors. Define private double variables for the discount and price. Implement a copy constructor that takes a Vehicle object as a parameter and initializes the fields accordingly. Implement a constructor that accepts all private fields and assigns them using the "this" keyword. Create a no-argument constructor that initializes all fields to default values. Implement necessary accessor and mutator methods. Implement a method to calculate the total price after applying the discount. Override the toString method to provide a user-friendly representation of the vehicle. 2. Class Customer Methods: о - Create a class named Customer. • Define private string variables for name, city, and state. Implement necessary accessor and mutator methods. Override the toString method for user-friendly output. 3. Class CarDealership о Create an aggregate class that utilizes the Vehicle and Customer classes. Define private string fields for the store name and location. Implement private ArrayList to hold the vehicle inventory. о Implement private ArrayList to manage customer contacts. Override the toString method to present dealership information clearly. о 4. Class-Demo Demonstrate the functionality of the dealership in a separate class called Demo. о о Include the following functionality: 1. Add vehicles to the inventory - Allow the dealer to add multiple vehicles. Prompt the dealer if they wish to add the same vehicle as previously entered. If so, utilize the copy constructor; otherwise, prompt for new vehicle details. add customers to the contacts 2. 3. calculate vehicle prices 4. view customer information 5. exit the program. Create functionality using fields and methods implemented in the CarDealership class from step 3 above 5. Input Validation о Ensure users can input case-insensitive values to quit the program. • Validate menu options to ensure that only valid selections are accepted, catching any invalid inputs. 6. Output о Display vehicle information in a user-friendly format Format prices to include dollar signs, two decimal places, and commas о Display customers and vehicles after creation to verify creation of objects

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

Having trouble figuaring out how to go about constructing this java program

Requirements:
1. Class - Vehicle
Constructors:
Methods:
о Create a class named Vehicle.
。 Define private string variables for the vehicle's color, make, and model.
o
о
Define a private integer variable for the number of doors.
Define private double variables for the discount and price.
Implement a copy constructor that takes a Vehicle object as a parameter and initializes the fields
accordingly.
Implement a constructor that accepts all private fields and assigns them using the "this"
keyword.
Create a no-argument constructor that initializes all fields to default values.
Implement necessary accessor and mutator methods.
Implement a method to calculate the total price after applying the discount.
Override the toString method to provide a user-friendly representation of the vehicle.
2. Class Customer
Methods:
о
-
Create a class named Customer.
• Define private string variables for name, city, and state.
Implement necessary accessor and mutator methods.
Override the toString method for user-friendly output.
3. Class CarDealership
о
Create an aggregate class that utilizes the Vehicle and Customer classes.
Define private string fields for the store name and location.
Implement private ArrayList<Vehicle> to hold the vehicle inventory.
о Implement private ArrayList<Customer> to manage customer contacts.
Override the toString method to present dealership information clearly.
о
Transcribed Image Text:Requirements: 1. Class - Vehicle Constructors: Methods: о Create a class named Vehicle. 。 Define private string variables for the vehicle's color, make, and model. o о Define a private integer variable for the number of doors. Define private double variables for the discount and price. Implement a copy constructor that takes a Vehicle object as a parameter and initializes the fields accordingly. Implement a constructor that accepts all private fields and assigns them using the "this" keyword. Create a no-argument constructor that initializes all fields to default values. Implement necessary accessor and mutator methods. Implement a method to calculate the total price after applying the discount. Override the toString method to provide a user-friendly representation of the vehicle. 2. Class Customer Methods: о - Create a class named Customer. • Define private string variables for name, city, and state. Implement necessary accessor and mutator methods. Override the toString method for user-friendly output. 3. Class CarDealership о Create an aggregate class that utilizes the Vehicle and Customer classes. Define private string fields for the store name and location. Implement private ArrayList<Vehicle> to hold the vehicle inventory. о Implement private ArrayList<Customer> to manage customer contacts. Override the toString method to present dealership information clearly. о
4. Class-Demo
Demonstrate the functionality of the dealership in a separate class called Demo.
о
о
Include the following functionality:
1. Add vehicles to the inventory - Allow the dealer to add multiple vehicles. Prompt the
dealer if they wish to add the same vehicle as previously entered. If so, utilize the copy
constructor; otherwise, prompt for new vehicle details.
add customers to the contacts
2.
3.
calculate vehicle prices
4.
view customer information
5. exit the program.
Create functionality using fields and methods implemented in the CarDealership class from step
3 above
5. Input Validation
о
Ensure users can input case-insensitive values to quit the program.
• Validate menu options to ensure that only valid selections are accepted, catching any invalid
inputs.
6. Output
о
Display vehicle information in a user-friendly format
Format prices to include dollar signs, two decimal places, and commas
о
Display customers and vehicles after creation to verify creation of objects
Transcribed Image Text:4. Class-Demo Demonstrate the functionality of the dealership in a separate class called Demo. о о Include the following functionality: 1. Add vehicles to the inventory - Allow the dealer to add multiple vehicles. Prompt the dealer if they wish to add the same vehicle as previously entered. If so, utilize the copy constructor; otherwise, prompt for new vehicle details. add customers to the contacts 2. 3. calculate vehicle prices 4. view customer information 5. exit the program. Create functionality using fields and methods implemented in the CarDealership class from step 3 above 5. Input Validation о Ensure users can input case-insensitive values to quit the program. • Validate menu options to ensure that only valid selections are accepted, catching any invalid inputs. 6. Output о Display vehicle information in a user-friendly format Format prices to include dollar signs, two decimal places, and commas о Display customers and vehicles after creation to verify creation of objects
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning