steamengines

Problem 12

Oct 2nd, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. //Christian Ballard
  2. //COSC 1330 - 003
  3. //This program allows the salesclerk to display the total amount the customer owes.
  4.  
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.  
  11.     //Variables
  12.     double item1 = 0.0;
  13.     double item2 = 0.0;
  14.     double halfOff = .5;
  15.     double total = 0.0;
  16.  
  17.     //Inputs
  18.     cout << "Enter the first items price " << endl;
  19.     cin >> item1;
  20.     cout << "Enter the second items price " << endl;
  21.     cin >> item2;
  22.  
  23.     //Problem
  24.     if (item1 <= item2)
  25.     {
  26.     total = (item2 + item1 * halfOff);
  27.     }
  28.     else
  29.     {
  30.     total = (item1 + item2 * halfOff);
  31.     }
  32.  
  33.  
  34.     //Output
  35.     cout << "The total is: " << total << endl;
  36.  
  37.  
  38.  
  39.  
  40.  
  41.     system("pause");
  42.     return  0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment