台灣最大程式設計社群網站
線上人數
1376
 
會員總數:246315
討論主題:189843
歡迎您免費加入會員
討論區列表 >> Java >> 作業問題請大家幫忙
[]  
[我要回覆]
1
回應主題 加入我的關注話題 檢舉此篇討論 將提問者加入個人黑名單
作業問題請大家幫忙
價值 : 10 QP  點閱數:1148 回應數:2
樓主

shuan
門外漢
0 1
4 0
發送站內信


http://imageshack.us/photo/my-images/213/imag0374c.jpg/
請大家幫忙,程式打到這遇到了瓶頸

是java初學者,不知道以下我的程式碼目前為止有沒有錯誤,謝謝
public class Book {
private String bookTitle;
private String bookNo;
private String author;
private String publisher;
private int price;

public Book(String bookTitle,String bookNo,String author,String publisher,int price){
return;
}
public void getbookTitle(String bookTitle,String bookNo,String author,String publisher,int price){
this.bookTitle = bookTitle;
this.bookNo = bookNo;
this.author = author;
this.publisher = publisher;
this.price = price;
}
public void setbookTitle(String bookTitle,String bookNo,String author,String publisher,int price){
this.bookTitle = bookTitle;
this.author = author;
this.publisher = publisher;
this.price = price;

}
public String toString() {
return this.bookTitle + ":" + this.bookNo + ":" + this.author + ":" + this.publisher + ":" + this.price;
}



}

本篇文章發表於2012-03-09 15:18
1樓
回應

香帥
檢舉此回應
看起來好像少一個main
本篇文章回覆於2012-03-10 08:53
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔--
2樓
回應

李小逸
檢舉此回應
應該是這樣...
也是初學 順便練習..

class Book {
private String bookTitle; // --書名
private String bookNo; // --書號
private String author; // --作者
private String publisher; // --出版商
private int price; // --價格

public Book(String bookTitle, String bookNo, String author,String publisher, int price) {
super();
this.bookTitle = bookTitle;
this.bookNo = bookNo;
this.author = author;
this.publisher = publisher;
this.price = price;
}

public String getBookTitle() {
return bookTitle;
}

public String getBookNo() {
return bookNo;
}

public String getAuthor() {
return author;
}

public String getPublisher() {
return publisher;
}

public int getPrice() {
return price;
}

public void setBookTitle(String bookTitle) {
this.bookTitle = bookTitle;
}

public void setAuthor(String author) {
this.author = author;
}

public void setPublisher(String publisher) {
this.publisher = publisher;
}

public void setPrice(int price) {
this.price = price;
}

@Override
public String toString() {
return bookTitle + "(" + bookNo + ")-" + author + "-" + publisher+ "-$" + price + "元";
}
}
本篇文章回覆於2012-03-13 16:42
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔--
   
1

回覆
如要回應,請先登入.