Exercise 11.91 (26) Write a Java class that implements a set of three overloaded static methods. The methods should have different set of parameters and perform similar functionalities. Call the methods within main method and display the results.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Exercise 11:0 (20)
Write a Java class that implements a set of three overloaded static methods. The methods should
have different set of parameters and perform similar functionalities. Call the methods within main
method and display the results.
Lab #2
Java Programming
Exercis
Design a Lo class with one array instance variable to hold three random integer values (from 1
to 8). Include a constructor that randomly populates the array for a lotto object. Also, include a
method in the class to return the array.
Exercise 3 (F...!
Page 1 of 3
Use this class to simulate a simple lotto game in which computer randomly chooses a number
between 3 and 24. The user runs the lotto up to 7 times and each time the sum of lotto numbers
entered by the user is calculated. If the sum of the numbers chosen by the user matches the number
selected by computer, the user wins and the game ends. If the sum of the entered numbers does not
match the sum within 7 rolls, the computer wins. Use methods of JOptionPane class to interact
with the user.
COMP-228
Write a Java application that simulates a test. The test contains at least 3 questions about first three
lectures of this Java course. The 3 questions should be randomly selected from a bank of at least
6 questions without repetition. Each question should be a multiple-choice question with 4 options.
Design a Test class. Use programmer-defined methods to implement your solution. For example:
create a method to simulate the questions - generateQuestion
create a method check the answer - checkAnswer
create a method to display a random message for the user-generate Message
create a method to interact with the user - inputAnswer
Display the questions using methods of JOptionPane class. Use a loop to show all the questions.
-
For each question:
If the user finds the right answer, display a random congratulatory message
("Excellent!" "Good!" "Keep up the good work!", or "Nice work!").
If the user responds incorrectly, display an appropriate message and the correct answer
("No. Please try again", "Wrong. Try once more", "Don't give up!", "No. Keep trying..").
Use random-number generation to choose a number from 1 to 4 that will be used to select
an appropriate message.
Use a switch statement to issue the responses, as in the following code:
switch (randomObject.nextInt( 4 ))
{
case 0:
return("Very good!");
At the end of the test display the number of correct and incorrect answers, and the percentage of
the correct answers.
Your main class will simply create a Test object and start the test by calling inputAnswer method.
Transcribed Image Text:Exercise 11:0 (20) Write a Java class that implements a set of three overloaded static methods. The methods should have different set of parameters and perform similar functionalities. Call the methods within main method and display the results. Lab #2 Java Programming Exercis Design a Lo class with one array instance variable to hold three random integer values (from 1 to 8). Include a constructor that randomly populates the array for a lotto object. Also, include a method in the class to return the array. Exercise 3 (F...! Page 1 of 3 Use this class to simulate a simple lotto game in which computer randomly chooses a number between 3 and 24. The user runs the lotto up to 7 times and each time the sum of lotto numbers entered by the user is calculated. If the sum of the numbers chosen by the user matches the number selected by computer, the user wins and the game ends. If the sum of the entered numbers does not match the sum within 7 rolls, the computer wins. Use methods of JOptionPane class to interact with the user. COMP-228 Write a Java application that simulates a test. The test contains at least 3 questions about first three lectures of this Java course. The 3 questions should be randomly selected from a bank of at least 6 questions without repetition. Each question should be a multiple-choice question with 4 options. Design a Test class. Use programmer-defined methods to implement your solution. For example: create a method to simulate the questions - generateQuestion create a method check the answer - checkAnswer create a method to display a random message for the user-generate Message create a method to interact with the user - inputAnswer Display the questions using methods of JOptionPane class. Use a loop to show all the questions. - For each question: If the user finds the right answer, display a random congratulatory message ("Excellent!" "Good!" "Keep up the good work!", or "Nice work!"). If the user responds incorrectly, display an appropriate message and the correct answer ("No. Please try again", "Wrong. Try once more", "Don't give up!", "No. Keep trying.."). Use random-number generation to choose a number from 1 to 4 that will be used to select an appropriate message. Use a switch statement to issue the responses, as in the following code: switch (randomObject.nextInt( 4 )) { case 0: return("Very good!"); At the end of the test display the number of correct and incorrect answers, and the percentage of the correct answers. Your main class will simply create a Test object and start the test by calling inputAnswer method.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Merge Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education