Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java Create a new class called TimedResponse. Declare two LocalDateTime objects. These objects will hold the exact time before a user is prompted and the

java

Create a new class called TimedResponse. Declare two LocalDateTime objects. These objects will hold the exact time before a user is prompted and the exact time after the user responds. Also declare two integers to hold the value of the seconds for both times. The difference between these two value is the elapsed time between the creations of the two LocalDateTime values.

Assign the current time into the first LocalDateTime object, and then extract the value of the current seconds field.

Display a dialog box that asks the user to make a difficult choice.

Next, get the system time immediately after the user responds to the dialog box, and extract its seconds component.

Compute the difference between the times and display the result in a dialog box.

Save and run the program. When the question appears, ponder for a few seconds and then choose a response.

The output is only accurate when the first and second LocalDateTime objects are created during the same minute. If the first object is created 58 seconds after a minute starts and the user doesn't respond to the question until 2 seconds after the next minute starts, the difference between the two values will be calculated incrrectly as -56 instead of 4 seconds. Modify the application to fix this problem. (Hint, you'll have to use getMinute() too.)

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

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions

Question

What is conservative approach ?

Answered: 1 week ago

Question

What are the basic financial decisions ?

Answered: 1 week ago

Question

1. Select the job or jobs to be analyzed.

Answered: 1 week ago