📄 studentticket.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace dianyingyuan
{
[Serializable]
class StudentTicket:Ticket,Iprintshow
{
public StudentTicket(string sum,Movie name,int jiage,string time,int zekou)
:base(sum,name,jiage,time)
{
this.Ze = zekou;
}
private int ze;
public int Ze
{
get { return ze; }
set { ze = value; }
}
/// <summary>
/// 重写计算价格的虚方法
/// </summary>
public override void CalPrice()
{
this.Price = this.Dianying.Price * this.Ze / 10;
}
#region Iprintshow 成员
public new void printsa()
{
//文件名
string ticketFileName = this.Dianying.MovieName
+ this.Showtime.Replace(':', '-')
+ this.SeatNum + ".txt";
FileStream st = new FileStream(ticketFileName, FileMode.Create);
StreamWriter sw = new StreamWriter(st);
try
{
sw.WriteLine("*************************");
sw.WriteLine(" 小树影院(学生票) ");
sw.WriteLine("-------------------------");
sw.WriteLine("电影名:" + this.Dianying.MovieName);
sw.WriteLine("时间:" + this.Showtime);
sw.WriteLine("座位号:" + this.SeatNum);
sw.WriteLine("价格:" + this.Price.ToString());
sw.WriteLine("折扣:" +this.Ze.ToString()+"折");
sw.WriteLine("*************************");
}
catch (Exception ex)
{
throw ex;
}
finally
{
sw.Close();
}
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -