Answer to Question #323766 in C++ for VEENY

Question #323766

A car park has the following charges. The 1st hours cost RM2.00. The sub sequent hours cost RM1.00 per hour. Write a program for this problem. 


1
Expert's answer
2022-04-05T09:30:05-0400




#include<iostream>
#include <iomanip>
using namespace std;




int main()
{
	float hours;
	cout<<"Enter hours: ";
	cin>>hours;
	float cost;
	if(hours<=1){
		cost=hours*2.0;
	}else{
		cost=2.0+(hours-1);
	}


	cout<<"Cost is: RM"<<cost<<"\n\n";
	
	system("pause");
	return 0;
}

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