I am taking an intro to c++ class and this is extra credit for my test...Why won't this program work!!
Code:
//Car Rite Rental
//By Mallory Mourot
//Extra Credit for Test One- Oct 19
#include <iostream>
using namespace std;
int main()
{
//definition of variables
char carType; char paymentOption;
int number; double total;
const double CdailyRate=30;
const double PdailyRate=40;
const double FdailyRate=50;
const double CmileRate=0.25;
const double PmileRate=0.35;
const double FmileRate=0.45;
//start up of program to gain input values carType, paymentOption
cout<<"Thank you for choosing Car Rite Rental for your rental needs!\n"
<<"\a Before we get started calculating your total owed please remember\n"
<<"that here at Car Rite Rental we havea MINIMUM PAYMENT OF $30.\n\n"
<<"First let's determine what type of car you have rented: \n\n"
<<"[please enter corresponding letter] \n"
<<"C-Chevrolet\n"<<"P-Pontiac\n"<<"F-ford\n";
cin>>carType;
cout<<"Please choose your payment option from the following: \n\n"
<<"[please enter corresponding number] \n"
<<"D-Daily Rate\n"<<"M-Mileage Rate\n";
cin>>paymentOption;
//determine the number of miles or days
if(paymentOption=='D'||'d')
cout<<"Please enter the number of days you have rented this vehicle: \n";
else
cout<<"Please enter the number of miles traveled in your rental car:\n";
cin>>number;
//final step of putting all the information together and getting a total owed
if((carType=='C'||'c') && (paymentOption=='D'||'d'))
{
total=CdailyRate*number;
cout<<"Your total owed today is: $"<<total<<"\nThank you again for choosing Car Rite Rental!\n";
}
else if((carType=='C'||'c') && (paymentOption=='M'||'m'))
{
total=CmileRate*number;
if(total>=30)
cout<<"Your total owed today is: $"<<total<<"\nThank you again for choosing Car Rite Rental!\n";
else
cout<<"Your total owed today is: $30.00\n"<<"Thank you again for choosing Car Rite Rental!\n";
}
else if((carType=='P'||'p') && (paymentOption=='D'||'d'))
{
total=PdailyRate*number;
cout<<"Your total owed today is: $"<<total<<"\nThank you again for choosing Car Rite Rental!\n";
}
else if((carType=='P'||'p') && (paymentOption=='M'||'m'))
{
total=PmileRate*number;
if(total>=30)
cout<<"Your total owed today is: $"<<total<<"\nThank you again for choosing Car Rite Rental!\n";
else
cout<<"Your total owed today is: $30.00\n"<<"Thank you again for choosing Car Rite Rental!\n";
}
else if((carType=='F'||'f') && (paymentOption=='D'||'d'))
{
total=FdailyRate*number;
cout<<"Your total owed today is: $"<<total<<"\nThank you again for choosing Car Rite Rental!\n";
}
else if((carType=='F'||'f') && (paymentOption=='M'||'m'))
{
total=FmileRate*number;
if(total>=30)
cout<<"Your total owed today is: $"<<total<<"\nThank you again for choosing Car Rite Rental!\n";
else
cout<<"Your total owed today is: $30.00\n"<<"Thank you again for choosing Car Rite Rental!\n";
}
else
cout<<"You have entered a number choice that was invalid!"<<endl;
return 0;
}