Answered step by step
Verified Expert Solution
Question
1 Approved Answer
sushi.c Overview You and your friends decide to go to Midnight Sushi at Surin on the strip. After the meal, you are interested in how
sushi.c
Overview
You and your friends decide to go to Midnight Sushi at Surin on the strip. After the meal, you are interested in how much food was consumed and write a program so you can run some calculations when you go again next week.
The menu is composed of a variety of the following types of items:
Item Type | Price | Sushi Pieces |
---|---|---|
$1 Appetizers | $1 | 0 |
$3 Appetizers | $3 | 0 |
One Piece Sushi | $1 | 1 |
Two Piece Sushi | $3 | 2 |
Maki | $1 | 2 |
Sushi Rolls | $6 | 8 |
Rice Combos | $6 | 0 |
The program will prompt the user for how many items of each type were ordered and calculate:
- cost before tax
- cost after tax
- total pieces of sushi
- volume of sushi in cubic inches
Examples
How many $1 appetizers were ordered? 2 How many $3 appetizers were ordered? 3 How many one piece sushi were ordered? 4 How many two piece sushi were ordered? 5 How many maki were ordered? 6 How many sushi rolls were ordered? 7 How many rice combos were ordered? 8 Cost (before tax): 126 dollars Cost (after tax): 138 dollars and 60 cents Total pieces of sushi: 82 Volume of sushi: 157.20 cubic inches
How many $1 appetizers were ordered? 1 How many $3 appetizers were ordered? 0 How many one piece sushi were ordered? 5 How many two piece sushi were ordered? 7 How many maki were ordered? 10 How many sushi rolls were ordered? 2 How many rice combos were ordered? 1 Cost (before tax): 55 dollars Cost (after tax): 60 dollars and 50 cents Total pieces of sushi: 55 Volume of sushi: 105.44 cubic inches
Notes
- Name the program sushi.c.
- Have a header block of comments that includes your name and a brief overview of the program.
- Assume valid input (no negative numbers).
- Read the input in the exact order as the examples.
- Make sure the output format is identical to the example output.
- Use "%.2lf" to print a double with only 2 decimals.
- Use the following values when performing the calculations:
- Tax = 10%
- Diameter of a sushi roll = 4cm
- Length of a sushi roll = 20cm (8 pieces/roll).
- Assume a piece of sushi has the same dimensions (and consequently, the same volume) regardless of its type.
- 1in = 2.54cm
- PI = 3.14159
- Once you have a working program, feel free to enter some sample data and then post the output to Piazza. See if others agree with your answers. Do not post code to Piazza.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started