闲话不多说,先抖一张效果图:
好,咱们正式进入主题
一、问题分析
1.系统开发步骤
(1)明确需求
(2)设计类
(3)创建项目
(4)确定编码顺序
1.主窗体
2.查看新放映列表
3.查看电影介绍
4.查看影票票价
5.查看放映厅座位
6.购票和打印电影票
7.继续购票
(5)测试
二、类的设计
献上这9个类的代码
(1)Seat 类:保存影院的座位信息
public class Seat
{
public Seat(string seatNum, Color color)
{
this.SeatNum = seatNum;
this.Color = color;
}
/// <summary>
/// 座位号
/// </summary>
private string seatNum;
public string SeatNum
{
get { return seatNum; }
set { seatNum = value; }
}
/// <summary>
/// 显示售出与否的颜色属性
/// </summary>
private Color color;
public Color Color
{
get { return color; }
set { color = value; }
}
}
(2)Movie:电影类
public enum MovieType
{
//喜剧
Comedy,
//战争
War,
//爱情
Romance,
//动作
Action,
//卡通
Cartoon,
//恐怖
Thriller,
//冒险
Adventure
}
[Serializable]
public class Movie
{
public Movie() { }
public Movie(string movieName, string poster, string director,string actor,MovieType movieType,int price)
{
this.MovieName = movieName;
this.Poster = poster;
this.Director = director;
this.Actor = actor;
this.MovieType = movieType;
this.Price = price;
}
/// <summary>
/// 电影名称
/// </summary>
private string movieName;
public string MovieName
{
get { return movieName; }
set { movieName = value; }
}
/// <summary>
/// 海报图片名
/// </summary>
private string poster;
public string Poster
{
get { return poster; }
set { poster = value; }
}
/// <summary>
/// 导演名
/// </summary>
private string director;
public string Director
{
get { return director; }
set { director = value; }
}
/// <summary>
/// 主演
/// </summary>
private string actor;
public string Actor
{
get { return actor; }
set { actor = value; }
}
/// <summary>
/// 电影类型
/// </summary>
private MovieType movieType;
public MovieType MovieType
{
get { return movieType; }
set { movieType = value; }
}
/// <summary>
/// 电影定价
/// </summary>
private int price;
public int Price
{
get { return price; }
set { price = value; }
}
}
(3)Ticket:电影票父类,保存电影票信息
public class Ticket
{
public Ticket() { }
public Ticket(ScheduleItem scheduleItem, Seat seat)
{