Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.135.220.219
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/bnhans/../arpease/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/bnhans/../arpease/Gas.cpp

#include <iostream>
#include <string>
using namespace std;

int main() 
{
string iln;
iln="i";
iln+="o";
cout<<iln;
//----------------- Variables to be used
char gasGrade;// Characters for Premium,Super, and Regular

float carWash=0;//Sets the amount paid to the carwash set to 0
float gallons;// Actual amount of gallons purchased
float total;// Running total
float priceReg=3.399;//Price of Regular Gas
float pricePrem=3.679;//Price of Premium Gas
float priceSup=3.679;//Price of Super Gas
float gasPurchased;//Used to manipulate the 'total' variable
float temp;// Just a temp variable used to manipulate temp.

int discountPoints;//  The discounted Points
int  intGas;// Int number for gas

//------------------------- Input/Output

cout << "So your filling up your tank! Or maybe just a little?\nWell firstly, which grade would you like? Please note, A car was is only 6.00! \nAs of right now we have:";
cout<<"\n-----------------------------------\n";
cout<<"\nRegular, which is at 3.399$";
cout<<"\nPremium, which is at 3.679$\nSuper which is at 3.679$";
cout<<"\n-----------------------------------\n";
cout<<"\nPlease tell us which grade of gas you would like to purchase";
cout<<"\nWe accept R for regular, P for Premium,";
cout<<" and S for Super\n";
cin>>gasGrade;
cout<<"You have selected ["<<gasGrade<<"]  How much of that grade will you be purchasing?\n";
cin>> gasPurchased;
gallons=gasPurchased;
//---------------------------Proccess Information


//These are the steps included in finding the price of the 'type' of gas
intGas=static_cast<int>(gasPurchased);
if(gasGrade=='r'||gasGrade=='R')// Grade of Gas
{
discountPoints=intGas*3;// The number of gallons puchased X times 3 (for the regular)
gasPurchased=gasPurchased*priceReg;
}
else if(gasGrade=='p'||gasGrade=='P')
{
discountPoints=intGas*4;// The number of gallons purchasd X times 4 (for Premium)
gasPurchased=gasPurchased*pricePrem;
}
else if (gasGrade=='s'||gasGrade=='S')
{
discountPoints=intGas*5;//The number of gallons purchased X times 5 (for Super)
gasPurchased=gasPurchased*priceSup;
}


//------------------------Calculations

cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n---------------------Report--------------------";
if (intGas>=15)// Free car wash!!
{ cout<<"\nYou have purchased enough gas to receive a Free Car Wash!!! ";
total=gasPurchased;//Gives us the total for the gas.

}
else if(intGas<5)// Is the gas less then 5 gallons?
{

total=6+gasPurchased;// Well, add 6 dollars since they didnt buy enough
carWash=6;
}
else {
intGas=intGas-5;// This gives us a number from 1-10
total=intGas*.1;// gives us the percentage (10 to 90 percent)

temp=total*6;//caclulate the discount
total=6-temp;//subtract the discount
carWash=total;
total+=gasPurchased;// print out the total( total=total + gasPurchased)
}
//////////First we need to see what type of gas they purchased, we have
//////////The char still stored so we use some if/else statements

//-----------------------Output statements

if(gasGrade=='r'||gasGrade=='R')// Displays the amount of gallons for each grade
cout<<"\nYou purchased "<<gallons<<" gallons  of Regular Grade gas. ";
 else if(gasGrade=='s'||gasGrade=='S')
cout<<"You purchased "<<gallons<<" gallons of Super Grade gas. ";
  else
   cout<< "\nYou have purchased "<<gallons<<" gallons of Premium Grade gas";
if(carWash>0)
cout<<"\nThe price of you car wash is "<<carWash<<" $ "; //output
cout<<"\nWell, the total you owe is "<< total;// output
cout<<"\nYou can also redeem "<<discountPoints<<" points in the store";// Discount output
cout<<" for certain items/discounts";
cout<< "\n\n*****Thanks for your service!!*****";
// 

return 0;
}

Stv3n404 - 2023