# COFFE PROBLEMS

 Christian Casin · February 24, 2015 Here is the goal. The coffee cost \$1.25 and the cashier will offer to add on coffee like milk,cream,sugar or artSweet the problem is I only know how to add only (1) one, I don't know how to allow my user to add more than 1 and display his ordered." Define a class named CoffeeOrder. Declare a private static field that holds the price of a cup of coffee as \$1.25. Include private integer fields that you set to a flag value of 1 or 0 to indicate whether the order should have any of the following: cream, milk, sugar, or artificial sweetener. Include a public function that takes a user’s order from the keyboard and sets the values of the four fields in response to four prompts. If the user indicates both milk and cream, turn off the milk flag to allow only cream. If the user indicates both sugar and artificial sweetener, turn off the artificial sweetener flag, allowing only sugar. Include another function that displays the user’s completed order.  Write a main() function that declares a CoffeeOrder object and calls the data entry and display methods. The solution should continue to ask a user for an order in a loop until the user indicates the order is complete or 10 orders have been placed, whichever comes first. After the user indicates that ordering is complete, display a recap of all the coffee orders, including the cream, milk, sugar, and sweetener status of each, as well as a count of the number of coffees ordered and the total price. "#include using namespace std;class CoffeeOrder{private: static double cupOfCoffee; int cream; int milk; int sugar; int artSweet; string flavor;public: void displayValues(); void takeOrder();};void CoffeeOrder::displayValues(){ cout<<"Your Coffee Includes: "<>cream; cout <<"Do you want to add a Milk? "; cin>>milk; cout <<"Do you want to add a sugar? "; cin>>sugar; cout <<"Do you want to add a Artificial Flavor? "; cin>>artSweet ; if(cream == 1) { flavor = cream; flavor = "cream"; } else if (milk == 1) { flavor = milk; flavor = "milk"; } else if (sugar == 1)     { flavor = sugar; flavor = "sugar"; } else if (artSweet == 1)      { flavor = artSweet ; flavor = "artificial flavor"; }}double CoffeeOrder::cupOfCoffee = 1.25;int main()CoffeeOrder aCoffee;aCoffee.takeOrder();aCoffee.displayValues(); } system("Pause"); return 0;}

## Replies

Nothing to see here.

## C++

122,809 followers