A program that will accept the following:
1. Plate Number of a car.
2. Parking Level
3. Number of Hours Parked
Compute and display the Parking Fee based on the following:
1. First 2 hours = 30 pesos
2. Succeeding Hours = 20 pesos / hour
3. Parking Level A -> No Discount
4. Parking Level B -> 5% Discount
5. Parking Level C -> 10% Discount
6. Other parking Level -> "Invalid Input"
Do you wish to know how to use if, else if, and else statements? If so, if statements test if a variable matches a certain value.
Example:
int num;
cout<<"Enter a number.\n";
cin>>num;
if (num="1")
{
cout<<"Your number is 1.\n";
}
else if (num="2")
{
cout<<"Your number is 2.\n";
}
else
{
cout<<"Your number is another number.\n";
}
I hope I helped! Also, remember to never put a semicolon after the parentheses of an if or else if statement!
Your code is not in the braces here. You dont need the braces if the IF has only 1 statement, but its a good idea to use braces anyways incase you add onto the program later.
It is really hard to determine what braces match to what braces. So I might be wrong but it looks like you dont have any opening braces for your if statements.
So be consistent with your braces. What I mean is this, here are 2 examples where you place your braces in different positions.