Java输入一个员工的名字,年龄,工号,月工资,奖金,补贴,输出员工的姓名,年龄,工号,月工资
时间: 2023-05-14 19:06:31 浏览: 97
以下是 Java 代码:
import java.util.Scanner;
public class Employee {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("请输入员工姓名:");
String name = input.next();
System.out.print("请输入员工年龄:");
int age = input.nextInt();
System.out.print("请输入员工工号:");
int id = input.nextInt();
System.out.print("请输入员工月工资:");
double salary = input.nextDouble();
System.out.print("请输入员工奖金:");
double bonus = input.nextDouble();
System.out.print("请输入员工补贴:");
double allowance = input.nextDouble();
System.out.println("员工姓名:" + name);
System.out.println("员工年龄:" + age);
System.out.println("员工工号:" + id);
System.out.println("员工月工资:" + salary);
System.out.println("员工奖金:" + bonus);
System.out.println("员工补贴:" + allowance);
}
}
输入员工的信息后,程序会输出员工的姓名,年龄,工号,月工资,奖金和补贴。
阅读全文