广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 3930 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为IE收藏   收藏主题   上一主题 | 下一主题   
coon
数位造型
个人文章 个人相簿 个人日记 个人地图
初露锋芒
级别: 初露锋芒 该用户目前不上站
推文 x4 鲜花 x31
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片
推文 x0
[Java][求助] 有谁可以当我解决错误的地方
一直不知道哪里出问题
不太会改
请各位大大帮我

import java.util.Scanner;

class Book{
private String name;
private String author;
private String publisher;
private int price;

Book(){

}

Book(String name, String author, String publisher, int price){
this.name = name;
this.author = author;
this.publisher = publisher;
this.price = price;
}

public String toString(){
return "书名:" + this.name + "\n作者:" + this.author +
"\n出版社:" + this.publisher + "\n订价:" + this.price;

}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getAuthor() {
return author;
}

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

public String getPublisher() {
return publisher;
}

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

public int getPrice() {
return price;
}

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

public double getSellPrice(){
Calculator calculator = new Calculator();
double price = (double)this.price;
return calculator.calculate(price, 0.8);
}
}
class ComBook extends Book{
boolean hasDisc;

String hasDisc(){
return this.hasDisc==true?"附光碟":"没光碟";
}
void setHasDisc(boolean hasDisc){
this.hasDisc = hasDisc;
}
ComBook(){

}
ComBook(String name, String author, String publisher,
int price, boolean hasDisc){
super( name, author, publisher, price);
this.hasDisc = hasDisc;
}
}

class Comic extends Book{
boolean isComic;

String isComic(){
return this.isComic==true?"书":"漫画书";
}
void setHasDisc(boolean isComic){
this.isComic = isComic;
}


class BookShop{
private ComBook[] comBook = new ComBook;
BookShop(){
comBook = new ComBook("资料结构\t","曾志轩\t","碁峰文化\t",500,true);
comBook = new ComBook("J2EE\t\t\t","杨泰升\t","博硕文化\t",380,true);
comBook = new Comic("火影忍者\t","岸本齐史\t","东立",80,true);
comBook = new ComBook("MacOSX 10.5\t\t","施威铭研究室","旗标\t",560,true);
comBook = new Comic("灌篮高手\t","井上雄彦\t","东立",80,true);
comBook = new ComBook("Java程式设计艺术\t","Deitel\t","全华图书\t",650,true);

}
public String toString(){
String result = "";
for(int i=0;i<comBook.length;i++){
result += "("+(i ..

访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容




献花 x0 回到顶端 [楼 主] From:未知地址 | Posted:2008-12-13 19:23 |

首页  发表文章 发表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.057619 second(s),query:15 Gzip disabled
本站由 瀛睿律师事务所 担任常年法律顾问 | 免责声明 | 本网站已依台湾网站内容分级规定处理 | 连络我们 | 访客留言