Description
Program Scenario (inspired by Starting Out with Java Early Objects, 5e, Tony Gaddis, p. 677.)
The Mon Cher Boutique utilizes a coupon discount scheme as a business strategy to reward frequent patrons and to ensure a steady income from returning customers. Discount coupons are printed and mailed to preferred customers every four months. A preferred customer must have spent at least $200.00 total. Coupons are awarded as follows:
Total Purchases | Discount on next Single Purchase
(under $100.00; not to be combined with any other discount; not applicable to sale items) |
Less than $200.00 | 0% discount |
$200.00 but less than $500.00 | 25% |
$500.00 but less than $750.00 | 30% |
$750.00 but less than $1,000.00 | 35% |
$1,000.00 or more | 40% |
The owner of Mon Cher Boutique has requested a report in descending order by the total $ purchases and showing data for all customers including the discount to be awarded (if any).
Program Requirements:
- Follow programming standards for documentation and coding; see assignment #1.
- Code your Identification Header at the beginning of your program2.?? file as comments.
- Next, provide the Problem Specification, Problem Analysis, and Implementation Directions
as comments.
- Use good OO design with main having minimal code. Isolate calculations from the read and print methods (functions); no calculations in conjunction with reading and printing!
- INPUT FILE: data ASCII text file in ascending order by the customer ID. Data lines end in a hidden new-line character. Fields are separated by spaces.
Line #1 | Name (max 20 spaces)
<string> includes spaces |
Newline | |
Line #2 | Address (one line only; max 20 spaces) <string> includes spaces |
Newline | |
Line #3 | Phone Number (max 9999999999) <int> |
Newline | |
Line #4 | Mailing List Flag
<bool> 1 = yes; 0 = no |
Email
<string> |
Newline |
Line #5 | Total $ Purchases (max $999999.99) <real> 2-decimal places |
Newline |
- The input file data must be read, and stored into a list (1-D array). Data for each customer is organized using multi-level inheritance. Use preferred OOD techniques; data is hidden (private) and accessed via public methods. NO code Libraries may be used for the list.
Declare: a class, Person, with fields
for Name, Address, and Phone Number,
Declare: a class, Customer, that inherits from the Person class with fields
for Mailing List Flag and Email address.
Declare: a class, DiscountCustomer, that inherits from the Customer class with fields,
for Total Purchases and Discount
- Sort the array list in descending order using the Selection Sort.
- ASCII Text Output file: out
Print the array list in descending order by the Total Purchases using good report formatting (title heading, column heading, and justified data). Show the earned amount of the discount.
Using UNIX
Part 1. Log on to UNIX with LogIn and password. From your home directory, create the prog2 subdirectory and change to the prog2 subdirectory.
>mkdir prog2
>cd prog2
>pwd
Part 2. Implementation
1. Create your files, compile, execute, test.
- To end this session: >logout
Part 3. Electronic Submission. DO NOT resubmit after the deadline!!!
1. Go to your home directory (verify with >pwd).
Copy your prog2 subdirectory to the grader’s directory:
>~cs3380_dou/bin/p_copy 2
2. Make sure the copy was accomplished by using the verify command to list the number of files copied: >~cs3380_dou/bin/verify 2