Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE ONLY C# Please need help writing a program for Intro to C#: You are to write a program that will calculate the total cost

PLEASE ONLY C#

Please need help writing a program for Intro to C#:

You are to write a program that will calculate the total cost of a Pizza.

The code should ask the user if they want an S, M, or L pizza (small, medium, or large). Based on the size they choose, you should add $5.00, $7.00, or $9.00 to the total bill.

Ask the user if they want 0, 1, or 2 extra toppings. If they choose 1, add $1.00 to the bill. If they choose 2, add $1.50.

Now add 10% tax to the bill, and write out a message telling them how much the total bill is. Dont worry if the answer has more than the 2 normal digits on the right of the decimal point. If you like, use a placeholder like this, it will add the $ and round to 2 decimal places

{totalCost:C}

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Assume perfect data entry, no user mistakes.

Keep track of the cost with a type decimal, which means when you set its value to, for example, 5.00, you need to add an m at the end, 5.00m .

Use series of if statements for the size and cost of the pizza, and then another set to deal with the number of toppings.

Below are some sample runs of my program. Your screen output doesnt have to look exactly the same, but they should be similar and definitely have the same dollar answers as I show.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Example #1: What size pizza would you like, S, M, or L (small, medium, or large)?

S

You selected small, that will be $5.00 How many toppings would you like, 0, 1, or 2?

0

Thank you for your order, it will be done shortly.

Including 10% tax, you total bill is $5.500

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions