Write a Java program to generate a user's daily average number of walking steps for a given month of the year. To do so, write the appropriate code for each of the following steps:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I need the answer to be as same as the output

 

Write a Java program to generate a user's daily average number of walking steps for a given month of the year. To
do so, write the appropriate code for each of the following steps:
a) First the program should prompt the user to enter the month's number (from 1 to 12) as an integer type.
Assume all input is valid.
b) Use switch case to determine the number of days in the given month (Suppose that month 2 has 28 days,
months 1,3,5,7,8, 10,12 have 31 days and the other months have 30 days).
c) Use a counter-based loop (for-loop or while-loop) to ask the user to enter the number of steps walked in each
of the days of the entered month.
d) Calculate and display the daily average number of walked steps as follows:
Total steps walked in a given month
Daily Average of walked steps
Number of days of a given month
SAMPLE INPUT/OUTPUT
Input the month: 2
Input the num. of steps for each of the 28 days of month 2:
227 1232 119 12002 1222 ... ...
222
Daily Average of Walked Steps = 4732.28322
Note: Your answer should follow the given sample input / output.
Transcribed Image Text:Write a Java program to generate a user's daily average number of walking steps for a given month of the year. To do so, write the appropriate code for each of the following steps: a) First the program should prompt the user to enter the month's number (from 1 to 12) as an integer type. Assume all input is valid. b) Use switch case to determine the number of days in the given month (Suppose that month 2 has 28 days, months 1,3,5,7,8, 10,12 have 31 days and the other months have 30 days). c) Use a counter-based loop (for-loop or while-loop) to ask the user to enter the number of steps walked in each of the days of the entered month. d) Calculate and display the daily average number of walked steps as follows: Total steps walked in a given month Daily Average of walked steps Number of days of a given month SAMPLE INPUT/OUTPUT Input the month: 2 Input the num. of steps for each of the 28 days of month 2: 227 1232 119 12002 1222 ... ... 222 Daily Average of Walked Steps = 4732.28322 Note: Your answer should follow the given sample input / output.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education