Answer to Question #231838 in C++ for zttys

Question #231838

Write a program to help you calculate the amount of money that your customers have to

pay depending on how long they have used your computer (in hours).

first one hour = 1.20

subsequent hour = 0.80


1
Expert's answer
2021-09-01T02:35:49-0400
#include<iostream>
using namespace std;
int main(){
	int n;
	cout<<"Enter the number of hours you have been using the computer:\n";
	cin>>n;
	double amountToPay = 1.2;
	for(int i= 1; i<n; i++){
		amountToPay += 0.8;
	}
	cout<<"You should pay  "<<amountToPay<<endl;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS