Not logged in. Log in with GitHub. About Websheets.

List of all available Websheets


Viewing cpp/cs102/decision-tree/menu by redekopp@usc.edu. You have unsaved changes. Log in above to create, edit, preview and publish Websheets.
PropertyValue
Description
html markup
shown to student
 
<p>A restaurant servers <strong>burgers for &#36;8</strong> and <strong>salads for &#36;7</strong>.</p>
<p>When the customer selects a burger they must choose if they would like <strong>cheese</strong>.  If they do, <strong>cheddar costs an additional 25 cents while pepper jack is 50 cents.</strong></p>
<p>When the customer selects a salad they must choose if they would like <strong>no dressing, ranch for 10 cents more, and honey mustard for 15 cents more.</strong></p>
<p>Customers can buy a drink for &#36;1.50</p>
      
<p>Use the question prompts already declared as strings to ask the user for responses and then calculate the total cost the customer owes.</p>
Public permissions remove
Remarks
Comments, history, license, etc.
 
Copied from problem cpp/cs102/practice6/testScoreChecker (author: redekopp@usc.edu)
Copied from problem cpp/cs102/practice6/tippingCalculator (author: jmell@usc.edu)
Copied from problem cpp/cs102/practice5/computingPie (author: jmell@usc.edu)
remove
Engine
Template / Reference solution
 
#include <iostream>
using namespace std;
int main() {
   int burgerOrSalad, cheese, kindOfCheese, dressing, drink;
   
   string q1 = "Would you like a 1) burger or 2) a salad?";
   string q2 = "Would you like cheese? 0) No or 1) Yes";
   string q3 = "What kind of cheese 1) Cheddar or 2) Pepper jack?";
   string q4 = "What kind of dressing would you like 0) None, 1) Ranch, 2) Honey Mustard?";
   string q5 = "Would you like a drink? 0) No, 1) Yes";
   
   cout << q1 << endl;
   cin >> burgerOrSalad;
   
   double cost = 0;
   \[
REDACTED
]\
   cout << "Total cost of selected meal is " << cost << endl;
   return 0;
}
C++ test suite
json list of stdin/args tests
e.g. [{"stdin":"hi", "args":["4", "5"]},
{"stdin":"noargs"}]

to just run once with no input use [{}]
 
[
   {"stdin":"1 1 1 1", "args":[]},
   {"stdin":"1 1 2 0", "args":[]},
   {"stdin":"1 0 1", "args":[]},
   {"stdin":"2 0 0", "args":[]},
   {"stdin":"2 1 1", "args":[]},
   {"stdin":"2 2 0", "args":[]}
]
Solution visibility remove


Optional properties:

Note: problems are open-source by default (see 'Public permissions'). Assumed license for open problems is Creative Commons 4.0 Attribution-ShareAlike unless specified in 'Remarks'.