12412 - A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)
来源:互联网 发布:淘宝名忘了怎么找回 编辑:程序博客网 时间:2024/05/17 07:27
Hi, I am an undergraduate student ininstitute of foreign languages. As you know, C programming is a required coursein our university, even if his/her major is far from computer science. I don'tlike this course at all, as I am not good at computer and I don't wanna evenhave a try of any programming!! But I have to do the homework in order to pass:( Sh... Could you help me with it? Please keep secret!! I know that you won'tsay NO to a poor little girl, boy. :)
Task
Write a Student Performance ManagementSystem (SPMS).
Concepts
In the SPMS, there will be at most 100students, each has an SID, a CID, a name and four scores (Chinese, Mathematics,English and Programming).
- SID (student ID) is a 10-digit number
- CID (class ID) is a positive integer not greater than 20.
- Name is a string of no more than 10 letters and digits, beginning with a capital letter. Note that a name cannot contain space characters inside.
- Each score is a non-negative integer not greater than 100.
Main Menu
When you enter the SPMS, the main menushould be shown like this:
Welcome to Student Performance ManagementSystem (SPMS).
1 - Add
2 - Remove
3 - Query
4 - Show ranking
5 - Show Statistics
0 - Exit
Adding a Student
If you choose 1 from the main menu, thefollowing message should be printed on the screen:
Please enter the SID, CID, name and fourscores. Enter 0 to finish.
Then your program should wait for userinput. The input lines are always valid (no invalid SID, CID, or name, exactlyfour scores etc), but the SID may already exist. In that case, simply ignorethis line and print the following:
Duplicated SID.
On the other hand, multiple students canhave the same name. You should keep printing the message above until the userinputs a single zero. After that the main menu is printed again.
Removing a Student
If you choose 2 from the main menu, thefollowing message should be printed on the screen:
Please enter SID or name. Enter 0 tofinish.
Then your program should wait for userinput, and remove all the students matching the SID or name in the database,and print the following message (it's possible xx=0):
xx student(s) removed.
You should keep printing the message aboveuntil the user inputs a single zero. After that the main menu is printed again.
Querying Students
If you choose 3 from the main menu, thefollowing message should be printed on the screen:
Please enter SID or name. Enter 0 tofinish.
Then your program should wait for userinput. If no student matches the SID or name, simply do nothing, otherwiseprint out all the matching students, in the same order they're added to thedatabase. The format is similar to the input format for "adding astudent", but 3 more columns are added: rank (1st column), total score andaverage score (last two columns). The student with highest total score(considering all classes) received rank-1, and if there are two rank-2students, the next one would be rank-4. You should keep printing the messageabove until the user inputs a single zero. After that the main menu is printedagain.
Showing the Ranklist
If you choose 4 from the main menu, thefollowing message should be printed on the screen:
Showing the ranklist hurts students'self-esteem. Don't do that.
Then the main menu is printed again.
Showing Statistics
If you choose 5 from the main menu, showthe statistics, in the following format:
Please enter class ID, 0 for the wholestatistics.
When a class ID is entered, print thefollowing statistics. Note that "passed" means to have a score of atleast 60.
Chinese
Average Score: xx.xx
Number of passed students: xx
Number of failed students: xx
Mathematics
Average Score: xx.xx
Number of passed students: xx
Number of failed students: xx
English
Average Score: xx.xx
Number of passed students: xx
Number of failed students: xx
Programming
Average Score: xx.xx
Number of passed students: xx
Number of failed students: xx
Overall:
Number of students who passed allsubjects: xx
Number of students who passed 3 or moresubjects: xx
Number of students who passed 2 or moresubjects: xx
Number of students who passed 1 or moresubjects: xx
Number of students who failed allsubjects: xx
Then, the main menu is printed again.
Exiting SPMS
If you choose 0 from the main menu, theprogram should terminate. Note that course scores and total score should beformatted as integers, but average scores should be formatted as a real numberwith exactly two digits after the decimal point.
Input
There will be a single test case, ending witha zero entered in the main menu screen. The entire input will be valid. Thesize of input does not exceed 10KB.
Output
Print out everything as stated in the problemdescription. You should be able to play around this little program in yourmachine, with a keyboard and a screen. However, both the input and output maylook silly when they're not mixed, as in the keyboard-screen case.
Sample Input
1
0011223344 1 John 79 98 91 100
0022334455 1 Tom 59 72 60 81
0011223344 2 Alice 100 100 100 100
2423475629 2 John 60 80 30 99
0
3
0022334455
John
0
5
1
2
0011223344
0
5
0
4
0
Output for the Sample Input
Welcome to Student Performance ManagementSystem (SPMS).
1 - Add
2 - Remove
3 - Query
4 - Show ranking
5 - Show Statistics
0 - Exit
Please enter the SID, CID, name and fourscores. Enter 0 to finish.
Please enter the SID, CID, name and four scores.Enter 0 to finish.
Please enter the SID, CID, name and fourscores. Enter 0 to finish.
Duplicated SID.
Please enter the SID, CID, name and fourscores. Enter 0 to finish.
Please enter the SID, CID, name and fourscores. Enter 0 to finish.
Welcome to Student Performance ManagementSystem (SPMS).
1 - Add
2 - Remove
3 - Query
4 - Show ranking
5 - Show Statistics
0 - Exit
Please enter SID or name. Enter 0 tofinish.
2 0022334455 1 Tom 59 72 60 81 272 68.00
Please enter SID or name. Enter 0 tofinish.
1 0011223344 1 John 79 98 91 100 368 92.00
3 2423475629 2 John 60 80 30 99 269 67.25
Please enter SID or name. Enter 0 tofinish.
Welcome to Student Performance ManagementSystem (SPMS).
1 - Add
2 - Remove
3 - Query
4 - Show ranking
5 - Show Statistics
0 - Exit
Please enter class ID, 0 for the wholestatistics.
Chinese
Average Score: 69.00
Number of passed students: 1
Number of failed students: 1
Mathematics
Average Score: 85.00
Number of passed students: 2
Number of failed students: 0
English
Average Score: 75.50
Number of passed students: 2
Number of failed students: 0
Programming
Average Score: 90.50
Number of passed students: 2
Number of failed students: 0
Overall:
Number of students who passed allsubjects: 1
Number of students who passed 3 or moresubjects: 2
Number of students who passed 2 or moresubjects: 2
Number of students who passed 1 or moresubjects: 2
Number of students who failed allsubjects: 0
Welcome to Student Performance ManagementSystem (SPMS).
1 - Add
2 - Remove
3 - Query
4 - Show ranking
5 - Show Statistics
0 - Exit
Please enter SID or name. Enter 0 tofinish.
1 student(s) removed.
Please enter SID or name. Enter 0 tofinish.
Welcome to Student Performance ManagementSystem (SPMS).
1 - Add
2 - Remove
3 - Query
4 - Show ranking
5 - Show Statistics
0 - Exit
Please enter class ID, 0 for the wholestatistics.
Chinese
Average Score: 59.50
Number of passed students: 1
Number of failed students: 1
Mathematics
Average Score: 76.00
Number of passed students: 2
Number of failed students: 0
English
Average Score: 45.00
Number of passed students: 1
Number of failed students: 1
Programming
Average Score: 90.00
Number of passed students: 2
Number of failed students: 0
Overall:
Number of students who passed allsubjects: 0
Number of students who passed 3 or moresubjects: 2
Number of students who passed 2 or moresubjects: 2
Number of students who passed 1 or moresubjects: 2
Number of students who failed allsubjects: 0
Welcome to Student Performance ManagementSystem (SPMS).
1 - Add
2 - Remove
3 - Query
4 - Show ranking
5 - Show Statistics
0 - Exit
Showing the ranklist hurts students'self-esteem. Don't do that.
Welcome to Student Performance ManagementSystem (SPMS).
1 - Add
2 - Remove
3 - Query
4 - Show ranking
5 - Show Statistics
0 - Exit
- UVa 12412 - A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)
- 12412 - A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)
- 12412 - A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)
- UVa 12412 - A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)
- UVA - 12412 A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)
- UVa 12412 A Typical Homework (a.k.a Shi Xiong Bang Bang Mang) 【模拟】
- UVa12412 - A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)
- UVA12412 A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)
- Problem 029——UVa 12412 - A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)
- UVA 12412 - A Typical Homework (a.k.a Shi Xiong Bang Bang Mang) 模拟题 不好怎么评价
- UVa 12412 - A Typical Homework
- UVA-12412A Typical Homework
- A Big Bang to Me
- [uva 12412]A Typical Homework(师兄帮帮忙)
- A Typical Homework(UVa 12412)
- zheli zhen d hen bang a
- zheli zhen d hen bang a
- UVa 12412 A Typical Homework(学生信息管理系统)
- 使用JTable组件
- 489 - Hangman Judge
- 512 - Spreadsheet Tracking
- 1339 - Ancient Cipher
- Tomcat配置虚拟主机
- 12412 - A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)
- POJ 3070 Fibonacci (矩阵快速幂 Fibonacci数列新求法)
- Activity之间数据交流(onActivityResult的用法)
- uva11518 Dominos 2
- zoj 2008 && poj 1511 Invitation Cards
- centos6.5+nginx1.7+php5.6+mysql5.6
- coreData详解
- 一般处理程序中使用Session
- Gentoo内核配置驱动篇