Java类设计

时间:2016-07-14 18:54:38

标签: java

我想做一个名为“Ticketer”的简单程序,你可以:

  • 添加可用票数的新活动
  • 为客户分配一张票。

我不确定如何正确设计类。

这是我到目前为止所得到的:

Class Event
----
Name
Date
QuantityOfTickets-which is how many tickets that event have


Class EventTicket extends Event
-----------
ticket[QuantityOfTickets]-after creatting any Event class create an array of tickets for
as many as  we set up in Event class.

TicketNumber
Object Customer
+3 fields from Event (Event.Name,Event.Date and Event.QuantityOfTickets)


Class Customer
-------------
Id
FistName
LastName

请告诉我这是否是一个好的方法并指导我,一般来说,一步一步如何做这个程序?

谢谢

1 个答案:

答案 0 :(得分:1)

我推荐另一种结构:

课程活动

http://nameofapp.appspot.com/

Class EventTicket

Name
Date
QuantityOfTickets (can be removed and use instead of it length of array of tickets)
EventTicket tickets[QuantityOfTickets]

班级客户

TicketNumber
(and if you will need additional fields (not from Event))

有关于它的任何问题吗?