this is Week6's assignment......anyone who'd like to lend me a hand......thx a lot!!!!!!!
COM1010: Introduction to Programming: Assignment 7 Dr Louise Guthrie 1. Overview Any work that you hand in for this assignment must be your own work. Plagiarism will result in a mark of 0. Allowing someone else to knowingly copy your work will also result in a mark of 0, as you would be facilitating and encouraging plagiarism. The following programming exercise is intended to help you learn the Java language. The question reinforces the use of Java Standard Library, JavaDoc tool, and concepts covered in the corresponding lecture. For the assessment details, please refer to http://www.dcs.shef.ac.uk/~louise/campus_only/com1010/ 2. The programming problem 1. This question involves designing, implementing and using a class called QandA. The main program should implement a simple arithmetic game for children. It starts by asking for the name of the child. She types in her name and is then given 10 random arithmetic questions, involving addition and subtraction, where the operands and answers are all in the range 0..20. (See Math.random for a method that returns a random number.) The child should be told what the correct answer is if she gets the answer wrong. After 10 questions have been answered the player’s score is displayed, along with a relevant message, e.g. “Well done”. There should be a different message for each score out of 10 and the child’s name should be included in the message. You need to write a class called QandA that generates a single question and answer as part of the constructor. The generated question and answer could be stored as attributes of the class. A method could be supplied to retrieve the question (perhaps as a String). Another method could be supplied to retrieve the answer or, alternatively, to check a supplied answer against the one stored for the question. You must decide what are the useful attributes and methods. A tricky part is designing the algorithm to generate a question, since the operands and answers must all be in the range 0..20 As part of the handin material for this particular question you should run javadoc on your class for a question and print out the contents of the resulting Web page describing the methods. See the Sun's website http://java.sun.com/j2se/javadoc/ for documentation on JavaDoc. Example: > Java ProgName Start of program… Type in your name: Jo Hello Jo Question 1. 13 + 4 = ? Answer? 17 Good Question 2. 12 - 6 = ? Answer ? … and so on… … Question 10. 19-13 = ? Answer? 12 The correct answer is 6. You scored 7 out of 10. A good score Jo.