我怎么做这个问题,我对最后一个问题感到困惑。 [英] How do I do this question, I get stuck at the last question.

查看:67
本文介绍了我怎么做这个问题,我对最后一个问题感到困惑。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题2:课程 - 工资单系统(员工)



您要为Holiday Park的新工资单系统编写控制台应用程序原型。



在这个程序中,您要添加并编写一个名为Employee的类。



该课程将包括:

•员工的三个字段(实例变量) - 员工姓名,年薪总额和税率。

•没有参数的构造函数,显示消息创建的员工记录

•每个Employee字段有三个Get方法。

•每个Employee字段有三个Set方法。

•CalcNet方法计算并返还净工资。

净工资是减去工资总额(税率是用税率和工资总额计算的)。




在该计划的主要方法中,您将:

•显示简介/欢迎/信息消息
•创建Employee类的对象,该对象应显示正确的消息,表明已创建员工记录。

•提示用户并获取员工姓名,年薪总额和税率。

•显示(带有合适的标题)每个实例变量的值(名称,工资总额和税率)。

•使用CalcNet方法,显示(带有合适的标题)员工的净工资。



我尝试过的方法:



i陷入了最后一个问题

Question 2: Classes - Payroll System (Employee)

You are to write a console application prototype for the Holiday Park’s new payroll system.

In this program you are to add and code a class called Employee.

The class will include:
• Three fields (instance variables) for the Employee – the employee name, annual gross salary and the tax rate.
• A constructor with no parameters, which displays the message "Employee record created"
• Three Get methods for each of the Employee fields.
• Three Set methods for each the Employee fields.
• A CalcNet method to calculate and return the net salary.
The net salary is the gross salary less tax (the tax is calculated using the tax rate and gross salary).


In the main method of the program you are to:
• Display an intro/welcome/information message
• Create an object of the Employee class, which should display the correct message saying an employee record has been created.
• Prompt the user for and obtain the employee’s name, annual gross salary and the tax rate.
• Display (with suitable headings) the values of each of the instance variables (name, gross salary and tax rate).
• Using the CalcNet method, display (with suitable headings) the employee’s net salary.

What I have tried:

i got stuck at the last question

推荐答案

给你一个线索,但我们不做这里的功课:

A clue for you, but we dont' do homework here:
netSalary = grossSalary * (1 - taxRate);

(假设税率为' 0.33'。



ps - 如果您将代码发布到您遇到的位置,我们很乐意提供更多指示。

(assuming tax rate is given as something like '0.33'.

p.s. - If you post the code where you get stuck at, we would be glad to give more pointers.


这篇关于我怎么做这个问题,我对最后一个问题感到困惑。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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