Question

Using C#, write a program. You are a coffee and tea shop. You will allow customers...

Using C#, write a program.

You are a coffee and tea shop. You will allow customers to enter their orders. You sell coffee and tea in three sizes, small coffee for $1.00, medium for $1.20, and large for $1.40. Tea is $1.20, $1.40, and $1.60. You will let ask the user what they want, size, ask if they want to order anything else, continue taking their order. At the end show them how much they owe. If they order more than $20, give them a 5% discount. Show them their adjusted total.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the program as per your requirements.

The user can enter upto as per the user wishes.

I have given two outputs one with discount and another with not


using System;

public class Example
{
public static void Main()
{
float total=0;
int choice = 0;
int qty = 0;
float discount =0;
string str;
do // run the code until the user presses 7
{
  
str ="Pleae enter \n 1. Small Coffee \n 2.Medium Coffee \n 3.Large Coffee \n 4. Small Tea \n 5.Medium Tea \n 6.Large Tea \n 7. Exit";
Console.WriteLine(str); // printing the string to the user
choice = Convert.ToInt32(Console.ReadLine()); // reading from the keyboard
if(choice == 1) // if the user enters 1 do this.
{
Console.WriteLine(" Enter quantity:");
qty = Convert.ToInt32(Console.ReadLine());
total = total + qty * 1.0f;
}   
else if(choice == 2)
{
Console.WriteLine(" Enter quantity:");
qty = Convert.ToInt32(Console.ReadLine());
total = total + qty * 1.2f;
}   

else if(choice == 3)
{
Console.WriteLine(" Enter quantity:");
qty = Convert.ToInt32(Console.ReadLine());
total = total + qty * 1.4f;
}

else if(choice == 4)
{
Console.WriteLine(" Enter quantity:");
qty = Convert.ToInt32(Console.ReadLine());
total = total + qty * 1.2f;
}   
else if(choice == 5)
{
Console.WriteLine(" Enter quantity:");
qty = Convert.ToInt32(Console.ReadLine());
total = total + qty * 1.4f;
}   

else if(choice == 6)
{
Console.WriteLine(" Enter quantity:");
qty = Convert.ToInt32(Console.ReadLine());
total = total + qty * 1.6f;
}
else
{
break;
}

} while(choice < 1 && choice > 7);
Console.WriteLine("You have to pay: {0};", total);
if(total > 20)
{
discount = total * 5 / 100;
total = total - discount;
Console.WriteLine("You got discount {0}", discount);

Console.WriteLine("You have to pay after discount {0}", total);
}
  

}
}

Output:

Output Pleae enter 1. Small Coffee 2. Medium Coffee 3.Large Coffee 4. Small Tea 5. Medium Tea 6 Enter quantity: You have to p

utput Pleae enter 1. Small Coffee 2. Medium Coffee 3 . Large Coffee . Small Tea 5. Hedium Tea Enter qquantity: You have to pa

Add a comment
Know the answer?
Add Answer to:
Using C#, write a program. You are a coffee and tea shop. You will allow customers...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using C++ Mr. Manager wants you to process orders for the Fast Greasy Food Shop. His...

    Using C++ Mr. Manager wants you to process orders for the Fast Greasy Food Shop. His customers have a few choices in what they order. The can order a hamburger for 1.00. It they want cheese it is an addition .50 and if they want bacon the additional amount is .75. They can also order a small or large drink for 1.10 and 1.60 respectively and small or large French fries for 1.20 or 1.75 respectively.    The user can only...

  • You are the manager of a local coffee shop. There are two types of customers in...

    You are the manager of a local coffee shop. There are two types of customers in your market, coffee addicts, and casual drinkers. Because coffee addicts buy large amounts of coffee, they are more willing to shop around for low prices and so, if you charge more than $2 for a medium coffee, which is what your competitor charges, they will not come to you at all. If you charge less than your competitor, they will each buy 8 drinks...

  • You are going to write a java application that will be used in a coffee shop...

    You are going to write a java application that will be used in a coffee shop to take customer orders and print a simple on screen order summary. Your coffee shop only sells one type and one size coffee for $5 dollars. However, your customers have the option of adding whipped cream and chocolate each for $1 dollar. Your application takes in customer name, the number of coffees being ordered and whether or not the customer wants whipped cream and/or...

  • Create a Python program using a list. You are the owner of a cheese shop, "The...

    Create a Python program using a list. You are the owner of a cheese shop, "The Deceased Macaw" and a customer has arrived. Write a program to greet them. You should first ask if the customer is interested in cheddar, if so, then they are given cheddar. Otherwise, you say that you'll find something. If they say that they don't want cheese, you ask them why they are in a cheese shop? In this exercise, valid user responses are "yes"...

  • Order up:: Write a program that will be used to keep track of orders placed at...

    Order up:: Write a program that will be used to keep track of orders placed at a donut shop. There are two types of items that can be ordered: coffee or donuts. Your program will have a class for each order type, and an abstract superclass. Coffee orders are constructed with the following information: quantity (int) - how many coffees are being ordered size (String) - the size of the coffees (all coffees in the order have the same size)...

  • write a C++ program that sells candy and drinks using the enumeration type. You must use...

    write a C++ program that sells candy and drinks using the enumeration type. You must use the following within your program: enum sizes {SMALL, MEDIUM, LARGE, JUMBO}; sizes Candysize, drinkSize; You should create a menu that asks the user to choose what size of drink they want and to choose what size of popcorn they want. Then I have to print out the total cost of the drink and popcorn. The Prices: Candy Soda Small 1.25 1.50 Medium 2.25 2.50...

  • Write a C++ program. Please use Codeblocks, show output. And provide all three files as asked...

    Write a C++ program. Please use Codeblocks, show output. And provide all three files as asked and instructions on the combination and anything else. The menu must ask how many names they wish to enter. Max is up to 20. And the end of each prompt please ask “Do you want to continue or Quit” so after each execution of the program it doesn’t automatically quit but gives the option to either repeat or quit through selection.

  • Answer using C++ Write a program that will calculate the final sales price of a motorcycle;...

    Answer using C++ Write a program that will calculate the final sales price of a motorcycle; this includes additional optional packages along with sales tax. You may assume that the base? price of the motorcycle is $30,000. First you must ask the user to choose which optional packages they want. The user is only permitted to choose one package. Your program should display a menu of the available packages. The user should enter the package by entering the letter associated...

  • I need help please... Intro to Programming in C – small program 8 Project objective: To...

    I need help please... Intro to Programming in C – small program 8 Project objective: To compile, build, and execute an interactive program using character arrays and string.h functions **Submit source code (prog8.c) through Canvas • One source code file (unformatted text) will be submitted • The file name must match the assignment • The code should be tested and run on a Microsoft compiler before it is uploaded onto Canvas • The code must be submitted on time in...

  • Trying to write this program using c language using functions, pointers and loops. "al 67% 1...

    Trying to write this program using c language using functions, pointers and loops. "al 67% 1 1 :14 AM importanu Name your TIies HW2 firstlastname.c Develop a solution to the following problem: A financial institution will only accept loan applications if the following conditions are met: The applicant must own his/her home with no mortgage payment and -The applicant must have a total annual household income of no less than $45000.00. The applicant must have a credit score of no...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT