MATH QUIZ java

木其工作室 qq:928900200

ITE3101-Introduction to Programming Assignment (14/15) Ver. 1.0 (last updated: 22-Oct-2014) ITE3103 Programming Assignment v1.0 Page 1 of 5 Last updated: 3Oct14 Deadline: 5-Dec-2014 (Friday), 13:30 Instructions to Students 1. This assignment should be done by each individual student. 2. Plagiarism will be treated seriously. All assignments that have been found involved wholly or partly in plagiarism (no matter these assignments are from the original authors or from the plagiarists) will score Zero marks. You may be asked some random questions on your program to verify that your submission is your own work. 3. Your program must use JDK 1.6 or above to develop. 4. Your program must be structured and well documented. The first few lines in the source file must be a comment block stating the name of the source file, your name, course, class, and student ID. Marks will be deducted if such comments are not included. 5. You are required to hand in the following: a. Program codes .java file(s) (softcopy) b. Documentations (softcopy) on the program i. Evidence of testing (e.g. screen captures of test cases). ii. A simple User Guide for your program. 6. The source code filename should be MathQuiz.java. 7. Zip all your files and submit to moodle.vtc.edu.hk on or before the deadline. LATE SUBMISSION IS NOT ACCEPTED. 8. Weight of this Assignment: 20% of Total Assessment. MATH QUIZ Distribution of marks: 70% for program codes 10% for checking input errors and giving suitable messages to the user 10% for the evidence of testing 10% for the User Guide Problem Specification You are asked to design and develop a Java Program that randomly generates simple Math questions and display the mark of a quiz. The program is divided into 5 major steps. Step 1: Display a Main Menu and Prompt the Question Type When the program starts, a Main Menu will be shown as follows: Welcome to Math Quiz ==| Main Menu |== A) Square Root B) Maximum Prime Number C) Highest Common Factor (HCF) D) Random Questions in (A)-(C) Q) Quit Option: _ Figure 1. Main Menu ITE3101-Introduction to Programming Assignment (14/15) Ver. 1.0 (last updated: 22-Oct-2014) ITE3103 Programming Assignment v1.0 Page 2 of 5 Last updated: 3Oct14 You have to handle the following user inputs: User Input Action 'A' or 'a'  Proceeds to Step 2  Generated Square Root questions in Step 3  Example: Q1: the square root of 16 = … Q5: the square root of 4 = 'B' or 'b'  Proceeds to Step 2  Generated Maximum Prime Number questions in Step 3  Example: Q1: the maximum prime number small than or equal to 25 = … Q7: the maximum prime number small than or equal to 99 = 'C' or 'c'  Proceeds to Step 2  Generated HCF questions in Step 3  Example: Q1: the HCF of 16 and 24 = … Q3: the HCF of 99 and 81 = 'D' or 'd'  Proceeds to Step 2  Randomly generated types 1 to 3 questions in Step 3  Example: Q1: the HCF of 16 and 24 = Q2: the square root of 16 = … Q10: the maximum prime number small than or equal to 88 = 'Q' or 'q'  Display a “Good-Bye” message and quit the program Step 2: Prompt the Number of Questions After selecting the type of questions in Step 1, the user should enter the number of questions as follows: Number of Questions: _ Figure 2. Number of Questions For example, if the user enters 5, then 5 different questions of the chosen question type will be asked in Step 3. Step 3: Generate Random Questions n questions will be generated, where n is entered in Step 2. The questions generated are based on the input in Step 1. For example: If the user entered 'C' or 'c' (i.e. HCF) in Step 1 and 5 in Step 2, then 5 HCF questions will be asked in Step 3. ITE3101-Introduction to Programming Assignment (14/15) Ver. 1.0 (last updated: 22-Oct-2014) ITE3103 Programming Assignment v1.0 Page 3 of 5 Last updated: 3Oct14 Note that each question should have a question number as follows: Q1: the square root of 4 = 2 Q2: the square root of 16 = 4 … Q5: the square root of 81 = _ Figure 3. Generate Random Questions Number(s) generated in different type of questions should follow the following rules: Operator Operands Square Root The number should be 1, 4, 9, 16, 25, 36, 49, 64 or 81 Maximum Prime Number The number should be between 2 and 99 HCF Two numbers between 2 and 99 Step 4: Display the Results Your program should check the correctness of all answers entered by the user in Step 3. The result should be shown as follows: Example 1 … Q5: the square root of 4 = 2 You answered 5 questions 5 of them are correct Your mark is 100.0% Example 2 … Q3: the maximum prime number small than or equal to 25 = 23 You answered 3 questions 2 of them are correct Your mark is 66.7% The result should contain (1) how many questions have been asked, (2) how many questions are correct and (3) the percentage of correct answers (in 1 decimal place). After Step 4 is completed, the program goes back to Step 1 to display the Main Menu again. Hints: 1. Write a method to generate random numbers in a given range (i.e. start and end); this method will be called in Step 3. *** END *** 1 2 3

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值