For this assignment, write a program named PizzaPrices that prompts the user to make a choice for a pizza size - S,M, L, or X - and the number of pizza the user wants to order. The price for different size pizzas are $6.99, $8.99, $12.5, and $15.0 respectively. There is also a discount based on the number of pizza ordered: no discount for one pizza, 10% discount for 2 pizzas, 15% discount for 3-5 pizzas, and 20% for more than 5 pizzas. Display a full accounting of the transaction, similar to the sample screenshot. Please make sure you use parallel arrays and range match in your solution.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

For this assignment, write a program named PizzaPrices that prompts the user to make a choice for a pizza size - S,M, L, or X - and the number of pizza the user wants to order. The price for different size pizzas are $6.99, $8.99, $12.5, and $15.0 respectively. There is also a discount based on the  number of pizza ordered: no discount for one pizza, 10% discount for 2 pizzas, 15% discount for 3-5 pizzas, and 20% for more than 5 pizzas. Display a full accounting of the transaction, similar to the sample screenshot. Please make sure you use parallel arrays and range match in your solution.

For this assignment, write a program named PizzaPrices that prompts the user to make a choice for a pizza size - S,M, L, or X - and
the number of pizza the user wants to order. The price for different size pizzas are $6.99, $8.99, $12.5, and $15.0 respectively.
There is also a discount based on the number of pizza ordered: no discount for one pizza, 10% discount for 2 pizzas, 15% discount
for 3-5 pizzas, and 20% for more than 5 pizzas. Display a full accounting of the transaction, similar to the sample screenshot. Please
make sure you use parallel arrays and range match in your solution.
- Coding part (15 points)
- Add detailed comments (2 points)
- Detailed flowchart (3 points)
Transcribed Image Text:For this assignment, write a program named PizzaPrices that prompts the user to make a choice for a pizza size - S,M, L, or X - and the number of pizza the user wants to order. The price for different size pizzas are $6.99, $8.99, $12.5, and $15.0 respectively. There is also a discount based on the number of pizza ordered: no discount for one pizza, 10% discount for 2 pizzas, 15% discount for 3-5 pizzas, and 20% for more than 5 pizzas. Display a full accounting of the transaction, similar to the sample screenshot. Please make sure you use parallel arrays and range match in your solution. - Coding part (15 points) - Add detailed comments (2 points) - Detailed flowchart (3 points)
C:\Users\jzhang\source\repos\PizzaPrice\PizzaPrice\bin\Debug\PizzaPrice.exe
O X
What size pizza do you want? M
How many pizzas do you want? 4
Your M pizza is normally $8.99
The total would normally be $35.96
Because you ordered 4, your discount is 15 %
For a final total of $30.57
Transcribed Image Text:C:\Users\jzhang\source\repos\PizzaPrice\PizzaPrice\bin\Debug\PizzaPrice.exe O X What size pizza do you want? M How many pizzas do you want? 4 Your M pizza is normally $8.99 The total would normally be $35.96 Because you ordered 4, your discount is 15 % For a final total of $30.57
Expert Solution
Step 1

c# program for Pizza Price

 

using System;

class MainClass {

public static void Main (string[] args) {

int numPizza,discount;

char size;

double totalAmount=0,discountedAmount=0;

double[] rates={6.99,8.99,12.5,15.0};

Console.WriteLine ("Enter Number of Pizza's you wish to order: ");

numPizza=Convert.ToInt32(Console.ReadLine());

Console.WriteLine ("Enter Size (S,M,L,X): ");

size=Console.ReadLine()[0];

if(size=='S' || size=='s'){

totalAmount=numPizza*rates[0];

}

else if(size=='M' || size=='m'){

totalAmount=numPizza*rates[1];

}

else if(size=='L' || size=='l'){

totalAmount=numPizza*rates[2];

}

else if(size=='X' || size=='x'){

totalAmount=numPizza*rates[3];

}

else

Console.WriteLine("Wrong size input");

if(numPizza==1){

discountedAmount=totalAmount;

discount=0;

}

else if(numPizza==2){

discountedAmount=totalAmount-(totalAmount*0.10);

discount=10;

}

else if(numPizza>2 && numPizza<=5){

discountedAmount=totalAmount-(totalAmount*0.15);

discount=15;

}

else{

discountedAmount=totalAmount-(totalAmount*0.20);

discount=20;

}

Console.WriteLine("Total number of Pizza: "+numPizza);

Console.WriteLine("Size: "+size);

Console.WriteLine("Total Amount= $"+totalAmount);

Console.WriteLine("Total discount = "+discount+"%");

Console.WriteLine("Total Amount after discount = $"+discountedAmount);

}

}

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education