Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

FlashCard This program implements a flash card to teach addition of numbers with one digit past the decimal. Put a copy of WidgetViewer.java in your

FlashCard

This program implements a flash card to teach addition of numbers with one digit past the decimal. Put a copy of WidgetViewer.java in your src folder, where your FlashCard program is located.

Write a program that uses a WidgetViewer object (the WidgetViewer class is available elsewhere in this Lesson).

  • your program should use either a Random object or Math.random to generate two random numbers between 0.0 and 9.9 (inclusive). Each number should have a single digit to the left of the decimal point, and a single digit to the right of the decimal point. If you choose to use a Random object, google "oracle java 8 api random," click on the first link, and look up the nextInt or nextDouble methods.

To explain the operation of this program, we'll assume that our random number generator generated 6.1 and 5.6.

  • display a JLabel with the text "What is 6.1 plus 5.6?"
  • create an empty JTextField to hold the user's answer
  • create a JButton that has the text "click after answering"
  • The user should put his or her guess in the JTextField and click the JButton.
  • When the button is clicked, the program should get the text from the JTextField, convert it from String to double, and create a JLabel that says either
    • That's right. Good Job, or
    • Sorry, the correct answer is 11.7

depending on whether the user input the correct number (11.7 in this case).

Grading Elements:

  • Program displays a WidgetViewer GUI
  • Program generates two random numbers in the specified range
  • Program displays a JLabel asking the user to enter the sum of the two random numbers
  • Program displays a JTextField for the user's answer
  • Program displays a JButton for the user to acknowledge that input is available
  • Program displays an appropriate message
  • Program does not use Scanner or System.out.print for user input or output

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

Step: 3

blur-text-image

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

Optimization And Data Science Trends And Applications 5th Airoyoung Workshop And Airo Phd School 2021 Joint Event

Authors: Adriano Masone ,Veronica Dal Sasso ,Valentina Morandi

1st Edition

3030862887, 978-3030862886

More Books

Students also viewed these Databases questions

Question

i need correct answrrs 6 0 2 . ( MPC )

Answered: 1 week ago

Question

What is the orientation toward time?

Answered: 1 week ago

Question

4. How is culture a contested site?

Answered: 1 week ago