C++足球俱乐部管理系统.docxVIP

  • 3
  • 0
  • 约8.52千字
  • 约 16页
  • 2019-05-20 发布于安徽
  • 举报
足球俱乐部管理系统 第一版本(试用版) 开发环境 Visual Studio 2015 二.实验描述 给相关管理机构开发一个足球俱乐部的管理程序,实现对众多足球俱乐部管理的基本功能,包括: 俱乐部的增删改查,其中俱乐部的属性包括:俱乐部的名称,现金,其下的球员和普通行政人员。 实现对所有球员的各项属性(包括姓名、年龄、能力、年薪、转会费、进球总数、服役年限)的简单搜索,支持输入多个条件,条件之间用连接,如“年龄不大于25且服役年限大于5年的球员”的查询表达式为 ! (@age25) @experience5 支持球员在不同俱乐部间的买卖,买卖条件为:买方俱乐部的现金=球员的转会费。交易完成后,卖方得到其转会费。 三.数据结构 把员工也看作一个对象,记作名为staff类,这个类的属性有姓名、年龄、能力,年薪,把球员看作一个对象,记作名为player类,这个类的属性有:姓名、年龄、能力、年薪、转会费、进球总数和服役年限,则球员和员工都具有姓名、年龄、能力,工作俱乐部这些共同属性,因此将球员看作是员工类的一个派生。 把俱乐部看作一个对象,记为club类,俱乐部的属性有:俱乐部的名称,现金,其下球员和员工。将管理机构看作一个对象,记为League的一个类,则League的属性有:所有俱乐部。 四.具体功能实现 球员和员工信息的查找和修改 由于球员和员工的属性都是私有成员,只能通过类的成员函数来访问 和修改。这两个类的成员函数及其方法如下: Staff类: class Staff {//staff类 private: string name; //姓名 int age; //年龄 int ability; //能力 int salary; //年薪 public: Staff(const string Name = None, int Age = 0, int Abi = 0, int Sal = 0); ~Staff() {}; virtual void Show() const; //虚函数,打印职员信息 string GetName() { return name; } int GetAge() { return age; } int GetAbility() { return ability; } int GetSalary() { return salary; } //得到私有成员的值 void ResetStaff(string new_name, int new_age, int new_abi, int new_sal); //重置一个staff void ResetName(string Name) { name = Name; } void ResetAge(int new_age) { age = new_age; } void ResetAbillity(int new_abi) { ability = new_abi; } void ResetSalary(int new_sal) { salary = new_sal; } //修改单项值 }; Player类: class Player : public Staff {//球员类,公有继承staff类 public: int fee; //转会费 int goals; //进球数 int year; //服役年限 public: Player(const string Name = None, int Age = 0, int Abi = 0, int Sal = 0, int Fee = 0, int Goals = 0, int Year = 0); Player(const Staff sta, int Fee = 0, int Goals = 0, int Year = 0); //构造函数 ~Player() {}; int GetFee() { return fee; } int GetGoals() { return goals; } int GetYear() { return year; } //得到私有成员的值 virtual void Show() const; //打印球员信息 void ResetPlayer(string Name, int Age, int Abi, int Sal, int Fee, int Goals, int Year); //改写一个player void ResetFee(int FEE) { fee = FEE; } void ResetGoals(int GOALS) { goal

文档评论(0)

1亿VIP精品文档

相关文档