有人告诉我我做错了 [英] I was told I did this wrong

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

问题描述

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.

推荐答案

20 to 购买 晚餐 您的 家庭. 快速 食物 其中 以下 价格 食品/饮料的价格: 奶酪汉堡包:
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 .汉堡包:
1.00 Hamburger:


0 .鸡肉 三明治:
0.79 Chicken Sandwich:


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆