38.5k views
1 vote
Five Star Retro Video rents VHS tapes and DVDs to the same connoisseurs who like to buy LP record albums. The store rents new videos for $3.00 a night, and oldies for $2.00 a night. Write a program that the clerks at Five Star Retro Video can use to calculate the total charge for a customer’s video rentals. The program should prompt the user for the number of each type of video and output the total cost.

1 Answer

6 votes

Answer:

here is code in C++.

#include <bits/stdc++.h>

using namespace std;

int main()

{

// variables to store number of each video

int new_video,old_video;

double total_charge;

cout<<"Please enter number of new video:";

// read number of new video

cin>>new_video;

cout<<"Please enter number of old video:";

// read number of old video

cin>>old_video;

// total change

total_charge=(3.0*new_video)+(2.0*old_video);

cout<<"total cost is: "<<total_charge<<endl;

return 0;

}

Step-by-step explanation:

Declare two variables "new_video" and "old_video" to store the number of each type of video.Read the value of both from user.Then calculate total charge by multiply 3.0 to number of new video & 2.0 to number of old video and add both of them. This will be the total charge.

Output:

Please enter number of new video:4

Please enter number of old video:6

total cost is: 24

User Nikhil Vishnu
by
8.0k points