There is only 5 Questions All details mentioned in attached file how to do
Microsoft Word - A4.docx DPIT111 Assignment 4 Week 8-9 Objectives Get familiar with loop Get familiar with method overloading Understand recursion Assignment 3 (12%) is marked on a scale from 0-12 marks. Important notices: This assignment is scheduled to be done in Week 8-9 (Monday 24 August - Saturday 5 September 19:00). Comments for your work can be checked on Moodle site. You may be asked questions about your code. Your marks will be deducted if you could not answer the questions presented by the assessor. 1. Students must submit all assessment tasks by the due date or penalties will be applied. No. of calendar days late Penalty 1 10% of the original mark. 2 20% of the original mark. 3 30% of the original mark. More than 3 A mark of zero will be awarded for the assessment. 2. Make sure that you include following personal information in every file, otherwise it will result in 0 points. /*------------------------------------------------------ My name: My subject code: My student number: My email address: Assignment number: -------------------------------------------------------*/ 3. Ensure each file in your submission is runnable, compiling error in your file will result in 0 points for the current question. If it is runnable, though it fails to realize all functionalities, you can get partial points for what you have done. Question 1 (4 mark) : Implement a program which helps the user to do some multiplication exercises. REQUIREMENTS The user input is always correct (input verification is not required). Your code must use do-while loop. The main method asks the user to continue exercise or not, and reads the entered string, when continuing exercise, each time two random numbers [100,199] are generated as the operands of addition, the program will check whether the answer is correct or not and displays corresponding information; when finishing exercise, the number of questions asked, the number of correct answers, and the accuracy will be displayed. The accuracy shall be displayed with one decimal point precision. Your code must work as the following example (the text in bold indicates the user input). Example of the program output: Example 1: Will you continue multiplication exercises (Yes/No): No You have not answered any questions yet. Example 2: Will you continue multiplication exercises (Yes/No): Yes 111 x 165 = 4 Wrong! The correct answer is 18315. Will you continue multiplication exercises (Yes/No): Yes 149 x 178 = 5 Wrong! The correct answer is 26522. Will you continue multiplication exercises (Yes/No): Yes 121 x 135 = 16335 Correct! Will you continue multiplication exercises (Yes/No): No You have answered 3 questions (1 correct), your accuracy is: 33.3% Question 2 (2 mark) : Rewrite Question 1 with while loop. Question 3 (2 mark) Use method overloading to design two methods and call them on demand. REQUIREMENTS The user input is always correct (input verification is not required). Related length, width, side length and computation results are all assumed to be in double type. The method calculateArea() is to be overloaded. The first one takes 1 double type argument (side length) as input and returns 1 double type value (area of square), the second one takes 2 double type arguments (length and width) and returns 1 double type value (area of rectangle). The method main() is to call one of these two overloaded methods according to the user input, or report invalid input. The result shall be displayed with 2 decimal point precision. Your code must work as the following example (the text in bold indicates the user input). Example of the program output: Example 1: Which shape would you like to choose: square (S) or rectangle (R): M Your input is invalid. Example 2: Which shape would you like to choose: square (S) or rectangle (R): S Enter the side length of square: 2.55 The area of the square is about: 6.50 Example 3: Which shape would you like to choose: square (S) or rectangle (R): R Enter the length of rectangle: 2.55 Enter the width of rectangle: 1.45 The area of the rectangle is about: 3.70 Question 4 (2 mark) : Write a program called Fibonacci to produce the Fibonacci number using the following formula, where N is a positive integer number entered by the user: ?(?) = 0 , ? = 0 1 , ? = 1 ?(? − 1) + ?(? − 2), ??ℎ?????? REQUIREMENTS The user input is always correct (input verification is not required). Your code must use recursion. Your code must work exactly like the following example (the text in bold indicates the user input). Example of the program output (the text in bold indicates the user input): Example 1: Please input a positive integer number N: 5 The 5th Fibonacci number is: 5 Example 2: Please input a positive integer number N: 7 The 7th Fibonacci number is: 13 Question 5 (2 mark) : Write a program GoldenRatio that takes an integer input and computes an approximation to the golden ratio using the following formula: ?(?) = 1, ? = 0 1 + 1 ?(? − 1) , ? > 0 REQUIREMENTS The user input is always correct (input verification is not required). Your code must use recursion. Your code must work exactly like the following example (the text in bold indicates the user input). Example of the program output: Example 1: Please input a positive integer number N: 15 The GoldenRation for 15 is: 1.6180344478 Example 2: Please input a positive integer number N: 12 The GoldenRation for 12 is: 1.6180257511 Submission requirements: 1. Put each solution into a text file (.txt), and submit them to the Assignment link. The submission link is called Assignment 4 Submission under Week 8 Section on the subject Moodle site. 2. Submission via email is not acceptable without permission. 3. Enquiries about the marks can only be made within a maximum of 1 week after the assignment results are published. After 1 week the marks cannot be changed. Mark deductions: late submission, compilation errors, incorrect result, program is not up to spec, poor comments, poor indentation, meaningless identifiers, required numeric constants are not defined, the program uses approaches which has not been covered in the lectures. The deductions here are merely a guide. Marks may also be deducted for other mistakes and poor practices. END OF THE ASSIGNMENT