Problem description:
cout << "What kind of vehicle are you operating today? Please enter 'C' for car, 'T' for truck or 'S' if you are a senior citizen. ";
cin >> userVehicle;
if ((userVehicle == "C" || userVehicle == "c") && userHours <= 5) {
cout << "Enter total parked hours and minutes separated by a space. ";
cin >> userHours;
cin >> userMins;
charge = ((userHours - 3) - 2) + ((userHours - 5) * .50);
cout << "Please pay " << charge;
} else {
cout << "Something went wrong";
}
Expected behavior:
What kind of vehicle are you operating today? Please enter ‘C’ for car, ‘T’ for truck or ‘S’ if you are a senior citizen. c
Enter total parked hours and minutes separated by a space. 8 0
Please pay 4.5
Actual behavior:
What kind of vehicle are you operating today? Please enter ‘C’ for car, ‘T’ for truck or ‘S’ if you are a senior citizen. c
Something went wrong
Steps to reproduce:
Run program
Enter C or c for car
Bug appears at this link:
Shouldn’t reproduce “Something went wrong” It’s not checking all the conditions.
Browser/OS/Device:
Browser, windows PC.