Hello.... I'm a little confused on how the char system works. As you can see, I started coding what I wanted to do. I'm just confused on classes like Car and Truck and how to apply them to my code. I'm pretty good when I get down to the IF statements now... however, I still can't get a grasp on the char function yet. I basically want the user to enter Car or Truck... or even 'C', 'c', 'T', 't' obviously the capital and little C equaling Car and the capital T and little t equaling Truck. Anyone know what I'm trying to say... I'm even confusing myself.
---------------------------------------------------------------------
Problem: Determine the cost of a single customer to park in the parking lot. Trucks are charged at a rate of $3/hour and cars are charged at a rate of $1.75/hr. Trucks get 1 hour of free parking and cars get 2 hours of free parking. Input the number of minutes that the vehicle parked and determine the cost. If a vehicle parks for part of an hour, we will charge them for the entire hour. Display the vehicle type, hours parked, and the fee to park in the lot.
Code:/**********************************************************************
*Program Name : Parking Fee Receipt
*Program Description: Write a program that will determine how much a car or truck will have to pay in the parking lot.
*
*BEGIN - Parking Fee Receipt
* Input Vehicle Type
* Clear the screen
* If(Vehicle Type Is Valid)
* Input Number Of Minutes Parked
* Convert Minutes Parked To Hours Parked
* If(Vehicle Type Is A Truck)
* Calculate Cost For Truck
* Vehicle Type = "Truck"
* Else Vehicle Is A Car
* Calculate Cost For Car
* Vehicle Type = "Car"
* End If
* Display Receipt
* Else // Vehicle Type Is Invalid
* Display Error Message
* End If
*END - Parking Fee Receipt
**********************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
//local constants
const int TRUCK_RATE = 3;
float CAR_RATE = 1.75;
const int FREE_TRUCK = 1;
const int FREE_CAR = 2;
//local variables
int Num_Min;
char Veh_Type;
/************************start main program************************/
// Input Vehicle Type
cout << "Car or Truck? : ";
cin >> Veh_Type;
// If The Vehicle Is Valid
If( Veh_Type == 'C'
//Clear the screen
system("cls");