Program homework help (C++)
Oct 2, 2012 at 5:29pm UTC
Assignment:
https://docs.google.com/open?id=0B3Nv216jMOaLMVRNWXNiejh4ckk
I'm not sure as to how I will get the second set of discounts to work. I am quite new to C++. I have below what I think should do it but I cannot get this to work. Also I am unsure where my brackets should be placed. Any help at all would be greatly appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
#include <iostream>
using namespace std;
int main()
{
//Declare Variables
double discount;
double cfdiscount;
double lldiscount;
double mmdiscount;
double total;
char person;
int coffee, latte, mocha;
int totaldrinks;
double subtotal;
double aftervolume5;
const double DISCOUNT1 = .03;
const double DISCOUNT2 = .05;
const double DISCOUNT3 = .1;
const double DISCOUNT4 = .15;
const double DISCOUNT5 = .2;
//Prompt if student or faculty
cout << "Input a S if customer is a student or F if customer is faculty: " ;
cin >> person;
cout << "Enter the amount of coffees, lattes, and mochas the customer has ordered: " ;
cin >> coffee >> latte >> mocha;
//Calculation for the total for the drinks
totaldrinks = (coffee * 1.35) + (latte * 3.15) + (mocha * 3.45);
//Calculations for subtotal
subtotal = totaldrinks - discount;
//Calculation for total before tax
total = subtotal - cfdiscount - lldiscount - mmdiscount;
// Configuring volume discount
if (totaldrinks < 20)
discount = DISCOUNT1 * totaldrinks;
cout << subtotal << "after your 3% discount" << endl;
else if (totaldrinks >= 20 && totaldrinks < 40)
discount = DISCOUNT2 * totaldrinks;
cout << subtotal << "after your 5% discount" << endl;
else if (totaldrinks >= 40 && totaldrinks <=60)
discount = DISCOUNT3 * totaldrinks;
cout << subtotal << "after your 10% discount" << endl;
else if (totaldrinks > 60 && totaldrinks <=75)
discount = DISCOUNT4 * totaldrinks;
cout << subtotal << "after your 15% discount" << endl;
else (totaldrinks > 75);
discount = DISCOUNT5 * totaldrinks;
cout << subtotal << "after your 20% discount" << endl;
//configuring power drinker discount
if (coffee > 60)
cfdiscount = 5;
cout << "You are a Caffeine Fiend enjoy a $5 discount" <<endl;
else cfdiscount = 0;
if (latte > 40)
lldiscount = 10;
cout << "You are a Latte Lover enjoy a $10 discount" <<endl;
else lldiscount = 0;
if (mocha > 50)
mmdiscount = 15;
cout << "You are a Mocha Monster enjoy a $15 discount" <<endl;
else mmdiscount = 0;
Last edited on Oct 2, 2012 at 5:35pm UTC
Oct 2, 2012 at 7:14pm UTC
my skype is hepic.hepic
Add me and i will help you with your homeworks.
Oct 2, 2012 at 7:21pm UTC
Topic archived. No new replies allowed.