Visual Basics Rainfall Statistics Scenario A client needs an application that le
ID: 3737464 • Letter: V
Question
Visual Basics
Rainfall Statistics Scenario
A client needs an application that lets him enter the rainfall for each of 12 months. The application should calculate and display the following statistics: total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts of rainfall.
Discussion
In this module you are learning about arrays and the types of loops that are used to process them. If you were to create the application above, how might you utilize arrays and what kind of loop(s) would you use? In your answer, consider the following:
· How many arrays and what would it/they be used for?
· What data type(s) would your array(s) be? Why?
· Procedure-level or class-level? Why?
· One-dimensional or two-dimensional? Why?
· What type(s) of loop(s) would you use (For…Next, For Each…Next, etc.) and why would you choose that type/those types?
Your posting can be as little as a paragraph or two, or it can be longer. However, try to limit yourself to three or four paragraphs. After posting your initial Discussion Board response, reply to as many of your classmates’ postings as you are able. You can either agree or disagree with your classmates. However, be sure to defend your position (either pro or con) with examples.
Explanation / Answer
Rainfall applicaition requirements
One Dimensional Array :
Number of arrays : One array of type decimal of size,12 is used.
Since the number of months in a year are 12.So, the size of the array must be 12
to read user input monthly rainfall for 12 months is stored in one dimensional array of size,12.
Array Decimal Data type:
Type of array must be decimal type since the rainfall might be having some
decimal points like 3.3 or 4.5 cm or etc.So, it is better to use decimal data type
since it stores decimal values.
Procedure-level or class-level
As per program requirement, you can use either procedure level or class level.
If applicatioin is developed in object -oriented programming or OOPs concepts
then the procedure level can be used with class object model.
If used as single class level, simply it can be solved by declaring the arrays and other
values like average monthly rainfall, min and max rainfall in a year.
Loops:
For ...Next or For Each ...Next can be used.
For Each ...Next is more simplified version of For ...Next loop.
Both can do the same purpose of repitation of statement.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.