求解一道java程序设计题目(编写一个课程类Cource)
发布网友
发布时间:2022-05-03 07:46
我来回答
共1个回答
热心网友
时间:2023-10-14 22:23
public class Cource{
private String cNumber;
private String cName;
private double cUnit;
public static int cTotalNum = 0;
public Cource(){
this.cName="java";
this.cNumber="123";
this.cUnit = 100;
this.cTotalNum++;
}
public String getCName() {
return cName;
}
public void setCName(String name) {
cName = name;
}
public String getCNumber() {
return cNumber;
}
public void setCNumber(String number) {
cNumber = number;
}
public double getCUnit() {
return cUnit;
}
public void setCUnit(double unit) {
cUnit = unit;
}
public void printCourceInfo(){
System.out.println("cName:"+this.getCName());
System.out.println("cNumber:"+this.getCNumber());
System.out.println("cUnit:"+this.getCUnit());
}
}
热心网友
时间:2023-10-14 22:23
public class Cource{
private String cNumber;
private String cName;
private double cUnit;
public static int cTotalNum = 0;
public Cource(){
this.cName="java";
this.cNumber="123";
this.cUnit = 100;
this.cTotalNum++;
}
public String getCName() {
return cName;
}
public void setCName(String name) {
cName = name;
}
public String getCNumber() {
return cNumber;
}
public void setCNumber(String number) {
cNumber = number;
}
public double getCUnit() {
return cUnit;
}
public void setCUnit(double unit) {
cUnit = unit;
}
public void printCourceInfo(){
System.out.println("cName:"+this.getCName());
System.out.println("cNumber:"+this.getCNumber());
System.out.println("cUnit:"+this.getCUnit());
}
}