Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA Modify the program below to estimate the number of times a person has sneezed in his/her lifetime. Prompt the user to enter the

IN JAVA

Modify the program below to estimate the number of times a person has sneezed in his/her lifetime. Prompt the user to enter the age in years, calculate the number of days the person has lived and the number of sneezes, then, print the person's age in days and the average number of times sneezed.

Example:

If a person entered 30, the program will print: You are 10950 days old. In average, you have sneezed 43800 times in your lifetime.

import java.util.Scanner;

public class HealthData {

public static void main (String[] args) { Scanner scnr = new Scanner(System.in); int userAgeYears = 0; int userAgeDays = 0; /* FIXME: Declare the variables needed for this calculation */ System.out.println("Enter your age in years: "); userAgeYears = scnr.nextInt(); userAgeDays = userAgeYears * 365; /* FIXME: Calculate the number of sneezes in lifetime */

System.out.println("You are " + userAgeDays + " days old."); /* FIXME: Print the result (end with a new line) */ return; } }

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

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

understand the role of competencies and a competency framework

Answered: 1 week ago