有人告诉我我做错了

有人告诉我我做错了

本文介绍了有人告诉我我做错了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

namespace Food
{
    class Program
    {
        static void Main(string[] args)
        {
            double menu1, menu2, menu3, menu4, menu5, total, money,change;

            money = 20;
            menu1 = 1.00;
            menu2 = 0.79;
            menu3 = 1.20;
            menu4 = 0.50;
            menu5 = 1.25;



            Console.Write("Please enter ammount of cheeseburgers purchased:");
             menu1 = double.Parse(Console.ReadLine());
             Console.Write("Please enter ammount of hamburgers purchased:");
             menu2 = double.Parse(Console.ReadLine());
             Console.Write("Please enter ammount of chicken sandwhiches purchased:");
             menu3 = double.Parse(Console.ReadLine());
             Console.Write("Please enter ammount of french fries purchased:");
             menu4 = double.Parse(Console.ReadLine());
             Console.Write("Please enter ammount of soda's purchased:");
             menu5 = double.Parse(Console.ReadLine());

             total = money - menu1 - menu2 - menu3 - menu4 - menu5;
             Console.Write("Your total is :" + total);
             Console.ReadLine();

             change = money - total;
             Console.Write("Your change is :" + change);






             Console.ReadLine();

        }
    }
}


分配是:


The assignment is:

FOOD!!!!!!

Your parents have given you a total of $20 to go out and buy dinner for your family.  You go to a fast food place which has the following prices for food/drinks:
Cheeseburger: $1.00
Hamburger: $0.79
Chicken Sandwich: $1.20
French Fries: $0.50
Soda: $1.25

You must create a program that will calculate if you can afford all that you want to order.  The order of the task should be something like the following:
Ask the user for how many cheeseburgers.
Calculate the new total.
Ask the user for how many hamburgers.
Calculate the new total.
...
Do this for every item on the menu.
At the end of your program, you will need to output the total, with a dollar sign, and whether or not you have enough money for all of your food and drinks.  If you have enough money, also output how much change you will receive.  Please remember to use doubles for your variables, since you are working with decimals.

推荐答案




这篇关于有人告诉我我做错了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-15 05:48