佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 2505|回复: 27

求帮忙JAVA 订购电影戏票系统CODING

[复制链接]
发表于 19-12-2008 05:15 PM | 显示全部楼层

回复 19# yeenfei 的帖子

骂的好.....................................
回复

使用道具 举报


ADVERTISEMENT

发表于 21-12-2008 01:04 PM | 显示全部楼层
原帖由 mokth 于 21-12-2008 11:59 AM 发表
你还不错吗, 用NOTEPAD. 想当年,做CLIPPER UI 时,只能用DOS的EDIT而已和一张25X80的各子. 那种痛苦只有写DOS PROGRAM 的人才了解


25x80 哈哈!! 还好在我写Applet 时都是用Pixel 计算,不过也是同样很痛苦

有一年的时间里,我是在Linux GUI 写C 的作业, 然后在Solaris Compile & Debug
Solaris 就只有 VI 而已 (黑色背景白色字),连VIM都没有
现在把 VI 的用法都忘完了,浪费我当时花那么多时间去熟悉VI
回复

使用道具 举报

 楼主| 发表于 12-11-2008 05:35 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 | 显示全部楼层
malaysia的I.T学生...
玩dota不看你头爆?去外面浦不看你头爆?
下衰I.T业...
回复

使用道具 举报

发表于 14-11-2008 09:06 PM | 显示全部楼层
现在的学生好幸福哦..
需要的class 都列完出来了
而且问题还写得那么白..
回复

使用道具 举报

Follow Us
发表于 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了。。以前在大学里是读过的了。。可是每每遇到比较难的地方时就放弃了。。
回复

使用道具 举报


ADVERTISEMENT

发表于 18-12-2008 05:51 PM | 显示全部楼层
读下读下。。又开始觉得难了。。
请问各位programmer,interface的冬冬。。可不可以跳过呢??对我来说很难勒。。
如果现在跳过。。会不会有问题呢??
回复

使用道具 举报

发表于 15-12-2008 04:29 PM | 显示全部楼层
原帖由 PeachHuman 于 14-11-2008 12:24 AM 发表 malaysia的I.T学生... 玩dota不看你头爆?去外面浦不看你头爆? 下衰I.T业...

别酱凶。。会吓坏I.T的未来主人翁。。
回楼主。。我不会。。
正在找着 java / .net 的基础教学。。
学 java 还是 .net 好呀??请问各位programmer...
回复

使用道具 举报

发表于 15-12-2008 08:49 PM | 显示全部楼层
原帖由 一塊云 于 15-12-2008 04:29 PM 发表

别酱凶。。会吓坏I.T的未来主人翁。。
回楼主。。我不会。。
正在找着 java / .net 的基础教学。。
学 java 还是 .net 好呀??请问各位programmer...


各有各好
個人覺得.net入手容易
而java價值高
回复

使用道具 举报

发表于 16-12-2008 12:23 AM | 显示全部楼层

回复 6# 一塊云 的帖子

我看你真的在飘.....还再问要学java 还是 .net ......
回复

使用道具 举报

发表于 16-12-2008 08:24 AM | 显示全部楼层
原帖由 一塊云 于 15-12-2008 04:29 PM 发表

别酱凶。。会吓坏I.T的未来主人翁。。
回楼主。。我不会。。
正在找着 java / .net 的基础教学。。
学 java 还是 .net 好呀??请问各位programmer...


早点吓坏他们好过给他们出来丢面子
我比较推荐java, .net的话要看ms的脸色
回复

使用道具 举报

发表于 16-12-2008 11:18 AM | 显示全部楼层
原帖由 yuyike5303 于 13-11-2008 01:58 AM 发表
abstract class
lol project 罢了
你要yong array 来store 你的sit
看来是collage还是Uni 的final project 模式



我估计是Uni 1st Year 的assignment
因为我1st Sem 也是作类似的题目
回复

使用道具 举报

发表于 17-12-2008 03:17 PM | 显示全部楼层
原帖由 一塊云 于 17-12-2008 10:30 AM 发表
正在读着java了。。以前在大学里是读过的了。。可是每每遇到比较难的地方时就放弃了。。


我大学是读J2SE, 没动过任何M$ Product 除了 OS & Office
但一出来就做.NET了
回复

使用道具 举报

发表于 17-12-2008 07:14 PM | 显示全部楼层

回复 12# sfkwan 的帖子

.Net 不错,容易过JAVA......不管.NET还是JAVA, 能写APPLICATION 的就是好LANGUAGE
回复

使用道具 举报


ADVERTISEMENT

发表于 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 | 显示全部楼层
原帖由 mokth 于 18-12-2008 10:02 AM 发表
bahasa malaysia



笑死我
回复

使用道具 举报

发表于 18-12-2008 12:06 PM | 显示全部楼层
我读着的这本书好像没说明是J2SE还是什么也。。introduction to java.
那么J2SE, J2ME, J2EE, 有什么分别麽??
考试考试。。
J2SE = Standard?
J2ME = Mobile?
J2EE = Enterprise?
什么分别?

我install了JRE1.6 和 JDK1.6
那我写着的,是属于哪一个??我可以写哪一个??
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 15-12-2025 10:54 PM , Processed in 0.179957 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表