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

  Develop a flowchart associated with an hiim department

Develop a flowchart associated with an HIIM Department

  Java program to find largest and smallest numbers

Create a Java program that will search a text document of strings representing numbers of type int and will write the largest and the smallest numbers to screen.

  Design algorithm determining annual profit for company

Your goal is to solve the following simple programming exercise. You have been asked by your accounting department to design an algorithm determining the annual profit for your company.

  Why internet need http

Discuss why does the Internet need HTTP, TCP, IP and DNS? Explain why is not the Internet Protocol enough to do the job? Please reply to these specific points of confusion.

  Question 1a i what is a pointer illustrate with an

question 1a i what is a pointer? illustrate with an exampleii give two advantages of the use of pointers over arraysb i

  Data information decision

Data Information Decision

  You and your eight-year-old nephew elmo decide to play a

you and your eight-year-old nephew elmo decide to play a simple card game. atthe beginning of the game the cards are

  Let t be the degree of a btree

Let t be the degree of a BTree. Suppose the size of each object, including the key, stored in the tree is 90 bytes. Also, suppose the size of a BTreeNode pointer is 4 bytes.

  What happens to the complexity of the algorithm

A student proposes to omit the sending of ( nys, w ) messages from Algorithm 4. 6. Is it possible to modify the algorithm in this way? What happens to the complexity of the algorithm?

  Design randomized algorithm for solving decoding problem

The Viterbi algorithm is a deterministic algorithm for solving the Decoding problem. Design a randomized algorithm for solving the Decoding problem.

  Database nested queries

Display the book title and the number of books sold where the profit from the book is more the 70%. The resulting list should display highest quantity of books title sold first in the list. Profit for a book is calculated as (retail - cost) / c..

  Describe a radix-sort method for lexicographically sorting

Describe a radix-sort method for lexicographically sorting a sequence S of triplets (k,l,m),where k, l,and m are integers in the range[0,N-1]

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