Server IP : 172.16.15.8 / Your IP : 18.221.59.121 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/pswoodson/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
#include <iostream> #include <iomanip> using namespace std; // ----- Main Function ----- int main() { // ----- Variables ----- int grade, // Type of Gas gallonsint, // Gallons R, // Regular P, // Premium S, // Supremium washcost; // The Price for a Car Wash gallonsint = gallons; gallonsint = static_cast<int>(gallons); R = 3.399; // Regular Gas Prices Per Gallon P = 3.539; // Premium Gas Prices Per Gallon S = 3.679; // Supremium Gas Prices Per Gallon float gallons; // Number of Gallons Purchased discpts; // Discount Points for Each Grade char totalcost; // Total Cost for Gasoline and the Wash // ----- Input Values (Number of gallons) ----- cout << endl; cout << "\n\n~~~~~ Welcome to the Gasoline and Wash Discount Calculator! ~~~~~\n\n"; cout << endl; cout << "Enter number of gallons purchased"; cin >> gallons >> gallonsint; cout << endl; cout << "Enter Grade of Gasoline (R for Regular, P for Premium, or S for Supremium"; cin << grade; cout << endl; cout << "Enter Total Cost of Gas ; cin >> totalcost; cout << endl; // ----- Calculations ----- if ( gallonsint == 'R' || gallonsint == 'r' && gallonsint <= 15 ); totalcost = ( 3.399 * static_cast<int>(gallons) )* .60; discpts = 3 * static_cast<int>(gallons); cout << discpts << totalcost; else ( gallonsint == 'R' || gallonsint == 'r' && gallonsint >= 15 ); totalcost = 3.399 * static_cast<int>(gallons); discpts = 4 * static_cast<int>(gallons); cout << discpts << totalcost; cout << "~~~Free Car Wash!~~~"; if ( gallonsint == 'P' || gallonsint == 'p' && gallonsint <= 15 ); totalcost = ( 3.539 * static_cast<int>(gallons) ) * .60; discpts = 4 * static_cast<int>(gallons); cout << discpts << totalcost; else ( gallonsint == 'P' || gallonsint == 'p' && gallonsint >= 15 ); totalcost = 3.539 * static_cast<int>(gallons); discpts = 4 * static_cast<int>(gallons); cout << discpts << totalcost; cout << "~~~Free Car Wash!~~~"; if ( gallonsint == 'S' || gallonsint == 's' && gallonsint <= 15 ); totalcost = ( 3.679 * static_cast<int>(gallons) ) * .60; discpts = 5 * static_cast<int>(gallons); cout << discpts << totalcost; else ( gallonsint == 'S' || gallonsint == 's' && gallonsint >= 15); totalcost = 3.679 * static_cast<int>(gallons); discpts = 5 * static_cast<int>(gallons); cout << discpts << totalcost; cout << "~~~Free Car Wash!~~~"; return 0; }