为什么不打印税款? [英] why it doesnot print the tax?

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

问题描述

package payroll;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
     Scanner input = new Scanner(System.in);
     String employeename;
     int salary;
     int hourswork;
     int monthhours;
     int monthsalary;
     int tax;
     System.out.println("please enter the employeename:");
     employeename = input.nextLine();
     System.out.printf("welcome to the payroll for %s\n\n",employeename);
        System.out.println("please enter hours work in a day:");
     hourswork = input.nextInt();
     monthhours = 30 * hourswork;
     System.out.printf("%s is work %s hours in a month",employeename,monthhours);
     System.out.printf("\nhow much is %s's salary in an hour in tomans? ",employeename);
     salary = input.nextInt();
     monthsalary = hourswork*salary*30;
     System.out.printf("%s is %s's salary",monthsalary,employeename);
     tax = monthsalary - (monthsalary*(1/10));
     System.out.printf("\n%s's salary with tax is %s ",employeename,tax);
  
    }
}

推荐答案

您听说过float或double吗?

浮动税;
税= bla bla(1f/10f)

应该起作用的
have you heard of float or double?

float tax;
tax = bla bla (1f/10f)

that should work


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

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