Question
Using JAVA, write a nested loops program that collects, calculates, and displays the average lung cancer rate over a period of years. The user will
Using JAVA, write a nested loops program that collects, calculates, and displays the average lung cancer rate over a period of years. The user will be asked to enter the number of years.The outer loop will iterate once for every year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the number of cancer cases for that month. After all iterations, the program should display the number of months, the total number of lung cancer cases, and the average lung cancer cases per month for the entire period. Input Validation: Do not allow negative numbers for the monthly lung cancer cases.
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