Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Mini Exercise 1: Create a Java class named MiniExercise1 (1 mark deduction if not). It is to have a main method that calls each of

Mini Exercise 1: Create a Java class named MiniExercise1 (1 mark deduction if not). It is to have a main method that calls each of the static methods below (2 marks deducted if not) Task 1: 12 marks Create a static method named Task1 1) Ask the user how many elements they would like to create. (1 mark) 2) Create an Object array with X elements, where X represents the value in Step 1) (2 marks) 3) In a loop, ask the user to enter a value for each element of the array: (1 mark) a) If the value is either 0 or 1 i) Convert the value to a Boolean (2 marks) b) If the value is within the byte range i) Convert the value to a byte (2 marks) c) If the value is within the short range i) Convert the value to a short (2 marks) d) If the value is a number i) Convert the value to an integer (2 marks) *** No error handling needed. Expect the user to enter a valid numerical value *** *** Conversions can be done in any way desired *** Task 2: 13 marks Create a static method named Task2 1) In a loop, create a multi-dimensional array storing the values of the Multiplication Table from 1 to 10 squared 1 2 3 4 5 10 2 4 6 8 10 20 .. 9 18 27 36 45 90 10 20 30 40 50 100 (4 marks) ** Please note: The first vertical column represents the first dimension of the 2D array Indices should be between 0 and 9 for both dimensions ** 2) Ask the user how many questions they would like to answer (1 mark) 3) In a loop: a) Randomly select two indices from the multi-dimensional array in Step 1) (2 marks) b) Display the two numbers and ask the user to input the answer to the expression. (1 mark) Example What is 6 x 2 ? The index 5 was selected at random in the first dimension of the 2D array. The index 1 was selected at random in the second dimension of the 2D array c) Capture the users answer for the expression (1 mark) i) Display a congrats message if the answer is correct (1 mark) ii) Display the correct answer if answer is incorrect (1 mark) 4) Display a summary of how well the user did using string formatting a) You answered {correct} out of {number of questions}. Thats a percentage of {rounded whole number percentage}%

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions