發新話題

[問題] 請問JAVA高手

請問JAVA高手

請問像這樣的一個題目該如何寫呢...謝謝了
因為剛再學...覺得直接看寫好的程式和執行結果會比較容易了解

As part of the software for managing a small video club, we need to store information about the videos
that are available for borrowing and information about the members who are allowed to borrow the
videos.
For a video, we need to store the code number (an int), the film title (a String), the name of the
director (a String) and the daily hire charge (a double).
For a member of the club, we need to store the membership number (an int), the surname (a String),
the initials (a String), the phone number (a String) and the email address (a String).
Write a Java class Video that can be used to create Video objects for storing information about videos.
Your class should have an appropriate constructor and get and set methods. Your class should include a
static variable that keeps a count of how many Video objects have been constructed during a run of
the program. Your class should also include a toString method so that the data stored in a Video
object can be easily displayed. For example, the following code:
Video tiger = new Video(345672, "Crouching Tiger, Hidden Dragon",
"Ang Lee", 2.50);
System.out.println(tiger);
should result in output such as:
345672: Crouching Tiger, Hidden Dragon directed by Ang Lee, £2.50
Finally, your Video class should include a loanCost method that takes the number of days for a loan
(an int) as a parameter and returns the total cost of the loan.
Write a class Member that can be used to create Member objects for storing information about club
members Your Member class should also have a static variable to count the number of Member
objects and a toString method
Provide a main method that thoroughly tests your two classe

TOP

我英文沒有很好,所以翻譯有不懂的地方請多包涵

建立一小型影片俱樂部,可以儲存租片資訊及可以租閱影片的會員資訊
對影片來說,我們需要儲存影片條碼(int)、影片名稱(String)、導演名稱(String)以及每日租借金額(double)
對會員來說,我們需要儲存會員號碼(int)、姓氏(String)、名字(String)、電話號碼(String)及e-mail(String)

1.撰寫一Java影片類別,可以用來創造可以儲存影片資訊的影片物件
  這個類別要有適當的建構式以及get、set方法。
  還要包含一個靜態變數用來儲存程式執行期間建立了多少個影片物件
  你的類別也應該要包含一個toString方法來輕易展現儲存在影片物件裡的資料

例如:
Video tiger = new Video(345672, "Crouching Tiger, Hidden Dragon","Ang Lee", 2.50);
System.out.println(tiger);

輸出結果如下:
345672: Crouching Tiger, Hidden Dragon directed by Ang Lee, £2.50

最後,你的影片類別要包含一個loanCost方法得到租借天數(int)來當作參數並傳回租借總花費金額

2.撰寫一個會員類別用來創造儲存俱樂部會員資訊的會員物件,這個會員類別也應該有一個靜態變數
  用來計算會員物件的數量和一個toString方法

提供一個main方法來測試這兩個類別

===================
我也剛在學,大家研究研究
你要創造兩個類別:Video跟Member
並且建立這兩個類別的屬性跟方法
再由Main方法測試這兩個類別所

[ 本帖最後由 lemsinyi 於 2009-8-5 21:22 編輯 ]
附件: 您所在的用戶組無法下載或查看附件

TOP

發新話題

本站所有圖文均屬網友發表,僅代表作者的觀點與本站無關,如有侵權請通知版主會盡快刪除。