在学习当中遇到了这个Pyhton的问题,希望得到解决来完成这个学习项目
自己写了点,希望可以得到一个详细的代码,我自己对着看一看就行
public void test() {
Teather s_1=new Teather("li ming",40,"male");
s_1.chengjiluru();
s_1.pingjun();
}
}
class Person{
private String name;
private int age;
private String sex;
public Person() {
}
public Person(String name,int age,String sex) {
this.name=name;
this.age=age;
this.sex=sex;
}
}
class Teather extends Person{
private double[] score=new double[5];
public Teather(String name,int age,String sex) {
super(name,age,sex);
}
public void chengjiluru() {
Scanner scan=new Scanner(System.in);
System.out.println("请分别输入(信息):doctor、professor、5500、2000");
for(int i=0;i<5;i++) {
score[i]=scan.nextDouble();
}
}
public void pingjun() {
double sum=0;
for(int i=0;i<5;i++) {
sum+=score[i];
}
}