上机练习

17
上上上上

description

上机练习. 上机练习. 编程作业 : 利用 C 或 Java 编写,个人编写,不需要小组合作。 9 个作业 + 分析 学会用计划、统计和管理的方法 对编程活动的时间统计及安排 使用规范的过程开发程序(在第十一章学习) 在编程中提高规模估计、质量估计与评价的能力 填写需要的表格(陆续会介绍到) 填写上机报告. 练习题目. 1 、输入 n 个数(实数或整数),输出其最大最小值。 2 、输入 n 个数和一个整数 K, 输出 n 个数中第 K 个最大最小值。要求有输入错误判断及相应错误 信息。 3 、输入 n 个数,用任意算法对其进行排序并按从小到大顺序输出。 - PowerPoint PPT Presentation

Transcript of 上机练习

Page 1: 上机练习

上机练习上机练习

Page 2: 上机练习

山东大学齐鲁软件学院 2

上机练习 上机练习 编程作业 :

利用 C 或 Java 编写,个人编写,不需要小组合作。 9 个作业 + 分析

学会用计划、统计和管理的方法 对编程活动的时间统计及安排 使用规范的过程开发程序(在第十一章学习) 在编程中提高规模估计、质量估计与评价的能力 填写需要的表格(陆续会介绍到) 填写上机报告

Page 3: 上机练习

山东大学齐鲁软件学院 3

练习题目练习题目 1 、输入 n 个数(实数或整数),输出其最大最小

值。 2 、输入 n 个数和一个整数 K, 输出 n 个数中第 K

个最大最小值。要求有输入错误判断及相应错误 信息。

3 、输入 n 个数,用任意算法对其进行排序并按从小到大顺序输出。

4 、输入 n 个数,用单链表(任意算法)对其进行排序并按从小到大顺序输出。

Page 4: 上机练习

山东大学齐鲁软件学院 4

练习题目练习题目 5 、对给定一个英文文本文件,统计并输出 26 个

英文字母(不区分大小写)的出现频率,并统计定冠词‘ the’ 的出现次数及频率。

6 、 任意输入一个带有 +,-,x,/ 和()的算术表达式,输出表达式的值。

Page 5: 上机练习

山东大学齐鲁软件学院 5

练习题目练习题目 7 、给定一九格图, 1-8 八个数字随机被放入其中

8 个格内,编程序在方格内移动数字,使 8 个数字在九格图周围 8 个格内顺序(逆时针,顺时针均可)排列。任一数字,只有当其周围四连通的格之一为空格时,与空格交换位置。

8 2 1

7 3 4

5 6

1 2 3

8 4

7 6 5

Page 6: 上机练习

山东大学齐鲁软件学院 6

练习题目练习题目 8.Multiple regression( 多次回归 )

Guass’s method

Page 7: 上机练习

山东大学齐鲁软件学院 7

问题描述问题描述 Suppose you had the following data on 6

projects development hours required new, reused, and modified LOC

Suppose you wished to estimate the hours for a new project you judged would have 650 LOC of new code, 3,000 LOC reused code, and 155 LOC of modified code.

How would you estimate the development hours ?

Page 8: 上机练习

山东大学齐鲁软件学院 8

Multiple regression-1

Multiple regression-1

Prog# New Reuse Modified Hours w x y z1 1,142 1,060 325 2012 863 995 98 983 1,065 3,205 23 1624 554 120 0 545 983 2,896 120 1386 256 485 88 61Sum 4,863 8,761 654 714Estimate 650 3,000 155 ???

Page 9: 上机练习

山东大学齐鲁软件学院 9

Multiple regression-2

Multiple regression-2

Multiple regression provides a way to estimate the effects of multiple variables when you do not have separate data for each.

1. You would use the following multiple

regression formula to calculate the estimated value

0 1 2 3 ( )k k k kz w x y

Page 10: 上机练习

山东大学齐鲁软件学院 10

Multiple Regression-3

2. You find the Beta parameters by solving the following simultaneous linear equations (联立线

性方程组)

0n 1 wii1

n

2 x ii1

n

3 yii1

n

zii1

n

0 wii1

n

1 wi2

i1

n

2 wix ii1

n

3 wiyii1

n

wizii1

n

0 xii1

n

1 wix ii1

n

2 x i2

i1

n

3 xiy ii1

n

x izii1

n

0 yii1

n

1 wiyii1

n

2 x iyii1

n

3 yi2

i1

n

yizii1

n

Page 11: 上机练习

山东大学齐鲁软件学院 11

Multiple Regression - 4

3. When you calculate the values of the terms, you get the following simultaneous linear equations

0 1 2 3

0 1 2 3

0 1 2 3

0 1 2 3

6 4,863 8,761 654 714

4,863 4,521,899 8,519,938 620,707 667,832

8,761 8,519,938 21,022,091 905,925 1,265,493

654 620,707 905,925 137,902 100,583

Page 12: 上机练习

山东大学齐鲁软件学院 12

Multiple Regression - 5

4. Then you diagonalize (对角化) using Gauss’ method. This successively eliminates one parameter at a time from the equations by successive multiplication and subtraction to give

0 1 2 3

0 1 2 3

0 1 2 3

0 1 2 3

6 4,863 8,761 654 714

0 580,437.5 1,419,148 90,640 89,135

0 0 4,759,809 270,635 5,002.332

0 0 0 37,073.93 9,122.275

Page 13: 上机练习

山东大学齐鲁软件学院 13

Multiple Regression-6

5. Then you solve for the Beta terms

6. The final estimate is thenz=6.71+0.0784*650+0.0150*3,000+0.2461*

155 = 140.902 hours

0

1

2

3

6.7013

0.0784

0.0150

0.2461

Page 14: 上机练习

山东大学齐鲁软件学院 14

需求需求 Given a data set which contains n groups meas

ured data as multiple variables’ values and their respective results, and one group estimated values of the multiple variables. write a program to read the data and using multiple regression and Guass’ method to calculate the estimate result corresponding to the group of the estimated values.

Page 15: 上机练习

山东大学齐鲁软件学院 15

练习题目练习题目 9.Write a program to draw an activity Gant Cha

rt. The interface is like the example in the website:

http://www.ilog.com/products/jviews/demos/ You need to install Java platform to run the exampl

e. Or you can design your interface by yourself, w

hich including the input, output formats and the functions your program provides.

Page 16: 上机练习

山东大学齐鲁软件学院 16

Page 17: 上机练习

山东大学齐鲁软件学院 17

PSP工具PSP工具 http://processdash.sourceforge.net/