|
查看: 2505|回复: 27
|
求帮忙JAVA 订购电影戏票系统CODING
[复制链接]
|
|
|
发表于 19-12-2008 05:15 PM
|
显示全部楼层
回复 19# yeenfei 的帖子
骂的好..................................... |
|
|
|
|
|
|
|
|
|
|
发表于 21-12-2008 01:04 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
谁能帮我做这个系统??
我想到都头爆炸了!!
Theatre Seats Booking System
Overview
The Westend Theatre puts on cultural shows daily (one show per day) and allows up to 50 attendees, with 10 seats in each row. The normal rate for a seat is set at $20.00. To promote attendance the management team has proposed generous discounts of 10 % for those booking 3-4 seats and 20% for those booking 5 or more seats. Customers making these bookings can choose the specific seats from the remaining available seats. It also has another scheme, whereby whatever remaining seats can be booked for free seating on the day of the show, for a 50% discount. These customers however will have to sit in any seat allocated to them by the operator (they may not be next to each other).
Part I: Booking class (abstract) and sub classes ( 3 marks )
To cater for these booking requirements, write an abstract class named Booking to keep track of the date of booking, number of seats, ID of the person making the booking (assume everyone in the country has a unique ID), and the status of booking. The status of the booking should be set to ‘b’ (booked) initially and changed to ‘c’ (confirmed) once the payment is made. It should provide an abstract method getCost() to compute the cost taking into account the type of booking and the number of seats. This method must be overridden in the subclasses FreeBooking and SeatsBooking. Those customers booking the free seats (on the day of the show) get a 50% discount, while those booking the specific seats get special discounts, if there are at least 3 seats in the booking (see above). The SeatsBooking class should contain an additional array to store the seats booked by the person. These classes should provide a constructors and accessors such as:
Abstract class Booking
public Booking(String date, String personID, int num) { …
public String getPersonID() { …
public String getDate() { …
public abstract double getCost();
public double getAmount() { …
Subclass SeatsBooking
public Booking(String date, String personID, int num, int seats[]) { …
public int[] getSeats() { …
public double getCost() { …
Subclass FreeBooking
public FreeBooking(String date, String personID, int num) { …
public double getCost() { …
In addition, these classes should contain methods that will permit reading and writing to text files. Possible File format for Booking objects are shown below.
Part II: Show class ( 3 marks )
The theatre manager should have the option to add a new show specifying the show name and the show date. The system should ensure that no two shows are scheduled for the same day. Once the date of show is passed the collection for that day must be written to a text file, before erasing all the show details.
To cater for these requirements write another class named Show, which uses a String to store the date of show, another String to store the show name, an array of 50 char elements for keeping track of the individual seat status (‘f’- free or ‘b’ - booked), an int to keep the number of bookings for the day, an array of up to 50 Booking references for storing all the bookings for that day, and a double to store the collection (money) for that day.
It should provide accessors and mutators such as:
public String getShowName() { …
public String getShowDate(){ …
public char[] getAllSeatsStatus() { …
public Booking[] getAllBookings() { …
public int getNumSeatsRemaining() { …
public int getNumBookings() { …
public int[] getFreeSeats() { …
public double getCollection() { …
public void bookSeats(int seats[]) throws SeatsNotFreeException { …
public void freeSeats(int seats[]) { …
public boolean addBooking(Booking b)
public void addToCollection(double amount) { …
In addition, these classes should contain methods that will permit reading and writing to text files. Possible File format for Show objects are shown below.
Part III: SeatsNotFreeException class
Whenever an attempt is made to book seat(s) already booked, a SeatsNotFreeException must be thrown, indicating the seats that are not available for booking. This exception must be caught and handled, by booking alternative seats (if possible). This exception class should provide instance variables to keep track of the number of seats, which are not free for booking, and an array to store the actual seat numbers (not available for booking). For example, if only seats 5,6,7,8,9,10 are available, and an attempt is made to book seats 9, 10, 11 and 12, the number of seats that are not available is 2, (seats 11 and 12). This class should provide appropriate constructors and accessors such as:
public SeatsNotFreeException(int invalidSeats[], int num) { …
public int[] getInValidSeats() { …
Part IV TheatreManager class
TheatreManager class should provide the functionality to manage the theatre operations making use of the Show and Booking classes. As part of the initialization the TheatreManger object must read all the data from the file Shows.dat to an array, delete expired Show objects (together with all the Booking objects for that day) after appending the total collection for that day to a data file (collections.dat). Before exiting the program, TheatreManager must write all the Show objects (together with their Booking objects) to Shows.dat. This class should also provide methods to implement the menu options below.
Add-Show
Users should be prompted to enter book details. A new object should be created and added to the array of Book objects as long as there is no other book with the same ID.
Display-Dates of Show
This option should display all the dates in which a particular show is staged.
Make Booking
This option should prompt user to specify the date of interest, select the Show object with the given date and display the seats availability for that day ( as shown below f-free b-booked )
Date: 5/8/2005
Title of show: Macbeth
Seats Availability
1-10 fffffffffff
11-20 fbbbbffffff
21-30 bbbbfffffff
31-40 fffffffffff
41-50 fffffffffff
Then it should prompt the user to enter the type and number of seats required. If booking by seats, users should be prompted to enter the seat numbers. The SeatsNotFreeException, thrown in case the specified seats are not free, must be caught and handled. System must ensure a person can make at most one booking for a given day, thus allowing a booking to be uniquely identified by date and ID (of person making the booking) together. Assume that every person in the country has a unique ID. If a booking is successfully made, the status of the seats and the list of bookings for the specified Show object must be updated.
Cancel Booking
This option should allow a booking to be cancelled by specifying date and ID of the person who made the booking. It should first identify the specified Show object, then delete the specified Booking object from the list of bookings and update the status of the seats.
Confirm Booking
This option should allow a booking to be confirmed by specifying date and ID of the person who made the booking. When a booking is confirmed (i.e. payment made) the amount collected should be added to the collection for the corresponding show.
Display Collection for a given day (in the past)
This option should allow the total collection for a particular day (in the past) to be displayed.
Marks will also be allocated to the following:
1. Correctness: Evidence of Testing
2. Proper handling of text files (all objects correctly saved to a text file and restored)
3. Incorporating exception handling (Catch and handle exceptions where possible)
4. Good User Interface
5. Input Validation
6 Documentation / Appropriate names for Identifiers / Indentation
7. Good Design (Promotes Code Reuse, Facilitates Maintenance) |
|
|
|
|
|
|
|
|
|
|
发表于 13-11-2008 01:58 AM
|
显示全部楼层
回复 1# nelcles 的帖子
abstract class
lol project 罢了
你要yong array 来store 你的sit
看来是collage还是Uni 的final project 模式 |
|
|
|
|
|
|
|
|
|
|
发表于 14-11-2008 12:24 AM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 14-11-2008 09:06 PM
|
显示全部楼层
现在的学生好幸福哦..
需要的class 都列完出来了
而且问题还写得那么白..
 |
|
|
|
|
|
|
|
|
|
|
发表于 14-11-2008 11:42 PM
|
显示全部楼层
回复 4# waiting_hoh 的帖子
Hi:
I try to answer the part 1. I use C# (very similar to Java). U need to do some homework to convert to Java
here the code, hope it can help......
namespace booking
{
public abstract class abstractbooking
{
private DateTime datebook;
private int numofseats;
private string id;
private string status;
private double amount = 20;
public double Amount
{
get { return amount; }
}
public DateTime Datebook
{
get { return datebook; }
set { datebook = value; }
}
public int Numofseats
{
get { return numofseats; }
set { numofseats = value; }
}
public string Id
{
get { return id; }
set { id = value; }
}
public string Status
{
get { return status; }
set { status = value; }
}
public abstract double getCost();
public double calCost(int numseat, double discount)
{
double cost = (numseat * this.Amount);
double discountcost = (numseat * Amount * discount);
cost = cost - discountcost;
return cost;
}
}
public class SeatsBooking : abstractbooking
{
private List<string> seatlist = new List<string>();
public List<string> Seatlist
{
get { return seatlist; }
}
public SeatsBooking(string personid,DateTime bookdate)
{
this.Id = personid;
this.Datebook = bookdate;
}
public void BookSeat(string seatnum)
{
seatlist.Add(seatnum);
}
public override double getCost()
{
double cost = 0;
int numseat = seatlist.Count;
if (numseat >= 3 && numseat <= 4)
{
cost = calCost(numseat, 0.1);
}
else if (numseat >= 5)
{
cost = calCost(numseat, 0.2);
}
else
{
cost = calCost(numseat, 0);
}
return cost;
}
}
public class FreeBooking : abstractbooking
{
private List<string> seatlist = new List<string>();
public List<string> Seatlist
{
get { return seatlist; }
}
public FreeBooking(string personid, DateTime bookdate)
{
this.Id = personid;
this.Datebook = bookdate;
}
public void BookSeat(string seatnum)
{
seatlist.Add(seatnum);
}
public override double getCost()
{
double cost = 0;
cost = calCost(numseat, 0.5);
return cost;
}
}
} |
|
|
|
|
|
|
|
|
|
|
发表于 17-12-2008 10:30 AM
|
显示全部楼层
正在读着java了。。以前在大学里是读过的了。。可是每每遇到比较难的地方时就放弃了。。 |
|
|
|
|
|
|
|
|
|
|
发表于 18-12-2008 05:51 PM
|
显示全部楼层
读下读下。。又开始觉得难了。。
请问各位programmer,interface的冬冬。。可不可以跳过呢??对我来说很难勒。。
如果现在跳过。。会不会有问题呢?? |
|
|
|
|
|
|
|
|
|
|
发表于 15-12-2008 04:29 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 15-12-2008 08:49 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 16-12-2008 12:23 AM
|
显示全部楼层
回复 6# 一塊云 的帖子
我看你真的在飘.....还再问要学java 还是 .net ...... |
|
|
|
|
|
|
|
|
|
|
发表于 16-12-2008 08:24 AM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 16-12-2008 11:18 AM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 17-12-2008 03:17 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 17-12-2008 07:14 PM
|
显示全部楼层
回复 12# sfkwan 的帖子
.Net 不错,容易过JAVA......不管.NET还是JAVA, 能写APPLICATION 的就是好LANGUAGE  |
|
|
|
|
|
|
|
|
|
|
发表于 18-12-2008 08:24 AM
|
显示全部楼层
原帖由 mokth 于 17-12-2008 07:14 PM 发表 
.Net 不错,容易过JAVA......不管.NET还是JAVA, 能写APPLICATION 的就是好LANGUAGE
什么是不能写application的language? |
|
|
|
|
|
|
|
|
|
|
发表于 18-12-2008 10:02 AM
|
显示全部楼层
回复 14# yeenfei 的帖子
bahasa malaysia  |
|
|
|
|
|
|
|
|
|
|
发表于 18-12-2008 10:30 AM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 18-12-2008 12:06 PM
|
显示全部楼层
我读着的这本书好像没说明是J2SE还是什么也。。introduction to java.
那么J2SE, J2ME, J2EE, 有什么分别麽??
考试考试。。
J2SE = Standard?
J2ME = Mobile?
J2EE = Enterprise?
什么分别?
我install了JRE1.6 和 JDK1.6
那我写着的,是属于哪一个??我可以写哪一个?? |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|