C#影院售票系统毕业设计(1)

2019-12-30 11:02:24王冬梅
  • MessageBox.Show(info);  //存到文件中 
  • string fileName = this.ScheduItem.Time.Replace(":", "-") + " " + this.Seat.SeatNum + ".txt";  FileStream fs = new FileStream(fileName, FileMode.Create); 
  • StreamWriter sw = new StreamWriter(fs);  sw.Write(info); 
  • sw.Close();  fs.Close(); 
  • }  /// <summary> 
  • /// 显示当前售出票信息  /// </summary> 
  • public override void Show()  { 
  • string info = string.Format("已售出!n{0}折学生票!",this.Discount);  MessageBox.Show(info); 
  • }  } 
  • }  ?

    5.FreeTicket:赠票子类,继承父类Ticket

    获得赠票者的名字属性(CustomerName):string类型

    重写父类计算票价CalcPrice()

    重写父类打印售票信息Print()

    重写父类显示当前出票信息Show()
     

    1. using System;  using System.Collections.Generic; 
    2. using System.Linq;  using System.Text; 
    3. using System.Threading.Tasks;  using System.Windows.Forms; 
    4. using System.IO;   
    5. namespace 影院售票系统  { 
    6. /// <summary>  /// 赠票 
    7. /// </summary>  public class FreeTicket:Ticket 
    8. {  public FreeTicket() { } 
    9. public FreeTicket(ScheduleItem sch,Seat seat,string name)   { 
    10. this.Seat = seat;  this.CustomerName = name; 
    11. this.ScheduItem = sch;  } 
    12. private string _customerName;  /// <summary> 
    13. /// 获得赠票者的名字  /// </summary> 
    14. public string CustomerName  { 
    15. get { return _customerName; }  set { _customerName = value; }