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

  Define how to building a binary search tree

Three of these operations (all but add) must visit every node in the tree. One of these must use preorder traversal, one must use inorder traversal, and one must use postorder traversal.

  Creating two arrays of integers

Prepare two arrays of integers, each holding 10-elements of data. Make a third array of integers for a result array. The main program will take the 2-arrays of integers and pass them to the function subtract().

  Determine the relative record number in the sector

Assume a direct access file consists of sectors with 1024 byte capacity. Assume also that records are thirty-two bytes long.

  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.

  Data information decision

Data Information Decision

  Lines of action- explain how you will use a search tree to

lines of action- explain how you will use a search tree to find the solutionbullabstractbullintroductionbullrelated

  Question about java programming

Define a class named Document that have an instance variable of type String named text that stores any textual content for the file. Design a technique named toString that returns the text field and also include a method to set this value.

  Create a java program to arithmetic expression

Create a Java program that takes as input an infix arithmetic expression then transforms to a postfix expression and based on binary tree, it evaluates that expression.

  Question about site structure

Browse the Web to discover examples of the following site structures Linear and Hierarchical and describe how the content fits the structure.

  Finding time taken to send packet from source to destination

Think about sending a document of F bytes over a path of Q links. Each link transmits at R bps. The network is lightly loaded so that there are no queuing delays.

  Features of a database

What is a VIEW and what are its uses?

  Create greedy algorithm to find market to buy apples

Assume we drive pickup truck from city A to city B. Along high way, we will go through n apple markets, labeled with 1, 2, ..., n, where you can buy or sell apples. which means you buy and sell apples at the same market i.

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