package project_02; import java.util.Scanner; /**快捷键:shift+Alt+j * * 2018-9-7 18:44:47 *@author Sauron XiaMen */ public class Salary { //输入基本工资3000 public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("请输入基本工资:"); double salary=input.nextDouble(); double prices=salary*0.4; //物价津贴 double rent=salary*0.25; //房租津贴 //输出结果 System.out.println("该员工的工资细目为:"); System.out.println("基本工资为:"+salary); System.out.println("物价津贴为:"+prices); System.out.println("房租津贴为:"+rent); System.out.println("员工薪水是:"+(salary+prices+rent)); input.close(); //关闭Scanner } }
结果如下: