Write a C++ program that reads and processes a customer file CISS_241_Final_1.da
ID: 3617134 • Letter: W
Question
Write a C++ program that reads and processes a customer fileCISS_241_Final_1.dat. Each record (line)of the file contains a customer number (nine digits), the name of arented item, an item code, and the number of days the item wasrented. One record exists for each customer.
Your program is to read the input file and produce a rentalreport written to an output file (you choose its location andname). The report shall display a line for each customer, and eachline shall contain the customer number, the name of the renteditem, the number of days the item was rented, and the charge forrenting the item. The rental fee for items is based on the itemcode and the following fee structure (note that daily feesaccumulate):
CodeA Code B
First Day $4.50 First Day 6.75
Next 4 Days $3.00 perday Next 4 Days 4.00 per day
Thereafter $6.00 perday Thereafter 8.50 perday
Example: 3 days =$10.50 Example: 6 days = $31.25
Code C
First Day $10.25
Next 4 Days $8.50 per day
Thereafter $16.00 perday Example: 1 day = $10.25
Display at the bottom of the report the total number of itemsrented, the average number of days each item was rented, and thetotal amount charged for all rented items. Use a single separatefunction to calculate the rental charge.
Helpful Pseudocode
Set the following according to Item Code: Day_1_Charge, Next_4_Charge, and Thereafter_Charge
If the number of days exceeds 1
If the number of days is less than 6
Rental charge is Day_1_Charge plus Next_4_Charge * (number of days minus 1)
Else
Rental charge is Day_1_Charge plus Next_4_Charge * 4 + Thereafter_Charge * (number of days minus 5)
End If
Else
Rental charge is Day_1_Charge
End If
Explanation / Answer
please rate - thanks sorry again #include #include using namespace std; double getcost(int,char); int main() {int number,days,rentals=0,totdays=0; double cost,average=0,total=0; string name; char code; ifstream in; ofstream out; in.open("CISS_241_Final_1.dat"); if(in.fail()) { coutcode>>days; cost=getcost(days,code); total+=cost; totdays+=days; outRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.