Write a Java program that will randomly generate ages for 20 students in CS161, and store them in an array, called ages. The ages should be in the range of 17 to 100 inclusive. When you have generated all of the ages, and populated the ages array, you must output them to the screen as shown below. Your program should calculate and print to the screen the number of students who are less than 40 years of age and the number of students who are 40 years of age or older. You should output these in the format as shown below. Your program should find the average age of students in the class and print this average to the screen, as shown below.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Modularization Techniques
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question
Description
Note: You must use the variable names specified and you must not "hard-code"
results.
Write a Java program that will randomly generate ages for 20 students in CS161, and store
them in an array, called ages. The ages should be in the range of 17 to 100 inclusive. When
you have generated all of the ages, and populated the ages array, you must output them to
the screen as shown below.
Your program should calculate and print to the screen the number of students who are less
than 40 years of age and the number of students who are 40 years of age or older. You
should output these in the format as shown below.
Your program should find the average age of students in the class and print this average to
the screen, as shown below.
Transcribed Image Text:Description Note: You must use the variable names specified and you must not "hard-code" results. Write a Java program that will randomly generate ages for 20 students in CS161, and store them in an array, called ages. The ages should be in the range of 17 to 100 inclusive. When you have generated all of the ages, and populated the ages array, you must output them to the screen as shown below. Your program should calculate and print to the screen the number of students who are less than 40 years of age and the number of students who are 40 years of age or older. You should output these in the format as shown below. Your program should find the average age of students in the class and print this average to the screen, as shown below.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Array
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT