68 464
Assignments Done
98,6%
Successfully Done
In December 2018

# Answer to Question #64445 in C# for ceazer

Question #64445
We want to put at the disposal of a small cheese dairy an algorithm that allows it to calculate the total invoice of a customer, proposing a menu in which all the prices of the products that it owns will be displayed in a menu.
The list of products and the price of each package is shown below:
White cheese: 7000 LL Goat's cheese: 9000 LL
 Cheese with herbs: 12000 LL  Mixed cheese: 13000 LL

Each type of cheese is represented by a letter: ˈWˈ for white cheese, ˈGˈ for Goat’s cheese, ˈHˈ for cheese with herbs and ˈMˈ for the mixed cheese.

Write an algorithm that calculates the total invoice of packages purchased by a customer, using a menu containing the different types of cheese. A customer can purchase multiple packages of the same type or different types. The end of the invoice is indicated by the letter ˈEˈ.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cheese
{
class Program
{
static void Main(string[] args)
{
string choice;
int sum = 0;
do
{
switch (choice.ToUpper())
{
case "W":
sum += 7000;
break;
case "G":
sum += 9000;
break;
case "H":
sum += 12000;
break;
case "M":
sum += 13000;
break;
}
} while (choice.ToUpper() != "E");

Console.WriteLine("Total invoice: " + sum);

}

{
Console.WriteLine();
Console.WriteLine("W - White cheese: 7000 LL");
Console.WriteLine("G - Goat's cheese: 9000 LL");
Console.WriteLine("H - Cheese with herbs: 12000 LL");
Console.WriteLine("M - Mixed cheese: 13000 LL");
Console.WriteLine("E - Count invoice");
Console.WriteLine("Type letter according to cheese you want:");
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!