Question: Complete the following two programming exercises; submit both files. Assignment Part A: Write a program that uses nested loops to collect data and calculate the
Complete the following two programming exercises; submit both files.
Assignment Part A:
Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years.
The program should first ask for the number of years. The outer loop will iterate once for each year. The inner
loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the
inches of rainfall for that month. After all iterations, the program should display the number of months, the
total inches of rainfall, and the average rainfall per month for the entire period.
Assignment Part B:
The distance a vehicle travels can be calculated as follows:
distance speed x time
For example, if a train travels miles per hour for three hours, the distance traveled is miles.
Write a program that asks the user for the speed of a vehicle in miles per hour and the number of
hours it has traveled. It should then use a loop to display the distance the vehicle has traveled for each
hour of that time period. Here is an example of the desired
Output example:
What is the speed of the vehicle in mph Enter
How many hours has it traveled? Enter
Hour Distance Traveled
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
