Fisrtly, i would like to apologize for posting here,the reason being i coudnt login to java forum (always says admin server down).Need help ASAP on question below.THANKS IN ADVANCE
Scenario: Point of Sales System
CarMax Australia has recently setup business in Australia and the company is renowned for selling high
quality cars at very affordable rates. The company is planning to build from scratch its Point
of Sales System, thus it has requested you as the analyst programmer to fulfill the task.
The company sells four well renowned brands of cars named as follows:
1. Chevrolet
2. Jeep
3. Toyota
4. Kia
The application should be programmed in Java using object oriented concepts of classes and
objects.
How the Application Functions
The Point of Sales system should do the following Tasks:
1. Inform the customer of the different types of cars sold by CarMax Australia.
2. Ask the customer to make a choice in terms of cars.
3. Inform the customer about the cost of the associated with choice made.
4. Ask the customer to make full payment in advance.
5. Inform the customer that the vehicle is released for use.
Analysis of the Scenario
The POS system has three main Components:
1. A POS CashHandler component.
2. A POS VehicleRelease Component.
3. A Point of Sale System as a whole.
Therefore, you need to define a class to implement the CashHandler, a class to implement the
VehicleRelease and class to implement the Point of sale system itself.
Description of Classes
CashHandler Class
The CashHandler will have some cash on hand ($20,000.00), it accepts the amount from the
customer and if the amount entered is more than the cost of the item, then it returns the
change. For this application we assume that the user enters the exact amount for the product.
The CashHandler should also be able to show the POS system’s owner the amount of cash in
the system at any given time.
The following are some brief details about the class:
The CashHandler class has one instance variable cashAtHand of type integer.
A default constructor to set the cash At Hand to $20,000.00 initially.
A constructor with parameters to set the instance variable to the value specified by the
user. The value is passed as a parameter to the constructor. This constructor will do a data
validation in terms of cash. If the value is less than 0, the value assigned to the instance
variable cashAtHand remains $20,000.00 else the cashAtHand is replaced by the new value
supplied by the user.
A method balanceAtHand( ) that returns the balance of cash in the cash handler at any
time.
A method acceptCash(int) that accepts the cash given by the customer and updates the
cash handler by incrementing the amount deposited by the customer to the previous cash
at hand.
VehicleRelease Class
The VehicleRelease component will release the selected vehicle from the stock if it is available.
It should show the number of vehicles and the cost of each vehicle.
The following are some brief details about the class:
The VehicleRelease class has two instance variables numberOfVehicles and vehicleCost,
both of type integer.
A default Constructor to set the vehicle Cost and the number Of vehicles to default values
.i.e. for all vehicle models we have 50 pieces in stock and the price of each piece is $25,000.00
at start price which might change in future.
A Constructor with parameters to set the price and the quantity in the vehicleRelease
component to the values specified by the owner of the company when the sale is initiated.
The Constructor will also check for validity for the values in the parameter. If the values
are less than 0, the default values ($25,000.00) are assigned to the instance variables else the
values are replaced by what the user specifies.
A method getQuantityCount( ) to return the quantity in stock at any given point in time.
A method getVehicleCost( ) that returns the price of the of any particular vehicle when
requested by the program.
A method initiateSale( ) that completes the sales transection by reducing the quantity of
the specified vehicle by a count of one.
How the Point of Sale System Functions – Main Program
When the application is initiated, the following sequence of activities should be followed:
1. Display an application banner on top of the screen for CarMax Australia.
2. Display the vehicle selection range that is offered by CarMax Australia.
3. Inform the user on how to select a particular vehicle.
4. Inform the user on how to terminate the application if he/he wants to quit the selection
process.
Furthermore, the selection instructions must be displayed after processing each transection
(except when the customer wants to quit). Once the customer makes an appropriate choice of
vehicle, the Point of sale system must function accordingly. If the customer picks a vehicle
that is available, the Point of sale system should show the price of the vehicle and ask the
customer to make full payment for the vehicle sold with appropriate messages. If the vehicle
is out of stock, the POS system should say that the vehicle is out of stock.
There are two class methods in the Main class that you are required to implement:
showProductRange( );
sellVehicle(VehicleRelease vehicle, CashHandler cashTill);
The method showProductRange( ); will display the different brands of vehicles sold by
CarMax Australia. Use the following brand codes for the assignment purpose:
10c for Chevrolet
20j for Jeep
30t for Toyota
40k for Kia
The method sellVehicle(VehicleRelease , CashHandler ); will complete the sales transection
based on the choice of the customer. The method must check if the product requested by the
customer is available in stock, else inform the customer that the vehicle is out of stock. If the
vehicle is in stock, the customer has to make a full payment of exact cost of the vehicle to
complete the sales.
Use the following algorithm pseudocode for this method:
Based on the vehicle cost of the particular vehicle:
I. If the vehicle in stock is greater than 0, get the price of the vehicle and assign it to an
integer variable price. Also assign the same price to integer variable paymentRequired
and finally another integer variable paymentDone initialized to 0.
a. While the paymentDone is greater than 0, ask the customer to enter the exact
amount of payment by displaying the value of payment required. After the
payment is entered, calculate the new value of payment required which in this
case should be 0. If not zero, ask the user to re-enter the exact payment amount.
b. Update the total cash in the cash till.
c. Make the sale by initiating the initiate sale procedure.
d. Display an appropriate message saying that: “The sale has been completed and
the vehicle can be collected from the sales manager! Enjoy your new ride”.
II. Display an appropriate message if the selected vehicle is out of stock.
4
Main Method Requirements
1. Instantiate an object of CashHandler class.
2. Instantiate four objects of the VehicleRelease class. Use the following model,
quantity and cost values:
Vehicle Model Quantity Stock Asking Price
Chevrolet 200 $38,000.00
Jeep 50 $55,000.00
Toyota 100 $67,000.00
Kia 60 $65,000.00
3. Show Product Range Menu.
4. Input customer selection choice.
5. While selection choice not equal to 000:
a. Initiate sales transection: call sellVehicle( ) method. (Use if else or switch
case at this stage).
b. Show the selection process again
c. Input customer selection choice.
Note:
Steps a,b,c will continue repeating until the customer selection choice is 000.