LabVIEW Problem (On NI LabVIEW Program)
Assume no car parks for longer than 24 hours at a time. Write a program that calculates the parking fees for customers who parked their cars in the garage.
Following is the parking rates for a garage at Boston:
0-1 Hours - $ 7.00,
1-2 Hours - $ 8.00
2-3 Hours - $ 9.00
3-4 Hours - $10.00
4-5 Hours - $ 12.00
5-6 Hours - $ 14.00
6-7 Hours - $ 35.00*
7-24 Hours - $40.00**
*with validation rate will be reduced to $16
**with validation rate will be reduced to $20
Program code:-
#include<iostream>
using namespace std;
int main(){
int hour;
double price;
cout<<"Enter No. of Hours For Parking: ";
cin>>hour;
if(hour>0 && hour<=1){
price=7.00;
}
else if(hour>1 && hour<=2){
price=8.00;
}
else if(hour>2 && hour<=3){
price=9.00;
}
else if(hour>3 && hour<=4){
price=10.00;
}
else if(hour>4 && hour<=5){
price=12.00;
}
else if(hour>5 && hour<=6){
price=14.00;
}
else if(hour>6 && hour<=7){
price=35.00;
}
else if(hour>7 && hour<=24){
price=40.00;
}
else{
price=0.00;
}
if(price==0){
cout<<"Invalid Hours. Try Again!!"<<endl;
}
else{
cout<<"Parking fee is: $"<<price;
}
}
Get Answers For Free
Most questions answered within 1 hours.