68 464
Assignments Done
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ˈ.
Expert's answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

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

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


static void DisplayMenu()
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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions