JAVA PROGRAMMING-LMS INTEG.MINDTAP
JAVA PROGRAMMING-LMS INTEG.MINDTAP
8th Edition
ISBN: 9781337091503
Author: FARRELL
Publisher: Cengage Learning
bartleby

Videos

Question
Book Icon
Chapter 5, Problem 2GZ
Program Plan Intro

Lottery game application

Program plan:

  • Import necessary package.
  • Create a class “Lottery”,
    • Define the method “main ()”,
      • Declare and initialize the necessary variables.
      • Generate the three random numbers.
      • Combine three random numbers into a single three digit number.
      • Get the first digit entered into the first dialog box.
      • Assign the integer value returned form the method “parseInt()”.
      • Get the second digit entered into the second dialog box.
      • Assign the integer value returned form the method “parseInt()”.
      • Get the third digit entered into the third dialog box.
      • Assign the integer value returned form the method “parseInt()”.
      • Check whether the first, second and third digit is equal to the first, second and third random number generated respectively,
        • If it is true, set the match count to “4”.
      • Otherwise, check whether the first digit is equal to the first random number generated,
        • If it is true, increment the match count by “1”.
        • Set the first random value to “99”.
      • Otherwise, check whether the first digit is equal to the second random number generated,
        • If it is true, increment the match count by “1”.
        • Set the first random value to “99”.
      • Otherwise, check whether the first digit is equal to the third random number generated,
        • If it is true, increment the match count by “1”.
        • Set the first random value to “99”.
      • Check whether the second digit is equal to the first random number generated,
        • If it is true, increment the match count by “1”.
        • Set the first random value to “99”.
      • Otherwise, check whether the second digit is equal to the second random number generated,
        • If it is true, increment the match count by “1”.
        • Set the first random value to “99”.
      • Otherwise, check whether the second digit is equal to the third random number generated,
        • If it is true, increment the match count by “1”.
        • Set the first random value to “99”.
      • Check whether the third digit is equal to the first random number generated,
        • If it is true, increment the match count by “1”.
        • Set the first random value to “99”.
      • Otherwise, check whether the third digit is equal to the second random number generated,
        • If it is true, increment the match count by “1”.
        • Set the first random value to “99”.
      • Otherwise, check whether the third digit is equal to the third random number generated,
        • If it is true, increment the match count by “1”.
        • Set the first random value to “99”.
      • Check whether the match count is “4”,
        • If it is true,set the highest winning.
      • Otherwise, check whether the match count is “3”,
        • Set the second best winning.
      • Otherwise, check whether the match count is “2”,
        • If it is true, set the third best winning.
      • Otherwise, check whether the match count is “1”,
        • If it is true, set the low winning.
      • Otherwise, set the winning to “0”.
      • Display the output message in dialog box.

Blurred answer
Students have asked these similar questions
(1 point) By dragging statements from the left column to the right column below, give a proof by induction of the following statement: an = = 9" - 1 is a solution to the recurrence relation an = 9an-18 with ao = : 0. The correct proof will use 8 of the statements below. Statements to choose from: Note that a₁ = 9a0 + 8. Now assume that P(n) is true for all n ≥ 0. Your Proof: Put chosen statements in order in this column and press the Submit Answers button. Let P(n) be the predicate, "a = 9″ – 1". απ = 90 − 1 = Note that Let P(n) be the predicate, "an 9" - 1 is a solution to the recurrence relation an = 9an-1 +8 with ao = 0." - Now assume that P(k + 1) is true. Thus P(k) is true for all k. Thus P(k+1) is true. Then ak+1 = 9ak +8, so P(k + 1) is true. = 1 − 1 = 0, as required. Then = 9k — 1. ak Now assume that P(k) is true for an arbitrary integer k ≥ 1. By the recurrence relation, we have ak+1 = ak+1 = = 9ak + 8 = 9(9k − 1) + 8 This simplifies to 9k+19+8 = 9k+1 − 1 Then 9k+1 − 1 = 9(9*…
Given the following request to an AI chatbot, which response is more accurate? (You should use Google to verify that the factual claims in each response are accurate.)   Prompt Is this true? The first recorded use of the phrase "when pigs fly" in print is in a 1616 play by Ben Jonson called "The Devil is an Ass," in which a character says, "When pigs fly, good-night!!" Response   Response A Response B Yes, that's true! The phrase "when pigs fly" indeed appears in Ben Jonson's 1616 play The Devil is an Ass and was said during the second act in a conversation between Fitzdottrel and Pug. The phrase was first used to express skepticism or disbelief, suggesting that something is as unlikely to happen as the fanciful idea of pigs flying. This usage is often cited as one of the earliest instances of the phrase in print.   The claim that the phrase "when pigs fly" was first recorded in Ben Jonson's 1616 play "The Devil is an Ass" is not accurate. There is no evidence from the…
This is for my Computer Organization & Assembly Language Class
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
CPP Function Parameters | Returning Values from Functions | C++ Video Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=WqukJuBnLQU;License: Standard YouTube License, CC-BY