计算机java编程题。

计算机Java

1个回答

写回答

木木木屋

2026-02-25 13:50

+ 关注

个人所得税
个人所得税

根据题号,代码如下: 1、 public class Emp { private String uName; private double money; static final double empOp=0.012;//应缴个人所得税 public String getuName() { return uName; } public void setuName(String uName) { this.uName = uName; } public double getMoney() { return money; } public void setMoney(double money) { this.money = money; } public Emp() {} public Emp(String uName, double money) { this.uName=uName; this.money=money; } public String show() { return "员工姓名:"+getuName()+" 应缴个人所得税:"+getMoney()*empOp; } public static void mAIn(String[] args) { Emp emp = new Emp("张三",6000); System.out.println(emp.show()); }} 2、 public class Student { private String name; private int age; private String degree; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getDegree() { return degree; } public void setDegree(String degree) { this.degree = degree; } public String show() { return "姓名:"+getName()+" 年龄:"+getAge()+" 学位:"+getDegree(); } public static void mAIn(String[] args) { Graduate g = new Graduate(); g.setAge(22); g.setName("张三"); g.setDegree("研究生"); g.setDirection("计算机科学与技术"); System.out.println(g.show()); }}class Undergraduate extends Student{ private String specialty; public String getSpecialty() { return specialty; } public void setSpecialty(String specialty) { this.specialty = specialty; } public String show() { return "姓名:"+getName()+" 年龄:"+getAge()+" 学位:"+getDegree()+" 专业:"+getSpecialty(); }}class Graduate extends Student{ private String direction; public String getDirection() { return direction; } public void setDirection(String direction) { this.direction = direction; } public String show() { return "姓名:"+getName()+" 年龄:"+getAge()+" 学位:"+getDegree()+" 研究方向:"+getDirection(); } } 满意请采纳,谢谢!@

举报有用(0分享收藏

Copyright © 2025 IZhiDa.com All Rights Reserved.

知答 版权所有 粤ICP备2023042255号