Question
I need assistance with code that opens the customer_records.txt file. HINT: Remember to use rstrip(' ') when getting each line from the file. The file
I need assistance with code that opens the customer_records.txt file. HINT: Remember to use rstrip(' ') when getting each line from the file. The file contains information for 5 customer records. All values are separated by a comma. The first three values are the customer id, first name, last name. The remaining values are the customer expenses. The program should split the customer id, first name, last name from the expenses and use these values to store the information in an object of type Customer. The program should use the __str__ of the Customer class to output the result for each student in the file. The output of your program should look like the following:
Customer ID: 14587 Name: Alexandra Lopez Address: 63 North Corona Lane Glen Cove, NY 11542 Monthly Expenses: [230.71, 212.57, 360.64, 292.44] Average Expense: 274.09 Highest Expense: 360.64 Lowest Expense: 212.57 Customer ID: 2417 Name: Hubert Bridges Address: 416 North Cherry Avenue Essex, MD 21221 Monthly Expenses: [110.45, 404.89, 131.02, 160.71] Average Expense: 201.77 Highest Expense: 404.89 Lowest Expense: 110.45
The customer_records.txt file has the data listed below.
ID,Name,Address,Expense 1,Expense 2,Expense 3,Expense 4,Expense 5
6577,Calvin Cruz,2408 Ashton Pl El Reno OK 73036,7183,2911,5805,6588,9605
8088,Mattie Doyle,157 State V Rd Long Lane MO 65590,8806,7052
5625,Dallas Blake,11373 1st St Bridgeville DE 19933,9099,6690,2057,6298,
1990,Melba Thompson,2020 Palomino Dr Greenwood AR 72936,9267
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