Write a C++ program that reads and processes a customer file CISS_241_Final_3.da
ID: 3617135 • Letter: W
Question
Write a C++ program that reads and processes a customer fileCISS_241_Final_3.dat. Each record (line)of the file contains a customer number (nine digits), the name of arented item, the base rate to rent the item, and the number of daysthe item was rented. 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 thefollowing fee structure (note that daily fees accumulate):
First Day 100%of base rate
Next 4 Days 65% of base rate per day
Thereafter 150% ofbase rate per day
Example 1: Base rate $10.00 for 3 days = $23.00 (10.00 * 1.0 +10.00 * 0.65 * 2)
Example 2: Base rate $12.50 for 10 days = 138.75 (12.50 * 1.0 +12.50 * 0.65 * 4+ 12.50 * 1.5 * 5
Example 3: Base rate $20.00 for 1 day = $20.00 (20.00 * 1.0)
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 separate functionto calculate the rental charge.
Helpful Pseudocode
If the number of days exceeds 0
If the number of days exceeds 1
If the number of days is less than 6
Rental charge is Base_Rate * 100% plus Base_Rate * 65% * (number of days minus 1)
Else
Rental charge is Base_Rate * 100% plus Base_Rate * 65% * 4 +
Base_Rate * 150% * (number of days minus 5)
End If
Else
Rental charge is Base_Rate * 100%
End If
Else
Rental charge is zero
End If
Explanation / Answer
please rate - thanks #include #include using namespace std; double getcost(int,double); int main() {int number,days,rentals=0,totdays=0; double cost,average=0,total=0,base; string name; ifstream in; ofstream out; in.open("CISS_241_Final_3.dat"); if(in.fail()) { coutbase>>days; cost=getcost(days,base); 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.