Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Estimate the amount of time a person has slept in their life (roughly). Write a Java application that will input a person's name, age, and
Estimate the amount of time a person has slept in their life (roughly). Write a Java application that will input a person's name, age, and a typical number of hours he/she sleeps per night. Valid input could be: Joe Smith 28 7.5 From that data, calculate: 1. The number of hours the person has slept during his/her life o age * 365 * hours slept each night 2. The number of days the person has slept during his/her life o Answer from #1 divided by 24 3. The number of years the person has slept during his/her life o Answer from #2 divided by 365 NOTE: You are estimating the values above. For example, your age is based upon your last birthday. Do not worry about days since a person's last birthday. For this assignment: Use text field objects for input areas. Use label objects as headings and labels which describe an adjacent text field. Use label objects for output areas (one for each of the three items above). Use buttons to perform actions (like calculate, exit, etc.). Your panel will include two button objects: 1. Calculate - This button will take the input from the text fields objects, convert the input to numeric values and store in variables, calculate the total hours, days, and years slept, and display the results in label objects (3) in the panel. 2. Exit - This button will close the application. You can use Platform.exit(); and System.exit(0)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started