为什么它不打印发薪月?(作业) [英] why it doesnnot print paymonth?(homework)

查看:99
本文介绍了为什么它不打印发薪月?(作业)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

package pay;
public class payment {
private String employeename;
private float workhours;
private float payhours;
private float tax;
private float absenthours;
private float monthhours;
private float paymonth;
public payment(String employeename,float workhours,float payhours,float absenthours)
{
   this.employeename = employeename;
    this.workhours = workhours;
 this.payhours = payhours;
 this.absenthours = absenthours;
}
   // payment(float payhours) {
//        throw new UnsupportedOperationException("Not yet implemented");
    //}
  //  payment(String employeename, float workhours) {
//        throw new UnsupportedOperationException("Not yet implemented");
  //  }
public String getemployeename()
{
    return(employeename);
}
public float getworkhours()
{
    return(workhours);
}
public float monthhours()
{
    return ( workhours*30f);
}
public float getpayhours()
{
    return(payhours);
}

public float paymonth()
        
{
   return (monthhours*payhours);   //ba bardshte tax in 1 month    tax = (monthsalary - (monthsalary*(1f/10f)));
}
public float getabsenthours()
{
    return(absenthours);
}
public float payabsent()
{
   return (paymonth-(payhours*absenthours*2));
}
    }


package pay;
import java.util.Scanner;
public class Main {
private static Object pay;

    public static void main(String[] args) {
    String employeename;
    float workhours;
    float payhours = 0;
  float absenthours = 0;
    Scanner input=new Scanner(System.in);
        System.out.println("Please enter the employeename:");
        employeename=input.nextLine();

        System.out.println("please enter workhours in a day:");
        workhours=input.nextFloat();
        
       payment mypay = new payment(employeename,workhours,payhours,absenthours);
       System.out.printf(" %s is work %s hours in a month",employeename,mypay.monthhours());

       System.out.printf("\nhow much is %s''s salary in an hour in tomans?",employeename);
       payhours=input.nextFloat();

      //payment m = new payment(payhours);
       System.out.printf("%s''s salary is %s in month",employeename,mypay.paymonth());

       System.out.printf("\nhow much is %s''s absenthours in hour?",employeename);
       absenthours=input.nextFloat();

        System.out.printf("%s''s salary is %s in month with absenthours",employeename,mypay.payabsent());
    }
}

推荐答案

因此,您将忽略给出的建议并大胆地进行下去.你肯定很勇敢.

它不打印paymonth,因为存在语法错误.如前所述,这将完全满足,更不用说运行了.

0.注意您收到的建议.
1.了解如何格式化和预览消息.
2.编辑一个现有问题,而不要问新问题.
3.还有一个额外的空间,编译器应该告诉您它在哪里.

此激动人心的胶卷探索编码的下一部分最好是隐含了到目前为止收到的答案.
So, you ignore the advice you are given and blithly carry on. You sure are brave.

It doesn''t print paymonth because there is a syntax error. As posted, this will nto complie, let alone run.

0. Heed the advice you receive.
1. Learn how to format and preview messages.
2. EDIT an exisiting question rather than asking new run-ons.
3. There is an extra space, the compiler should tell you where it is.

The next installment to this thrilling coding for gumbies quest had better have implimented the answers received so far.


Nagy Vilmos写道:
Nagy Vilmos wrote:

此激动人心的小动物探索编码的下一部分最好隐含了到目前为止所收到的答案.

The next installment to this thrilling coding for gumbies quest had better have implimented the answers received so far.



伙计们不要屏住呼吸.

我只是希望这是一项家庭作业,而不是任何组织计划很快实施的新工资单.

[edit]我喜欢设置器和获取器之间的细微差别;表现出对细节的高度关注[/edit]



Don''t hold your breath folks.

I just hope this is a homework exercise rather than the new payroll package any organisation is planning to implement soon.

[edit]I like the subtle differences between setters and getters; shows a fine attention to detail[/edit]


只需添加,暂时不要认为您的老师像您一样愚蠢.他们一定会找到您通过谷歌搜索获得的代码,因此,如果您逐字使用它,那就失败了.相反,请查看代码,弄清楚为什么它起作用而您的代码不起作用,然后对其进行修复.
Just to add, don''t think for a moment that your teacher is as dumb as you are. They are sure to find the code you were given by googling, so if you use it verbatim, expect to fail. Instead, look at the code, work out why it works and yours does not, then fix it.


这篇关于为什么它不打印发薪月?(作业)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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