面向对象程序设计课程设计指南(信息2011)

课程设计指导书

面向对象程序设计(分册)

唐仕喜周彩根王创伟曹莹莹郭晓俐

盐城师范学院信息科学与技术学院

2011.9

《面向对象程序设计》实训课程设计

一、概述

(一)课程设计的性质、目的与作用

面向对象程序设计是计算机及其相关专业一门重要的专业基础课程,是学习计算机软件的重要课程。从实际工作需要来看,仅靠教学计划安排的课内实验时间是不够的,为了帮助广大同学对面向对象程序设计有更好的掌握,提高运用C++程序解决实际问题的能力,需要对面向对象程序设计进行系统的实践训练,故编写《面向对象程序设计》课程设计这部分内容。

课内的实验是侧重于对某一方面知识的学习,在解决实际问题时,可能涉及并运用多个方面的知识,具有较强的综合性,这就需要进行一些综合性的设计练习,来提高分析和解决实际应用问题的能力。

面向对象程序设计课程设计的目的是通过课程设计的综合训练,培养学生实际分析问题、编程和动手能力,最终目标是想通过课程设计的形式,帮助学生系统掌握该门课程的主要内容,更好地完成教学任务。另外,课程设计中较大的综合设计,可以分成几个小项目供学生分工合作,以培养团队协作精神。

实训重点及要求:①理论知识点转化为岗位基本应用技能,方法:原理+原型验证+案例学习+实践体验,面向对象面向对象编程+数据库访问技术+组件编程+Web编程,项目演练转化为企业合格开发者;②直接进入真实的企业项目开发过程案例原型纵向扩展法+案例原型横向扩展法,需求分析+概要设计+逻辑设计+物理设计+代码编写+测试。

(二)课程设计的要求

在课程设计时,对要解决的问题,要注意以下几个方面:

1.正确:设计的算法要严谨、正确,能正确解决实际问题,符合指定的要求;

2.高效:有效的建立数学模型,合理的选择数据结构,编写高效的程序代码;

3.清晰:算法和程序的结构要清晰,算法要用流程图来表示,程序代码要加注解;

4.设计报告:每一个问题解决后,要按统一的纸张及格式,完整、整洁地写出设计报

告,打印程序清单,拷贝所做设计的电子版文档和程序。

(三)设计报告格式

在将综合设计作为教学的一个环节时,设计报告一般包括以下几个方面的内容:

1.问题描述

题目要解决的问题是什么

2.算法设计与功能模块

解决问题的基本方法说明,包括主要算法思想,算法的流程图。

程序中主要函数或过程的功能说明。

3.程序输入与结果输出。

4.总结

遇到的主要问题是如何解决的、对设计和编码的回顾讨论和分析、进一步改进设想、经验和体会等。

5.附录

源程序清单

(四)考核评估

通过程序实现、总结报告和学习态度综合考评,并结合学生的动手能力,独立分析解决问题的能力和创新精神。成绩分优、良、中、及格和不及格五等。

考核标准包括:

1.程序实现的正确性,包括程序整体结构是否合理、编程风格是否规范等。(25%)

2.程序功能的完善程度,包括功能的基本实现、基本完善、完全实现。(25%)

3.学生的工作态度、独立工作能力。(25%)

4.课程设计报告。(25%)考核标准方式:面试,根据课程设计报告和所做模块提3-5个问题,当场给分。

三、《面向对象程序设计》课程设计课题表

【课题 1】实用程序工具包。(4人)

【基本要求】

开发一个实用程序工具包,包括:

(1)系统依赖性

在实用程序工具包中包含有常用的标准库系统,这些库文件的名字因为使用ANSI版还是老版本的C++而有所不同,将这些依赖系统的特征收集在实用程序工具包中,使程序的部分不依赖于系统中C++的精确版本,这样可改进程序的可移植性,可以在不同版本的编译器中轻易地编译它们。

(2)实用函数

GetChar() 函数:用户输入需跳过的空格及制表符,如在输入用字符表示的某种选择时。

将UserSaysYes()函数加入到utility.h中。

(3)实用函数模

交换两个数据元素的函数模板Swap

显示数组中各元素的值的函数模板Show

(4)实用类

计时器类Timer:在比较一个问题的不同程序实现时,了解一个程序与另一个程序运行的计算机时间是非常有用的;

通用异常类Error:提高程序健壮性

随机数类Rand:将有关随机数的函数封装成类Rand

【测试数据】

运行测试程序时,屏幕显示如下:

请输入矩阵阶数:1000

用时:27.109秒

是否继续(y,n) ? y

请输入矩阵阶数:600

用时:5.187秒

是否继续(y,n) ? y

请输入矩阵阶数:1001

阶数太大了!

请按任意键继续……

【课题 2】“21点”纸牌游戏(2人)

【基本要求】

“21点”是一个古老的扑克牌游戏,游戏规则是:各个参与者设法使自己的牌达到总分21而不超过这个数值.扑克牌的分值取他们的面值.A充当1分或者11分(由玩家自己选择一种分值),J、Q和K人头牌都是10分。

庄家对付1~7个玩家,在一局开始时,包括庄家在内的所有参与者都有两张牌。玩家可以看到他们的所有牌以及总分,而庄家有一张牌暂时是隐藏的。接下来,只要愿意,各个玩家都有机会依次再拿一张牌。如果某个玩家的总分超过了21(称为“引爆”,)那么

这个玩家就输了。在所有玩家都拿了额外的牌后,庄家就显示隐藏的牌。只要庄家的总分等于或小于16,那么他就必须再拿牌。如果庄家引爆了,那么还没有引爆的所有玩家就将获胜,引爆的玩家成为平局。否则,将余下的各玩家的总分与庄家的总分比较,如果玩家的总分大于庄家的总分,则玩家货胜。如果二者的总分相同,则玩家与庄家打成平局。

【测试数据】

编写程序实现游戏,计算机作为庄家,1~7个人作为普通玩家参与游戏,游戏程序运行输出如下所示。

多少人参加游戏?(1~7):2

输入第一位玩家的姓名:张三

输入第二位玩家的姓名:李四

游戏开始

庄家:<隐藏>梅花7

张三:红桃7方块J总分值17

李四: 红桃J红桃3总分值13

张三,你想再要一张牌吗(y,n)?n

李四,你想再要一张牌吗(y,n)?y

李四: 红桃J红桃3梅花10 总分值23

李四引爆!

庄家:方块10 梅花7总分值17

张三,唉,你打平局!

李四,对不起,你输了!

你想再玩一次吗(y,n)?

【课题 3】皇后问题。(2人)

【基本要求】

在n×n格的国际象棋上摆放n个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上,问有多少种摆法。

【测试数据】

n=8

显示所有的解。

【课题 4】分数计算器。(2人)

【基本要求】

定义分数类,可以对分数类对象的各种操作进行重载运算。表达式中可含有加、减、乘、除运算符以及实型数据的运算对象,并计算出结果显示出来。程序可以直接输入数学表达式,不需要任何转换,就可以直接输出数学四则运算和逻辑运算的结果。并且操作简单、界面清晰、灵活、实用、方便等要求出发,它所能完成的主要计算功能有以下几个方面:加法,减法,乘法,除法。

【测试数据】

依次输入的分数有:2/8 2/3 2/5 5/2 11/15 0/1 1/0

【课题 5】无符号大整数计算器。(2人)

【基本要求】

为无符号大整数定义一个类。无符号大整数用字符数组存储各位数字,将类命名为UnsignedBigInt。重载输入和输出运算符>>和<<。无符号大整数以1234567890,123456780688这样的形式输入和输出。注意输入时包含有正负号,所以必须支持像+1234567890,-123456780688这样的输入。重载以下运算符,使他们能正确支持UnsignedBigInt类型:+、-、*、/。仿照计算机的运算过程,采用计算器方式进行有关分数运算。

【测试数据】

输入一个无符号大整数:16988

当前结果:16988

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:+

输入一个无符号大整数:51980

当前结果:68968

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:*

输入一个无符号大整数:198

当前结果:12555674

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:/

输入一个无符号大整数:7

当前结果:1793667

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:=

当前结果:1793667

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:C

当前结果:0

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:X

Press any key to continue

【课题 6】电话号码簿。(4人)

【基本要求】

设计一个利用文件处理方式实现的电话号码薄的程序,具有增加数据、删除数据、更新数据、查询数据及显示全部数据的功能。每个电话号码包括姓名、电话信息项。其中姓名作为关键字,保证姓名不能重复,删除更新查询时根据输入姓名进行删除更新及查询,更新时仅更新电话号码。程序运行时从文件中读取所有人员电话号码薄信息,程序结束前将当前所有人员电话号码信息再写入到文件中。

【测试数据】

请选择:

1.增加数据 2.更新数据 3.查询数据 4.删除数据5.全部数据 6.退出

1

输入姓名:李倩

输入电话号码:8885921

插入成功!

请选择:

1.增加数据 2.更新数据 3.查询数据 4.删除数据5.全部数据 6.退出

3

输入姓名:李倩

李倩8885921

请选择:

1.增加数据 2.更新数据 3.查询数据 4.删除数据5.全部数据 6.退出

2

输入姓名:李涛

查无此人!

请选择:

1.增加数据 2.更新数据 3.查询数据 4.删除数据5.全部数据 6.退出

2

输入姓名:李倩

输入电话号码:8885922

更新成功!

请选择:

1.增加数据 2.更新数据 3.查询数据 4.删除数据5.全部数据 6.退出

5

姓名电话

李倩8885922

王鹏130********

张贺8885960

请选择:

1.增加数据 2.更新数据 3.查询数据 4.删除数据5.全部数据 6.退出

4

输入姓名:李倩

删除成功!

【课题 7】公司员工管理。(4人)

【基本要求】

设计一个虚基类Staff(员工),包含编号、姓名和年龄保护数据成员以及相关的成员函数;由Staff派生出销售员类Salesman,包含销售额保护数据以及相关的成员函数;再有Staff派生出经理类Manager,然后由Salesman和Manager类派生出销售经理类SalesManager。设计一个利用文件处理方式对公司人员进行管理,具有数据增加、删除数据、更新数据、查询数据以及重组文件的功能。要求将公司人员信息存储在数据文件staff.dat中,为存储方便,可以定义索引文件,在索引文件中,每一项包括删除标志、编号、记录在数据文件staff.dat中的相对位置和人员类型,使用索引对数据文件进行定位操作。

【测试数据】

1.增加数据 2.更新数据 3.查询数据 4.删除数据5.重组文件 6.退出类似题7。

【课题 8】扩展C++。(8人)

【基本要求】

通过创建一个译码器,交C++程序员的想法转换成为实际的C++代码,在程序的控制之下将试验结构转换为等价的C++代码,使用这种“提前预处理器”可以向C++加入使用预处理器宏很难实现甚至不可能实现的特性。包括:

Foreach循环:用来处理需要按照严格的顺序从头到尾遍历数组的元素;

Cases语句:允许程序指定一个值的范围来与switch表达式匹配;

Repeat/until循环的实现。

【测试数据】

输入源程序:

program example1;

var

a,b,c:integer;

x:char;

begin

x:=2+3* 8;

c:=2

for a:= 1 to 3 do b:=c+1;

end.

能在C++中运行。

【课题 9】石头-剪刀-布游戏。(1人)

【基本要求】

编程模拟剪刀、石头、布的游戏。用s表示尖刀,r表示石头,c表示布。规则为剪刀剪布,布包石头,石头砸剪刀。游戏者输入自己的选择,计算机随机做出一个选择,判断两个选择赢家是谁。

【测试数据】

首先游戏者输入一个字符(’s’,’r’,’c’)存于变量a中,计算机随机生成0,1,2之间的一个随机数,利用情况语句将0,1,2表示为(’s’,’r’,’c’)存于变量b中,然后利用情况语句嵌套进行判断,决出胜负(情况语句嵌套:情况语句中又有情况语句

随机产生数的方法:定义一个整型变量tRandomize;t:=random(3) )

【课题 10】骰子游戏。(1人)

【基本要求】

每个骰子有6面,这些面包含1、2、3、4、5、6个点,投两枚骰子之后,计算点数之和。如果第一次投的点数和为7或11,则游戏者获胜;如果第一次投的点数和为2、3或12,则游戏者输;如果第一次投的点数和为4、5、6、8、9或10,则将这个和作为游戏者获胜需要掷出的点数,继续投骰子,直到赚到该点数时算是游戏者获胜。如果投掷7次仍未赚到该点数,则游戏者输。

【测试数据】

设置一个枚举型变量gameStatus来跟踪这个状态,游戏者获胜时,将gameStatus置为WON,游戏者失败时,将gameStatus置为LOST,否则游戏不能结束,需通过再次投掷确定胜负,先将gameStatus置为CONTINUE,同时,将sum保存在myPoint中,在后续的while循环中,再次调用rollDice产生新的sum,当sum等于myPoint时,将gameStatus 置为WON,如果又投掷了7次,sum仍未等于myPoint,则将gameStatus置为LOST。在程序的最后,根据gameStatus的值,打印胜负结果。

【课题 11】武士巡逻问题。(1人)

【基本要求】

在西洋棋中的武士与象棋的马相似,走的是L型的路,请用非递归的程序,输入一个

表示棋盘大小值的n,在输入一个起点的坐标,找出一条从那一个起点,可以让武士棋走完n^2格而不重复的路径。

【测试数据】

在棋盘各个格子都定义成EMPTY。因为一共有n*n个格子,所以依着武士棋第一步、第二步、第三步、、、、第n*n步的顺序,在对应的格子中填入0,1,2,3,、、、n*n-1,因此在最后输出的时候,跟着这些数值就可以顺序走一次了。在走棋盘时会一再的尝试,并且做回溯的工作,因此用一个堆栈来保存到目前为止所经过的各个格的坐标,以及从这一格到下一格所使用的方向。这个堆栈实际上是三个数组,Path-x[] Path-[]存放格子的坐标,direction[]存放时用的方向,top指出堆栈最顶上元素何在,在开始时它的值是-1。

【课题 12】复数计算器(2人)

【基本要求】

为复数定义一个类,设计一个小型复数计算器,实现复数的设置和现实;实现附属加减乘除功能;实现用运算符==进行复数的相等比较,并显示比较结果。

【测试数据】

2,2+2i,2-3i,5i,-8i,i,-i

【课题 13】带符号大整数计算器(2人)

【基本要求】

为无符号大整数定义一个类。无符号大整数用字符数组存储各位数字,将类命名为UnsignedBigInt。

重载输入和输出运算符>>和<<。无符号大整数以1234567890,123456780688这样的形式输入和输出。注意输入时包含有正负号,所以必须支持像+1234567890,-123456780688这样的输入。重载以下运算符,使他们能正确支持UnsignedBigInt类型:+、-、*、/。

仿照计算机的运算过程,采用计算器方式进行有关分数运算。

【测试数据】

输入一个无符号大整数:16988

当前结果:16988

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:+

输入一个无符号大整数:51980

当前结果:68968

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:*

输入一个无符号大整数:198

当前结果:12555674

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:/

输入一个无符号大整数:7

当前结果:1793667

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:=

当前结果:1793667

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:C

当前结果:0

请选择【加、减、乘、除、等于、清零和退出(+、-、*、/、=、C、X)】:X

Press any key to continue

【课题 14】万年历(2人)

【基本要求】

显示公元后任何年份的日历,日历以月份顺序排列,每月以星期顺序排列,类似与一般挂历上的格式。程序实现3个功能:显示某一年的每一个月的日历、显示某一年某一个月的日历以及查询某一天是星期几。

【测试数据】

【课题 15】音像店(4人)

【基本要求】

用编一个C++编一个音像店的管理的程序,有顾客查询、管理人员查询、管理人员添加等功能。

【测试数据】

在出租影碟时,首先由用户输入片名,然事在影碟库文件中查找是否存在此影碟,如果有此影碟,并且副本数大于0,则将影碟副本数减1,租出影碟,租出影碟成功,否则租出影碟失败。

在归还影碟时,首先由用户输入片名,然事在影碟库文件中查找是否存在此影碟,如果有此影碟记录,则将影碟副本数加1,归还影碟成功,否则归还影碟失败。

【课题 16】销售公司员工管理(4人)

【基本要求】

设计一个虚基类Staff (员工),包含编号、姓名和年龄保护数据成员以及相关的成员函数;由Staff 派生出销售员类Salesman ,包含销售额保护数据以及相关的成员函数;再有Staff 派生出经理类Manager ,然后由Salesman 和Manager 类派生出销售经理类SalesManager;设计一个利用文件处理方式对公司人员进行管理,具有数据增加、删除数据、更新数据、查询数据以及重组文件的功能;要求将公司人员信息存储在数据文件staff.dat 中,为存储方便,可以定义索引文件,在索引文件中,每一项包括删除标志、编号、记录在数据文件staff.dat 中的相对位置和人员类型,使用索引对数据文件进行定位操作。

【测试数据】

数据请自己添加。

【课题 17】扩展C++新特征(2人)

进一步扩展C++新特征:breakon语句,当某条件为true 时打断一个循环;ignore 语句,当碰到某个值时,它引起循环的提前迭代,实际是改进型的if … continue。

【测试数据】

数据请自己添加。

【课题 18】超市密码存储箱系统(2人)

【基本要求】

在大中型超市门口一般都放置有很多存放包的箱子,顾客可以将不能带入超市的物品暂存在里面,购物结束后在取回。顾客使用箱子的整个流程为“按“存”按钮“——“找到空箱子,产生密码”(系统完成)——“打印密码,打开箱子”(系统完成)——“取密码纸存包,并关闭箱子,入超市购物”——“购物结束”——“输入密码”——“找到对应的箱子并打开”(系统完成)——“取包”。现要求设计程序模拟以上系统完成如下功能:

(1)界面:在模拟系统中,箱子在屏幕上被画出,并编号,空箱为蓝色,被使用时变为红色,再变为空后恢复蓝色。

(2)设计菜单,用数字键选择使用菜单,按“1”表示存,按“2”表示取

(3)当空箱子被顾客申请得到时,系统自动生成6位密码,此密码不能与正在使用的任何一个箱子的密码相同。

使用某种数据结构实现该程序。

【测试数据】

数据请自己添加。

【课题 19】员工通讯录管理系统(2人)

【基本要求】

编写一个通讯录管理系统。以把所学数据结构知识应用到实际软件开发中去。设计内容:本系统应完成一下几方面的功能:1输入信息——enter2显示信息———display 3查找以姓名作为关键字———search 4删除信息———delete 5存盘———save 6装入———load 设计要求:1每条信息至包含:姓名(NAME )街道(STREET)城市(CITY)邮编(EIP)国家(STATE)几项2作为一个完整的系统,应具有友好的界面和较强的容错能力3上机能正常运行,并写出课程设计报告. 3.12 详细功能如下: A添加: 系统将提示用户输入新添加人员信息输入到文件中人员信息数据包括姓名(name)街道(street)城市(city),邮编(eip)国家(state). B删除: 首先由用户输入要删除的人员的姓名然后调用删除函数删除该人员的所有相关资料. C显示所有人员信息: 该功能将显示已经保存的所有人员的姓名街道城市邮编及国家. D查询: 可由用户输入要查找的人员姓名然后系统用查找函数查找接着系统 2 使用相关文件命令输出所查找的人员的全部信息. E退出系统关闭。

【测试数据】

数据请自己添加。

【课题 20】约瑟夫环问题(2人)

古代某法官要判决N个犯人的死刑,他有一条荒唐的法律,将犯人站成一个圆圈,从第S个人开始数起,每数到第D个犯人,就拉出来处决,然后再数D个,数到的人再处决———直到剩下的最后一个可赦免。发展的约瑟夫的描述:古代某法官要判决N个犯人的死刑,但这N个人每人持有一个密码,他有一条荒唐的法律,将犯人站成一个圆圈,法官先给出一个密码M,从第S个人开始数起,每数到第M个犯人,就拉出来处决,再根据这个人所持有的密码F,然后再数F个,数到的人再处决,以此类推———直到剩下的最后一个可赦免。

【测试数据】

数据请自己添加。

【课题 21】模拟蜗牛爬树(2人)

【基本要求】

设树高为h米,从树底爬到树顶。每爬n米后下滑m 米(到树顶不再下滑),在树上每隔一米有一个标志。

设计程序模拟整个过程,并统计在整个爬树过程中,蜗牛经过每个标志各多少次。

【测试数据】

数据请自己添加。

【课题 22】表达式求值问题(2人)

【基本要求】

实现一个对算术表达式求值的模拟程序。

该演示程序具有如下基本功能:

(1) 表达式输入,以字符序列的形式从终端输入一个语法正确的数值表达式(float型),且表达式中只含有+、-、*、/、( 、)6 种运算符,输入格式如下:

<变量><运算符><变量>……<回车>

例如表达式:

100+(15/3)*2

输入格式为:

100+(15/3)*2<回车>

注意:

输入的表达式中间不含空格。

(2) 表达式结果的输出,输出形式为:

<表达式> = <结果>

例如表达式:

100+(15/3)*2

输出形式为:

100+(15/3)*2 = 110

注意:

此处的输出结果为整个表达式的数值结果。

(3) 数据合法性检验

主要是针对原表达式中除数为0 的情况。

【测试数据】

数据请自己添加。

【课题 23】迷宫问题(2人)

【基本要求】

一个以链表作存储结构的栈类型,然后编写一个求解迷宫的非递归程序。求得的通路以三元组(i,j,d)的形式输出,其中:(i,j)指示迷宫中的一个坐标,d表示走到下一坐标的方向。如:对于下列数据的迷宫,输出的一条通路为:(1,1,1),(1,2,2),(2,2,2)(3,2,3),(3,1,2)……

【测试数据】

迷宫的测试数据如下:左上角(1,1)为入口,右下角(9,8)为出口。

0 0 1 0 0 0 1 0

0 0 1 0 0 0 1 0

0 0 0 0 1 1 0 1

0 1 1 1 0 0 1 0

0 0 0 1 0 0 0 0

0 1 0 0 0 1 0 1

0 1 1 1 1 0 0 1

1 1 0 0 0 1 0 1

1 1 0 0 0 0 0 0

【课题 24】八皇后问题(2人)

【基本要求】

在8X8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上,问有多少种摆法。

【测试数据】

数据请自己添加。

【课题 25】通用函数曲线作图(2人)

【基本要求】

利用计算机绘制各种函数曲线,编制一个通用函数曲线作图程序,使用时用户只需输入欲绘制函数曲线的表达式及必要的坐标参数,计算机即可自动绘制出相应的曲线,无论如何修改函数表达式,都不需改动程序。要求程序输出,并根据屏幕输入函数表达式显示相应的曲线。

提示:找到表达式(字符串)转换成计算机操作序列的方法。

【测试数据】

数据请自己添加。

【课题 26】行编辑程序(2人)

【基本要求】

一个简单的行编辑程序的功能是:接受用户从终端输入的程序或数据,并存入用户的数据区。允许用户输入出错时可以及时更正。可以约定#为退格符,以表示前一个字符无效,@为退行符,表示当前行所有字符均无效。

【测试数据】

数据请自己添加。

【课题 27】保龄球记分系统(2人)

【基本要求】

保龄球一局分10轮,每轮可按球一次或多次,以击倒的球数为依据得分。

一局得分为10轮得分之和,而每轮的得分不仅与本轮滚球情况有关,还可能与后续一两轮的滚球情况有关。即某轮某次滚球击例的球数不仅要记入本轮得分,还可能记入前一两轮得分。具体的滚球规则和记分规则如下。

(1)若一轮的第一次该球就击倒10个球,则本轮不再滚球(若是第10轮则还需另加两次滚球),该轮的得分为本次击倒球数10与以后两次滚球所击倒的球数之和。

(2)若某一轮的第一次滚球未击倒10个球,则可对剩下的球再击一次。如果两次击倒10个球,则本轮不再滚球(若是第10轮则还需另加一次滚球),该轮的得分为本次击倒球数10与下一次滚球所击倒的球数之和。

(3)若某一轮的两次滚球未击倒10个球,则本轮不再滚球。该轮的得分为本轮击倒的球数。

实现要求:程序要求输出10轮中各轮的第一次得分和第二次得分,以及各轮得分和总分。

程序设计思想程序交互地逐轮输入一次滚球击倒的球数ball1和ball2,计算该轮得分score和累计得分total。为记录因一轮击倒10个球,还暂时不能计算该轮的得分和累计总分的情况,程序引入变量frame,用来记录当前已完成完整计算的轮次,程序每输入一次滚球击倒球数,就检查还未完成完整计算的轮次,并计算之。

【测试数据】

数据请自己添加。

【课题 28】文学研究辅助程序(2人)

【基本要求】

设计一个文学研究辅助程序,统计小说中特定单词出现的频率和位置。

【测试数据】

数据请自己添加。

【课题 29】职工工资管理系统(2人)

【基本要求】

实现一个职工工资管理系统,计算职工当月工资并存档。公司内有5种不同类型的职

工:技术人员、销售人员、文秘、技术经理和销售经理,他们的工资计算方式各不相同。技术人员的工资根据当月工作的小时数来定,时薪为35元;销售人员的工资则是根据本人当月销售额来确定,工资为销售额的5%;文秘有4000元的基本工资,奖金视当月工作情况而定;技术经理和销售经理都有6000元的固定工资,技术经理的工作业绩可分为3个等级,每级可以获得1000元奖金,销售经理的奖金由他所管理的销售员的销售业绩而定,为总销售额的0.2%。

【测试数据】

数据请自己添加。

【课题 30】QQ即时通讯系统(4人)

【基本要求】

①客户端要求:显示在线用户,好友上下线状态显示,用户注册,发送图片和文件,保存聊天记录到文件里,删除好友,查找好友,添加好友,建立聊天群;②服务器端:接受每个用户的信息进行判断,通守号码区别每个用户,把新用户的信息保存到数据库里,能够处理客户发来的各种信息,能够处理用户和好友的关系,能给在线用户发送新闻、附件等信息。

【测试数据】

数据请自己添加。

【课题 30】资产管理系统(4人)

【基本要求】

①系统登录,固定资产增加管理,资产变动管理,资产清查管理,查询;②用户权限管理,日志管理,资产分类管理,资产负责人管理,存放地点管理,资产数据库备份管理。

【测试数据】

数据请自己添加。

【课题 31】FTP服务器系统(4人)

【基本要求】

①客户端:连接服务器,上传文件,下载文件;②后台:启动FTP服务,验证用户合法性,完成相关用户文件服务请求。

【测试数据】

数据请自己添加。

【课题 32】考勤管理系统(4人)

【基本要求】

①权限设置,简单部门、人员管理,班次设置;②考勤刷卡记录的导入,计算考勤结果,考勤结果查询。

【测试数据】

数据请自己添加。

【课题 33】银行业务处理模拟平台(10人)

This is a simulation of a set of customer operations at a bank. It is intended to implement and test various transactions. There is no user input into the program. All of the operations are automated. There are no visual elements to the program. The entire program runs using a console window. All output will be text based and directed towards the console window.

This is an individual project and no group work is permitted.

Do not diverge from the assignment specification. If you do not conform to the assignment specification then you will lose marks. If you do want to make some addition to the application and you are unsure whether the change will break the specification then check it with me first.

The format of the program output is given in the specification. You must adhere to this format. Example output is given at the end of the assignment. You can therefore test your output against the expected output.

Plagiarism

?You will be held responsible if someone copies your work - unless you can demonstrate that have taken reasonable precautions against copying.

Learning Outcomes

?Make an informed choice of implementation method for a given problem (e.g. procedural, console, event-driven, object-oriented etc.)

?Implement and document a structured program to meet a given specification

?Select and apply appropriate data structures and algorithms to a given problem

?Critically evaluate a computer program with regard to robustness, usability, maintainability, readability and efficiency

Project Files

This assignment has three associated files:

?There is a data file. The file can be found inside the module page on Web-CT. The file is called "customers.txt". The data file is an ASCII file containing data about the current customers of the bank.

?There is code which you must use to generate random numbers. The code is given in “Random.cpp”.

?There is a style guide. The style guide can be found inside the module page on Web-CT. The file is called "style guide.doc".

Deliverables

?Note that the program includes a random number generator. The seed for the generator is read from the file "seed.txt".

?CD, or other electronic format containing:

o Executable program of your solution

o All the source and project files required to build the executable. The project must be set up to run in Visual Studio 2005 or 2008.

?All files should be sensibly named and in working order

?The data file should be placed into the working directory so that I can just run the program.

? A printed report about your program.

?Testing strategy and results. This can be submitted in electronic format. However, you must also include a written report describing your test strategy and analysis of results.

?UML Class diagram of your program.

Description

?You are required to implement a simulation of a bank and six customers. Three of the customers are private customers. Three of the customers are business customers.

?Each customer has an id, a name, the value of their current account and the value of their savings account.

The initial data for the customers is given in the following table:

?The initial data for all of the accounts is given in “customers.txt”.

?I will test your program with different data. So ensure that you fully test a range of values with your application.

?The first test occurs发生before the simulation proper begins. This is a simple test of removing and adding a customer to the bank:

o Customer 32 ("Penny") closes her account.

o Immediately after this a new customer ("Betty") opens a private account with an initial deposit of £4000 in her current account and £3000 in her savings account. Her bank id will be 1.

?The simulation runs over 20 rounds.

?In each round one transaction occurs. A transaction will be performed by one customer. The transactions include such things as deposit money into a savings account, create a standing order and withdraw money from a current account.

?Every 10 rounds there will be bank phase, i.e. after round 10 (but before round 11) and after round 20. During this phase the bank will apply interest charges to all of the accounts. If any standing orders exist then these are applied and monies transferred from one account to another.

?In each round a number between 1 and 6 is generated. This is the bank id of the customer who will perform the transaction.

?Assume that the bank has unlimited funds.

? A customer may go "into the red", i.e. their balance can be negative.

?The application is run as a simulation requiring no user input.

?Run the simulation for only 20 rounds.

?For each transaction a number between 1 and 6 is generated. This will be used to select the type of transaction to be performed.

?When the application is started, a welcome message is displayed. The format of the message is: 'Welcome to My Bank'

?For each round, the id and name of the customer is given. Output the message:

'Customer : '

?On the next line the generated number and the name of the transaction are displayed. Output the message: 'Transaction : '

?When a customer deposits money into their current account the following happens:

o Add £100 to their current account.

?When a customer withdraws money from their current account the following happens:

o Subtract £100 from their current account.

?When a customer deposits money into their savings account the following happens:

o Subtract £100 from their current account.

o Add £100 to their savings account.

?When a customer withdraws money from a savings account the following happens:

o Subtract £100 from their savings account.

o Add £100 to their current account. ??当应用程序启动时,一个值得欢迎的消息显示。该邮件的格式是:

?When a customer pays monies they are immediately transferring money from their current account to the current account of one of the other customers. Generate a number between 1 and 6 to say which current account the customer will be paying into. Obviously a customer should not pay money to him or herself, so carry on generating numbers until you obtain a valid id. The following then happens: o Subtract £100 from the current account of the customer performing the transaction.

o Add £100 to the current account of the customer to whom they are making payment.

?When a customer creates a standing order they commit themselves to paying £100 from their current account to a business current account during each bank phase. Generate a number between 4 and 6 to say which business current account the customer will be paying into. Obviously a business should not pay money to itself, so carry on generating numbers until you obtain a business other than the one setting up the standing order.

? A customer can have multiple standing orders with a business. (This will simplify the simulation).

?At the end of each transaction you must output the message:

' has 'Current: £. Savings: £?

?The bank treats private and business accounts differently. Every transaction that a business account makes, incurs a cost of £5 from the customer's current account. There are benefits to having a business account, but these are outside the scope of the current scenario and can be ignored.

Bank Phase

?The bank phrase happens after every 10 rounds.

?Display the account details of all of the customers. For each customer first output the id and name of the customer. Output the message:

'Customer : '

?On a new line output the account details. Output the message:

'Current: £. Savings: £?

?Implement all of the standing orders. For every standing order that a customer has pay £100 from their current account to a current account of the appropriate business. Output each of the standing orders that a player has:

'Standing order with ?

?If a savings account is negative then transfer monies from the current account to bring the savings account back up to £0. Do this even if it takes the current account below 0.

?If a savings account is positive then provide interest at a rate of 1%. In other words, calculate 1% of the amount and then add this to the savings account.

?If a current account is positive (or zero) then it is left untouched.

?If a current account is negative then charge interest at a rate of 2%. In other words, calculate 2% of the amount and then subtract this from the current account.

?Display the new account details of all of the customers. For each customer first output the id and name of the customer. Output the message:

'Customer : '

?On a new line output the account details. Output the message:

'Current: £. Savings: £?

Number generation

?There is a code file labelled “random.cpp” This implements a function called “Random”. Random returns

a randomly generated number in the range 1 to top. where top is an integer passed to the function.

?Random number generators only generate a pseudo-random sequence of numbers. If the generator is seeded with the same number then an identical sequence of numbers is generated.

?The seed for the random number generator is read from the file "seed.txt".

?The use of a seed will allow me to check your work against a known number sequence.

?I will supply you with examples of output using a particular seed. Seed the generator with the given number and the simulation will be exactly the same each time. You can use the examples of output to test your program.

The pound symbol

?The pound symbol was not defined in the original ASCII code. Output can depend on the computer system. The following works on my machine:

const char POUND = 156;

?If this doesn't work then try a value of 35 or 163. Substitute the hash symbol for the pound symbol if you are completely unable to get the pound symbol to output.

Report

?You need to write a report about the program. The report must be succinct and to the point. The report is not a story. The report is not a chronological record of the process of development. The maximum size of the report is 800 words (about two sides of A4). A single side of A4 would be sufficient with around 300 words.

?The report will state:

?What grade you expect to get

?Explain the operation of the program (what was done in the final implementation of the program).

?Any known bugs.

?Advantages and disadvantages of the data structures used and possible alternatives (for a first classification only).

Testing

?You need to write a comprehensive and clear testing strategy which complements your program.

?The testing strategy should perform all of the possible sensible tests with your code.

?The testing strategy should clearly describe the test and the final test results.

?You do not need to include intermediate test results, i.e. from previous builds.

?You are required to implement unit testing. You should test methods and classes on their own, i.e.

independent of the rest of the program. The tests should check that the methods and classes are correct.

?Testing results can be submitted in electronic format. This would include the results of unit testing.

相关文档
最新文档