EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
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
Given the following Extended-BNF grammar of the basic mathematical expressions:  Show the derivation steps for the expression: ( 2 + 3 ) * 6 – 20 / ( 3 + 1 ) Draw the parsing tree of this expression. SEE IMAGE
Whentheuserenters!!,themostrecentcommandinthehistoryisexecuted.In the example above, if the user entered the command: Osh> !! The ‘ls -l’ command should be executed and echoed on user’s screen. The command should also be placed in the history buffer as the next command. Whentheuserentersasingle!followedbyanintegerN,theNthcommandin the history is executed. In the example above, if the user entered the command: Osh> ! 3 The ‘ps’ command should be executed and echoed on the user’s screen. The command should also be placed in the history buffer as the next command. Error handling: The program should also manage basic error handling. For example, if there are no commands in the history, entering !! should result in a message “No commands in history.” Also, if there is no command corresponding to the number entered with the single !, the program should output "No such command in history."
Activity No. Activity Time (weeks) Immediate Predecessors 1 Requirements collection 3 2 Requirements structuring 4 1 3 Process analysis 3 2 4 Data analysis 3 2 5 Logical design 50 3,4 6 Physical design 5 5 7 Implementation 6 6 c. Using the information from part b, prepare a network diagram. Identify the critical path.
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