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).
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:
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)
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