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.
![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)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F661ca67b-2856-486e-ba4c-fe1c9d0abc93%2Fad2f0718-7e99-41a1-9ec6-90d41098355c%2Ffb2c3uf_processed.jpeg&w=3840&q=75)
![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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F661ca67b-2856-486e-ba4c-fe1c9d0abc93%2Fad2f0718-7e99-41a1-9ec6-90d41098355c%2Fwcp4cvw_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
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
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)