Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.222.164.176
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/dobutler/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/dobutler/assign2.cpp
//-----------------------------------------------------------------
//
// This program calculates the cost of gasoline, the price of a wash,
// the total cost and the number of discount points earned.
//
//Written by Damien Butler
//
//-----------------------------------------------------------------

// ---- Preprocessor Section

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

// ----Main Function

int main ()
{

// ---- Variables

int
   gallonsint,	     // number of gallons 
   rwdpts;	     // reward points for gasoline
   
float
   gallons,          // number of total gallons pumped
   gascost;          // cost of gas
   
char
   gasgrade;         // grade of gas
   

// ---- Input

cout << "\n\n Please enter your grade of gasoline \n\n";
cin >> gasgrade;

cout << "\n\n Enter amount of gallons purchased \n\n "; 
cin >> gallons;

// ---- Processing
 
 

gallonsint = static_cast<int> (gallons);

if ( gasgrade == 'r' || gasgrade == 'R' )
   rwdpts = 3 * gallonsint;
else if ( gasgrade == 'p' || gasgrade == 'P')
   rwdpts = 4 * gallonsint;
else if ( gasgrade == 's' || gasgrade == 'S')
   rwdpts = 5 * gallonsint;


if ( gasgrade == 'r' || gasgrade == 'R')
   gascost = 3.399 * gallons;
else if ( gasgrade == 'p' || gasgrade == 'P')
   gascost = 3.539 * gallons;
else if ( gasgrade == 's' || gasgrade == 'S')
   gascost = 3.679 * gallons;




// ---- Output

cout << 
"\n\n*************************************************************************";
cout << "\n             * Reward point Sytem*";
cout << "\n\n	     Gallons of gas pumped:    "<< gallons;
cout << setprecision(1);     // one decimal digits for floats
cout << "\n          Reward points earned:     "<< rwdpts;
cout << "\n          Cost of Gas:              "<< gascost;
cout << setprecision(2);     // two decimal digits for floats
cout << "\n\n		Congrats!!!!!!";

}

Stv3n404 - 2023