Advertisement
Guest User

Untitled

a guest
May 16th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. The program developed for Assignment 1D appeared to be interesting to the President of a Cricket Board. The President has now requested you to extend your program so that it also asks for the name of each batsman. For example, at the beginning of the match the program will ask the name of the batsman at the striker end and the name of the batsman at the non-striker end. The program should also keep track of runs for each batsman. It will also change the batsman at the striker end appropriately. For example, the score of an odd number of runs (say 3 runs) will cause a change of batsman at the striker end. Moreover, the end of an over (6 balls) will also change the batsman at the striker end. Additionally, in this program you do not need to worry about "extras" that is the runs that do not belong to any batsman.
  2.  
  3. The program will continue to ask the runs for each ball, as it did for Assignment 1D. Do not promt a message like "Enter a run: " for each ball.
  4.  
  5. If an opening batsman is out the program should ask for the name of another batsman. The same process will continue until the team loses 10 wickets or finishes the maximum number of overs.
  6.  
  7. The program will also do the same task for Team B. An extra termination condition of the loop for Team B is that if the the running total score of Team B exceeds the total score of Team A.
  8.  
  9. The program will also store the total score of each batsman. The name of each batsman and his score will be stored in lists. At the end of the match the score of each batsman and their names (for both teams) will be collected from the lists, and will be stored in a text file called score_card.txt. Finally, the program will read the score_card.txt file and display it.
  10.  
  11. A partial example of a score_card.txt file is as follows. In this example the score card of only one team has been shown.
  12.  
  13. Team A:
  14. E Cowan 74
  15. D Warner 180
  16. S Marsh 11
  17. R Ponting 7
  18. M Clarke 18
  19. M Hussey 14
  20. B Haddin 0
  21. P Siddle 30
  22. R Harris 9
  23. M Starc 20
  24. B Hilfenhaus 6
  25. TOTAL 36
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement