3个回答
展开全部
写给你了
public class Employee {
public int workYear;
public double salary;
public double comsalary(){
return 50*workYear+salary;
}
}
package test1;
public class Manager extends Employee{
private double bonus;
public double comsalary(){
return 50*workYear+salary+bonus;
}
}
package test2;
public class Circle {
public double r;
public double area(){
return 3.14*r*r;
}
}
package test2;
public class Cylindar extends Circle{
public Cylindar(double r, double h) {
this.r=r;
this.h = h;
}
private double h;
public double getH() {
return h;
}
}
package test3;
public class Person {
private String name;
private int age;
private String sex;
public String getName() {
return name;
}
public int getAge() {
return age;
}
public String getSex() {
return sex;
}
public Person(String name, int age, String sex) {
this.name = name;
this.age = age;
this.sex = sex;
}
}
package test3;
public class Student extends Person{
public Student(String name, int age, String sex, String number) {
super(name, age, sex);
this.number = number;
}
private String number;
public String getNumber() {
return number;
}
}
public class Employee {
public int workYear;
public double salary;
public double comsalary(){
return 50*workYear+salary;
}
}
package test1;
public class Manager extends Employee{
private double bonus;
public double comsalary(){
return 50*workYear+salary+bonus;
}
}
package test2;
public class Circle {
public double r;
public double area(){
return 3.14*r*r;
}
}
package test2;
public class Cylindar extends Circle{
public Cylindar(double r, double h) {
this.r=r;
this.h = h;
}
private double h;
public double getH() {
return h;
}
}
package test3;
public class Person {
private String name;
private int age;
private String sex;
public String getName() {
return name;
}
public int getAge() {
return age;
}
public String getSex() {
return sex;
}
public Person(String name, int age, String sex) {
this.name = name;
this.age = age;
this.sex = sex;
}
}
package test3;
public class Student extends Person{
public Student(String name, int age, String sex, String number) {
super(name, age, sex);
this.number = number;
}
private String number;
public String getNumber() {
return number;
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我简单写一下你参考
public class Employee{
//定义属性
private int seniority = 0 ;//工龄
private double pay = 0.0;//工资
//属性公开方法
public int getSeniority(){
return this.seniority;
}
public double getPay(){
return this.pay;
}
public void setSeniority(int seniority){
this.seniority = seniority;
}
public void setPay(double pay){
this.pay = pay;
}
//计算工资的方法
public double comSalary(){
return this.seniority * 50 + pay;
}
}
祝你好运!
public class Employee{
//定义属性
private int seniority = 0 ;//工龄
private double pay = 0.0;//工资
//属性公开方法
public int getSeniority(){
return this.seniority;
}
public double getPay(){
return this.pay;
}
public void setSeniority(int seniority){
this.seniority = seniority;
}
public void setPay(double pay){
this.pay = pay;
}
//计算工资的方法
public double comSalary(){
return this.seniority * 50 + pay;
}
}
祝你好运!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
牛人啊 还没下课吧 呵呵 383808552
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询