Initialize accumulator variable for total rainfall to zero

Assignment Help Data Structure & Algorithms
Reference no: EM131028329

Rainfall

a. Set a constant named SIZE to 12. This represents the total number of elements in the array. Initialize an accumulator variable for the total rainfall to 0.

b. Use an Assignment symbol to create and initialize an array by settingrainfall[SIZE] to 0. (You can actually name the array anything you want.) Also, create an accumulator variable for the total rainfall, and set it to 0.

c. Notice that Raptor arrays start numbering at 1 and go to the number of elements (unlike many languages, which start at 0 and go to 1 less than the number of elements). Set a loop variable, such as index, to 1.

d. Create a loop with the exit condition index > SIZE. Remember that Raptor executes a loop on the NO branch of the condition.

e. Inside the loop, prompt the user for the rainfall amount for that month. Use the index variable as the month number in the prompt, so that your prompt reads something like, Enter the rainfall amount for month 1", etc. See the screen shot below. Store the amount in the array element, which is rainfall[index]. Add 1 to the index.

f. When the loop is done, reset index to 1, and create variables for keeping track of the months with the lowest rainfall and the highest rainfall. Notice that the assignment asks for the months with the highest and lowest rainfall, not just the amounts. Set lowMonth and highMonth to 1 (these will be the subscripts), and set lowAmountandhighAmount to rainfall[1], to initialize them to the first month's numbers.

g. Set up another loop that exits when index > SIZE. Inside this loop:

i. Add the rainfall amount for that array element rainfall[index] to the total rainfall amount.

ii. Compare rainfall[index] to lowAmount. If it is lower, reset lowAmount to rainfall[index], and reset lowMonth to index.

iii. Compare rainfall[index] to highAmount. If it is higher, reset highAmount to rainfall[index], and reset highMonth to index.

iv. Add 1 to index.

h. When that loop ends, compute the average by dividing the total rainfall amount by SIZE. The months with the lowest and highest rainfall are lowMonth and highMonth. Display the total and average rainfall, and the months with the lowest and highest rainfall. You do NOT have to name the months; the number of the months will do. See the screen shot below, when the amounts entered were: 1, 3, 5, 7, 9, 11, 12, 10, 8, 6, 4, 2.

i. Run the program. The program should ask you to enter the amount of rainfall for 12 months. Then it displays the total and average rainfall, and the months with the lowest and highest rainfall, followed by a "Run complete" message. If there are any errors, recheck the instructions and correct them, then resave the file.

Reference no: EM131028329

Questions Cloud

How many possible social security numbers are there : How many possible social security numbers are there if numbers can be repeated but 0 cannot be used for the first digit?
How many different ways can the answer sheet be filled out : How much should Mr. Graff pay for a gold mine expected to yield an annual return of $20,000 and to have a life expectancy of 20 years, if he wants to have a 15% annual return on his investment and he can set up a sinking fund that earns 10% a year..
How is the theory integrated into care by all nurses : Has your facility adopted a specific nursing theory to guide all nursing care? Which one? Why was this decision made? How is the theory integrated into care by all nurses
Nursing conceptual model : Explain at least three specific ways in which the nursing conceptual model could be used to improve nursing practice. Elaborate, explain, or defend each point mentioned
Initialize accumulator variable for total rainfall to zero : Set a constant named SIZE to 12. This represents the total number of elements in the array. Initialize an accumulator variable for the total rainfall to 0.
How many choices are possible to find solution : If who selected which choice is ignored (as a chef would). Analyze this part by the number of different choices made.
Build an application based upon temperature converter app : e purpose of this assignment to confirm that sub routines and functions can be used within Visual Basic programs. Build an application based upon the Temperature Converter application demonstrated in this week's Presentation.
How is political independence embedded in role of fed chair : An article in the Wall Street Journal commented that despite Perry's remarks: " Bernanke is willing to embrace the political independence embedded in his role to do what Fed officials think the economy needs." How is "political independence" embed..
Constructor functions for your button events : constructor functions for your button events as outlined. This application simulates a vending machine that dispenses soft drinks.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd