-1
public class Course {
private String title;
private String instructor;
private double price;
public enum CustomerType {
PROGRAMMING, MATHEMATICS, PHOTOGRAPHY, MUSIC, PAINTING, MISC
};
private CourseType cType;
private Date startDate;
private Date endDate;
public Course()
{
setTitle("");
setInstructor("");
setPrice(0.0);
setCType("");
setStartDate(new Date());
setEndDate(new Date());
}
public Course(String title, String instructor, double price, Date startDate, Date endDate)
{
setTitle(title);
setInstructor(instructor);
setPrice(price);
setStartDate(startDate);
setEndDate(endDate);
}
public void setTitle(String title)
{
this.title = title;
}
public void setInstructor(String instructor)
{
this.instructor = instructor;
}
public void setPrice(double price)
{
this.price = price;
}
public void setCType(CourseType cType)
{
this.cType = cType;
}
public void setStartDate(Date startDate)
{
this.startDate = startDate;
}
public void setEndDate(Date endDate)
{
this.endDate = endDate;
}
public String getTitle()
{
return title;
}
public String getInstructor()
{
return instructor;
}
public double getPrice()
{
return price;
}
public CourseType getCType()
{
return cType;
}
public Date getStartDate()
{
return startDate;
}
public Date getEndDate()
{
return endDate;
}
public double calculateCharge(Customer.CustomerType c)
{
return 0.0;
}
public String toString()
{
return ("title" + title + "instructor" + instructor + "price" + price + "cType" + cType);
}
}
我試圖檢查拼寫和格式,並不能發現任何東西。
這裏有三個錯誤我不斷收到當我編譯:
錯誤無法找到符號 公共CourseType getCTpe()
錯誤無法找到符號 公共無效setCType(CourseType CTYPE)
誤差不能找到符號 public CourseType cType;
您的枚舉被稱爲'CustomerType'而不是'CourseType'。 – Jesper 2015-02-08 15:34:00
老兄!如果我知道你住在哪裏,我會擁抱你!哈哈,我花了一個小時拉我的頭髮,試圖找到錯誤。你是對的!非常感激! – Noah 2015-02-08 15:46:35