Starting from:

$25

CPD-Exercise 7 solved

 After the examination, the teaching assistants need to enter the scores of the test paper into  the system.  Let's write a program that can sort data of the exam paper to match the student  list on the course system.

 Due to the school restrictions, the maximum size of class is  40 students. First, the users can  choose how many records they want to key in. Then, they can start to input the student's ID  and the score of the exam one by one. After typing happily, the program needs to sort the  input data by the student ID in the ascending order and then display the sorted results.  You  can use any method to sort . Moreover, please  add the comments in the code to explain  the sorting process you implemented .  For example, if you use one of the greedy methods,  the comments you write in the program would be lik “...go through the list of data to find the  smallest value and return it, then look for the second smallest value...until the largest value is  visited”.

 The table below shows the example input and output. The underscored number is the input  from users.  Notice: Please use “  \t ” to generate intervals    in the output format. 

 Input
 Output
Number of records you want to key in:                                        3 

Enter ID & score:   12345 75 

Enter ID & score:   45678 50 

Enter ID & score:   12344 10 
 ID      score 

12344       10 

12345       75 

45678     50 
Number of records you want to key in:                                        5 

Enter ID & score:   123 11 

Enter ID & score:   256 88 

Enter ID & score:   456 77 

Enter ID & score:   804 33 

Enter ID & score:   410 10 
 ID      score 

123      11 

256      88 

410      10 

456      77 

804      33 
Number of records you want to key in:                                        5 

Enter ID & score:   123 1 

 Enter ID & score: 201 10 

Enter ID & score:   121 1 

Enter ID & score:   103 6 

Enter ID & score:   307 8 
 ID      score 

103      6 

 121     1 

123      1 

201      10 

307      8 
 

More products