Question
Problem: Disneyland has begun a service that allows guests at the park to pre-order drinks and pick them up at a designated time so as
Problem: Disneyland has begun a service that allows guests at the park to pre-order drinks and pick them up at a
designated time so as to avoid long concession lines. Guests that spend more than $150 (cumulatively) become
preferred customers and are awarded discounts on future orders. A program is needed to track the amount spent
by each customer and promote them to preferred customer when they have accumulated $150 in purchases.
Classes:
Customer (base class)
o Members
First name
Last name
Guest ID
Amount spent
o Methods
Overloaded Constructor
Accessors
Mutators
Preferred Customer (derived class)
o Member
Discount Percentage
o Methods
Overloaded Constructor (chained w/ base class constructors)
Accessor
* Mutator
Details:
The price of the drink is determined by the type of drink and the amount of ounces ordered
o The number of ounces ordered and the price per ounce will be given for each order
Each drink will come in a cylindrical container
The container can be personalized with different Disney graphics
The total price of the personalization is determined by the price per square inch of the container
o The radius, height and price per square inch will be given for each input
Preferred customer information and regular customer information will be stored in files and will be read
into memory before the program processes orders.
o Note that the files may be empty or may not exist.
o In both cases, the respective customer array should not be created until a customer reaches
preferred status.
Regular customers and preferred customers will be held in 2 separate arrays.
The arrays are to be no larger than the actual number of members in each category.
Orders will be read from a file.
After processing an order, if a customer has accumulated $150 or more, promote the customer to
preferred status.
o The preferred customer array will be resized to add one more element.
o Add the new preferred customer into the open element at the end of the preferred customer
array.
o Resize the regular customer array and remove the customer data that was promoted to preferred
status.
Preferred customers get a discount based on how much they have spent overall
o $150 = 5% discount
o $200 = 7% discount
o $350 = 10% discount
Input: Input data will be stored in three files: preferred.dat, customers.dat and orders.dat. The total number of
lines in each file will be unknown.
Preferred.dat will hold the data for known preferred customers and customers.dat will hold the data for known
regular customers. Both files should be read at the beginning of the program to establish the preferred customer
and regular customer arrays respectively. The files may be empty or may not exist. In such cases, there should
not be a respective customer array created before reading the orders.
Each line of preferred.dat will be formatted as follows (except for the last line of the file which will not have a
newline character). The data will be listed in the following order on each line with a space between each field.
There will be no invalid data on any line.
customer ID
first name
last name
amount spent
discount
newline
Each line of customer.dat will be formatted as follows (except for the last line of the file which will not have a
newline character). The data will be listed in the following order on each line with a space between each field.
There will be no invalid data on any line.
customer ID
first name
last name
amount spent
newline
Orders.dat will hold all orders to process. Each line of the file will be formatted as follows (except for the last line
of the file which will not have a newline character). The data will be listed in the following order on each line with
a space between each field. There will be no invalid data on any line.
customer ID
container radius
container height
ounces
ounce price
square inch price
quantity
newline
For each order, the main thing to note is the total cost and its connection to the appropriate customer. The total
cost will be added to the amount spent for each customer. If the customer has preferred status, the discounted
price will be added to the amount spent. After the amount spent has been updated, check to see if the customer
has gained preferred status or if the preferred customer qualifies for a larger discount.
When moving a regular customer to the preferred customer array, always add the data to the end of the array.
When removing the customer from the regular customer array, shift the elements toward the front of the array.
Do not rearrange the order of the data in either array. Remember that each array should be no bigger than the
number if elements it needs to hold.
Output: At the end of the program, write the regular customer data and preferred customer data to the
respective files. Use the proper format as listed above in the Input section. There will be no output to the screen.
sample customer :
64297 Mickey Mouse 100.00 217456 Christopher Robin 0.00 26384 Walt Disney 25.73
sample preffered:
778234 Minnie Mouse 165.50 5%
sample transaction:
26384 2.5 8 36 .25 .35 1 26384 2.5 10 40 .45 0 2 64297 3.25 12.5 64 .15 .03 10
FAQ:
Will there be invalid customer IDs in the transaction file?
No. All customer IDs in the transaction file will map to a customer ID in either the customer file or the preferred customer file.
Which files may be empty or not exist?
Only the preferred customer file may not exist or be empty. While the other two files will be there for this project, it is good programming practice to check that all files are present and open properly before trying to process them.
Will the cylinder be closed or open?
The cylinder will be closed. The surface area should be the top, bottom and side of the cylinder.
If a customer meets the threshold to become a referred customer, do we apply the discount to the order that put the customer over the amount?
Discounts should not be applied unless the customer is already at preferred status.
If a preferred customer places an order that puts them at a higher discount level, do we apply the new discount to that transaction?
No, any discount used is equal to the discount held in the preferred customer object before adding to the total. If the total meets the requirements of a larger discount level, apply the old discount, update the total and then assign a new discount if applicable.
Can I build a drink or transaction object (or array of objects)?
You can, but I think that would be inefficient. There is not a need to hold onto the drink information for anything more than a calculation. Creating an object to hold the results of a calculation seems wasteful of your memory.
How do I know if the customer dos not want the container to be personalized?
The price per square inch will be 0 (or 0.0).
THIS IS ALL IN JAVA
IN BOLD ABOVE IS THE PROBLEM/Question
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