7.3.1. WrMethods-WE3-P1ΒΆ

Subgoals for Writing Methods

  1. Define method header based on problem

  2. Define return statement at the end

  3. Define method body/logic

    1. Determine types of logic (expression, selection, loop, etc)

    2. Define internal variables

    3. Write statements


Methods-WE3-P1

Put the code in the right order to create a program that has a public method that returns a String and accepts an integer parameter and returns a flavor of ice cream. There is also a main program that calls the method twice.

Put the code in the right order to create a program that returns a String and accepts as parameters a double and a String, and concatenates the two values as a temperature along with its base scale. There is also a main program that calls the method twice, once with Celsius and once with Fahrenheit.

Put the code in the right order to create a program that returns a double, and accepts as parameters 3 integers, and calculates the average of the inputs. There is also a main program that calls the method twice with different values.

You have attempted of activities on this page