Answered You can buy a ready-made answer or pick a professional tutor to order an original one.

QUESTION

project and the rubric, which explains how you will be graded

Activity: Methods

Before You Begin:

Go thoroughly read the SDI_Methods.pdf! That PDF contains the full instructions for this

project and the rubric, which explains how you will be graded.

Criteria:

For each problem below you will need the following:

• Label the section of code appropriately.

• Create a custom method for each of the (3) problems inside of (1) project.

• Prompt the user for the required input in the main method.

• Validate and convert each user prompt to insure that the user is typing in a valid

response.

• Send in the user’s input as arguments to the custom method.

• The custom method should perform the task and save the result in a variable.

• The result variable must be returned to the main method and caught by a variable.

• Print out the result of each function to the console in the main method.

• Use only code and techniques learned in this class.

Graded Problems:

Problem #1: Painting A Wall

Calculate how many gallons it would take to paint a wall. This will

• User Input (Ask & Validate In Main Method, Use As Arguments):

o Width of wall (in feet)

o Height of wall (in feet)

o Number of coats of paint

o Surface area one gallon of paint will cover (in feet2)

• Return Value From Custom Function:

o Number of gallons of paint needed

• Result To Print To The Console In The Main Method:

o “For X coats on that wall, you will need X gallons of paint.”

• Data Sets To Test

o Width – 8, Height – 10, Coats – 2, Surface Area - 300 ft2

§ Results - “For 2 coats on that wall, you will need .53 gallons of paint.”

o Width – 30, Height – 12.5, Coats – 3, Surface Area - 350 ft2

§ Results - “For 3 coats on that wall, you will need 3.21 gallons of paint.”

o Test one of your own.

Problem #2: Stung!

It takes 9 bee stings per pound to kill an animal. Calculate how many bee stings are needed to

kill an animal in a function

• User Input (Ask & Validate In Main Method, Use As Arguments):

o Animal’s weight (in pounds)

• Return Value From Custom Function:

o Number of Bee stings

• Result To Print To The Console In The Main Method:

o “It takes X bee stings to kill this animal.”

• Data Sets To Test

o Animal’s Weight – 10

§ Results - “It takes 90 bee stings to kill this animal.”

o Animal’s Weight – 160

§ Results - “It takes 1440 bee stings to kill this animal.”

o Animal’s Weight – Twenty

§ Results – Re-prompt for number value.

o Test one of your own.

Problem #3: Reverse It

1. In your main method, declare and define an array of at least 5 strings elements.

a. For this one problem, the array should be hard-coded and not from user

prompted values.

2. Create a function that receives this array of strings.

3. Using a new array created in the custom method, create a loop to cycle through the

array backwards and save the items in the reverse order to the new array.

a. Remember this loop must work for an array of any size!

b. You must reverse the array using a loop and NOT by just hard coding it!

c. You may NOT use the Array.Reverse() method in this assignment.

4. Return this new reversed array to the main method.

5. Output both the original and reversed array in the main method.

a. You may use a loop to output the arrays or you may convert them to a string and

output that.

§ Parameter(s) for function:

o Array of string elements

§ Return Value From Custom Function:

o Array with string elements in reverse order.

§ Result to print to the console:

o “Your original array was [X, X, X…] and now it is reversed as [X, X, X…]”

§ Data Sets To Test

o Initial array – [“apple”, “pear”, “peach”, “coconut”, “kiwi”]

§ Results - Your original array was [“apple”, “pear”, “peach”, “coconut”,

“kiwi”] and now it is reversed as [“kiwi”, “coconut”, “peach”, “pear”,

“apple”]

o Initial array – [“red”, “orange”, “yellow”, “green”, “blue”, ”indigo”, “violet”]

§ Results - Your original array was [“red”, “orange”, “yellow”, “green”,

“blue”, ”indigo”, “violet”] and now it is reversed as [“violet”, “indigo”,

“blue”, “green”, “yellow”, “orange”, “red”]

o Now that you tested these 2 arrays, create one of your own to test and turn in.

Show more
adelen
adelen
  • @
  • 1 order completed
ANSWER

Tutor has posted answer for $60.00. See answer's preview

$60.00

*** ****** ** ******* ************ ****************************** **************** ******************** *************************** ***** ******* * ****** **** ************* ***** { ****** ***** ****** ***** ******* ******** string ****** SHeight ****** ******** ************* *** ******** = ** ***** ****** { ConsoleWriteLine("1-Painting * ************************* ************* ConsoleWriteLine("your chooce: "); ******** * ConvertToInt32(ConsoleReadLine()); ** ********* >= * ********** ******** ***** 4) * ** ********* ** ** { ConsoleWriteLine("type *** ***** ** **** *** ********* SWidth * ****************** ***** *********************** *** ******* * *********************** ***** try ***** **** ****** = ****************** * ********************** *** ****** ** wall *** ********* ******* * ****************** ***** ************************ *** Height)) * ConsoleWriteLine("Wrong ***** try ***** **** SHeight * ****************** * ********************** *** Number ** ***** ** ********* ****** * ****************** ***** (!doubleTryParse(Scoats *** coats)) * *********************** ***** try ***** :"); ****** * ****************** * ConsoleWriteLine("type *** ******* **** one ****** of ***** **** ***** *** *********** ******** * ****************** ***** (!doubleTryParse(SSurface *** ********* * *********************** value *** ***** :"); ******** = ConsoleReadLine(); * double result = ************** ****** ****** ***** Surface); ConsoleWriteLine("\nFor " * coats + * ***** ** **** **** *** will need * * resultToString("0##") * * ******* ** paint\n"); * **** ** (selected == ** * ConsoleWriteLine("Animal’s ****** *** *********** ************ * ****************** while ***************************** *** ********* * *************************** for number ********* animalweight = ConsoleReadLine(); * ****** result * ********************** ConsoleWriteLine("\nIt ***** " + result * * bee ****** ** kill **** animal\n"); } **** if ********* == ** * ******** ***** * { "apple" ****** "peach" "coconut" "kiwi" ** ******** list2 = ******************* ************************ ******** ***** *** ** * ************* list1) * "]" * " and *** ** ** ******** ** [" + ************* ************** * **** if ********* == ** * break; }   * **** { *********************** input ** must be ******* * **** * ** end **** * ** end ****** *** *** **** ******** public ****** ****** gallonsOfPaint(double * double * ****** C ****** S) * ****** ****** * ** ****** * (W*H*C)/S; ****** ****** * * ** end ************** ******** ****** ****** double AnimalWeight(double W) * ****** output = * ** ; return ******* * ** *** ************ ****** ****** static ******** ******************** ********* * ******** *********** * new *********************** for **** start = ** ***** ***** myStringLength / 2; start++) { *** temp * **************** newElements[start] * *********************** * 1 * ******* newElements[myStringLength - * * ****** * ***** * ****** ************ } // *** *********** ****** } // *** ********

Click here to download attached files: Lastname_Firstname_Methods.zip
or Buy custom answer
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question