The assignment problem:

You are asked to develop an application that prints a receipt for customers after store 40% discount. In this program you need to read a file of customers data and calculate the total discount for each customer, then print some information.

The input file "input.txt" contains the following information (Transaction ID, Customer first name, Customer last name, and total amount to be paid before discount).

Requirements:

1 .Must use/create functions to implement the program.

2. Must use exception handling where necessary (validate user input, check for correct files,etc.)

3 .Below is the needed menu to display:

  • Display transaction ID and username (First and Last name).
  • Display username (First and Last name), total amount to be paid before discount, total amount to be paid after discount, and the saved amount after discount.
    • Round your output to the nearest two digits.
    • You will need to take care of spaces between each column (see sample output).
  • Quit/Exit.

4. You will need to ask the user for the file name, to read the data.

5. After 1st attempt to user, your program will ask if user want to see the menu again and have another attempt.

6. Program will stop in two cases, either user decided to have no more attempts, or the user chose option 3. (please see output samples for examples)

Output Sample:

1- Print Transaction ID and username
2- Print username, total before and total after discount
3- Quit
Enter your choice ==> 4
Enter valid option
Enter your choice ==> 6
Enter valid option
Enter your choice ==> 1
Enter file name ==> data.txt
Enter correct file name
Enter file name ==> input.csv
Enter correct file name
Enter file name ==> input.txt
Reading data.....
ID FirstName LastName
10 Homer Smith
20 Jack Stanely
30 Daniel Hackson

Do you want to see more option Y/N: y
1- Print Transaction ID and username
2- Print username, total before and total after discount
3- Quit
Enter your choice ==> 2
Enter file name ==> input.txt
Reading data.....
ID  FirstName LastName   Before      After    Saved
10 Homer Smith 810.2 486.12 324.08
20 Jack Stanely 100.0 60.00 40.00
30 Daniel Hackson 333.90 200.34 133.56
40 Sara Thomson 1930.02 1158.01 772.01
50 Thomas Elu 932.0 559.20 372.80
60 Sam Carol 33.0 19.80 13.20
70 Tina Jefferson 334.90 200.94 133.96
80 Wael Lion 8843.2 5305.92 3537.28
90 Carol Smith 3994.09 2396.45 1597.64
100 Jack Carlton 99.0 59.40 39.60

Do you want to see more option Y/N: y
1- Print Transaction ID and username
2- Print username, total before and total after discount
3- Quit
Enter your choice ==> 3
Have a great day

Do you want to see more option Y/N: n
Have a great day
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.