帮助控制台应用程序收据,初学者 [英] Help on Console App Receipt, Beginner

查看:138
本文介绍了帮助控制台应用程序收据,初学者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我是c#的新手,我正在尝试打印收据。但我的代码错了,这是我的问题



>计算价格乘以用户给出的数量

>计算上述金额 - 12%税金

>显示增值税

>接受金钱并计算变化

>一旦输入单价,他们必须全部出现



这是我目前计算部分的代码

Hi,

I'm new in c# and i'm trying to print a receipt. but my codes are wrong, Here is my problem

> Compute the Price multiplied by the quantity given by the user
> Compute the said Amount - 12% tax
> Show the Vat Tax
> Accept money and compute the change
> they have to all appear once the unit price has been inputted

This are my codes at the moment for the computation part

bool test = false;
do
{
    try
    {
        Console.SetCursorPosition(2, 12);
        Console.Write("       ");

        Console.SetCursorPosition(2, 12);
        Num = Convert.ToInt32(Console.ReadLine());
        test = false;
    }
    catch
    {
        test = true;
    }
} while (test);

Console.SetCursorPosition(18, 12);
Console.ForegroundColor = ConsoleColor.Yellow;
telNumber = Console.ReadLine();

//Peso

bool Ptest = false;
do
{
    try
    {
        Console.SetCursorPosition(47, 12);
        Console.Write("       ");
        Console.SetCursorPosition(47, 12);
        Amount = Convert.ToInt32(Console.ReadLine());
        Console.SetCursorPosition(65, 12);
        Amount = Amount * 2 ;
       
        Console.WriteLine("P   " + Amount.ToString("0.00"));

        Console.SetCursorPosition(65, 15);
        Console.ForegroundColor = ConsoleColor.Green;
        Console.WriteLine("P   " + Amount.ToString("0.00"));

        Console.SetCursorPosition(65, 17);
        Console.ForegroundColor = ConsoleColor.Green;
        Console.WriteLine("P   " + Amount.ToString("0.00"));
          
        Ptest = false;
    }
    catch
    {
        Ptest = true;
    }
} while (Ptest);

//Amount

Console.ReadLine();



它必须看起来像这样,我已完成格式但我遇到上述问题的麻烦,请帮助



图像在 - http://static.tumblr.com/xklso8y/PUfng8s5h/clipboard01。 png [ ^ ]







添加链接文字以反映文章/质量保证标题。

更正格式和/或语法问题。

添加标签。

[/编辑]

推荐答案

我们不做你的作业:它是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果遇到具体问题,请询问相关问题,我们会尽力提供帮助。但是我们不会为你做这一切!



到目前为止,你已经完成了外部结构,但没有尝试进行任何实际的计算。

你知道如何繁殖,你知道百分比是多少:所以(正如比尔所说)将整数转换为双精度,并尝试添加代码来进行计算:这不是一项复杂的任务如果你自己无法解决这个问题,那么下一个作业任务将会遇到麻烦!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

And so far, you have done the outside structure, but not tried to do any of the actual computations.
You know how to multiply, you know what a percentage is: so (as Bill says) convert your integers to doubles, and try adding the code to do the computations: this is not a complex task, and if you can't work out how to do this yourself, you are going to have real trouble with your next homework task!


这篇关于帮助控制台应用程序收据,初学者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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