In this set of programs, you will write classes that work together.
The classes are: 1. Truck 2. Car 3. Orders
REQUIRES user input and printing to be done in the classes other than the “test (or main) class”. The reason of this is, the (nonmain) classes will “take care of themselves”. That means the classes have all the knowledge to prompt the user for their information, store and retrieve their information, along with the accessors and mutators to return this information to the main program as requests are made.
The Order class accepts from the user what kind of vehicle they want to purchase, a Car (C/c) or a Truck (T/t). From this simple choice, Order calls the default constructor for the class requested. The default constructor is to call a method(s), name the methods the same in both the Car or Truck class.
From this constructor, the Orders class creates and object of Truck and of Car, per user’s request. Each Truck and Car selected will ask the user for some basic information; these are Model, Color, and Cost.
In addition to these three basic pieces of information when a: • Truck order; you will use a menu system to ask the user if: • Is it a “half ton”, or “one ton” truck? • Engine size, choices could be. “Really big”, “Not so big” (Please choose other engine sizes than these.) • Car order; you will use a menu system to ask the user: • The type of car: sedan, coupe, or wagon? • Does it have a towing package 1=yes, 2=no?
These options are numbered, 1, 2, etc. See the output examples for how the selections of these are to work.
The Orders class uses the Truck and Car classes as needed. Creating a new object of the Truck or Car and adding the appropriate object to a Collection maintained by Orders.
Once the user says there are no more orders, have Orders iterate through Order’s Collection. In this loop determine if the object is a Truck or Car by using the “instanceof” operator. If it is a Car, then cast the object as Car and execute the toString() to have it return the formatted information about the car (see output). Similarly for if the object is of the Truck class.
Requirements: • Truck and Car classes have a default constructor that calls methods which request input to that class. • Classes must have Accessors and Mutators for all attributes, along with a toString(). • Must store the orders for Truck and Car in ONE common Collection. Inputs MUST be in order and data type as shown (or 15 points deduction). That is, menu’s must accept numeric entries for the menu choices. For example, you may set the Truck Engine Size to say any two size options you want, but they must be asked at the correct time and the number choices must be 1 and 2.
In similar methods of Truck and Car, give them the same name.
Do you want to order a Truck (T/t) or Car (C/c)? C
Entering Car order:
What type of Car is this?
3 Does this car have a towing package?
Do you want to order another vehicle? Y
Do you want to order a Truck (T/t) or Car (C/c)? T
Entering Truck order:
Model: Dodge Ram
What size truck is this?
2. Full ton
What is the engine size of the truck?
1. Really big
2. Not so big
2. No Choice: 2
Do you want to order another vehicle? n
Car: Model: Ford Color: Green Cost: $19875.95 Type: Wagon Towing: included
Truck: Model: Dodge RamTruck Color: red Cost: $25000.95 Load: Half-ton Engine: Not so big
Thank you for using Your Name's Ordering System.
//end sample output
27 freelancers are bidding on average $33 for this job
Hi I could get this done within a couple of hours. If interested please let me know in the chat. Cheers, Saminda Relevant Skills and Experience C++, Java Proposed Milestones $20 USD - Default Milestone
I can complete this project in 5 hours. Message me and I'll start working on it :) Relevant Skills and Experience . Proposed Milestones $25 USD - project milestone
i can make you this. it's no big deal. looking forward to hearing from you. thanks!!! Relevant Skills and Experience java Proposed Milestones $20 USD - classes java
I'll do this request quickly. Clean and understandable code. Relevant Skills and Experience Long and wide Java experience, OOP expert. Proposed Milestones $20 USD - Finish the program