# Don’t us if/ allso Parameter Mystery Assignments Custom Assignments Help

I have a struggle with questions

### Parameter Mystery

1. What output is produced by the following program?

public class ParameterMystery1 {

public static void main(String[] args) {

int a = 4, b = 7, c = -2;

mystery(a, b, c);

mystery(c, 3, a);

mystery(a + b, b + c, c + a);

}

public static void mystery(int c, int a, int b) {

b -= 2;

c = a + 5;

a = a – b;

System.out.println(b + ” + ” + c + ” = ” + a);

}

}

### Parameters

2. Write a method named printColumns that accepts two parameters: the number of columns and the number of spaces which separate each column. Your method should print the column numbers starting at 1, with each column number separated by the given number of spaces. For example, the call printColumns(8, 5) should produce EXACTLY, the following output:

C-1 C-2 C-3 C-4 C-5 C-6 C-7 C-8

### Return

3. Write a method named average4 that accepts four integers as parameters and returns the average of the four values. For example, the call average4(15, 22, -1, 12) should return 12.0.

4. Write a method named grade that accepts an integer parameter representing a student’s course grade from 0 to 100, and returns the student’s course grade on the 4.0 scale. Use the following mapping: (Note: This mapping is fictional and does not represent how we will assign actual grades in this course!)

 Score £ 60 61 62 63 … 98 99 100 Grade 0.0 0.1 0.2 0.3 … 3.8 3.9 4

### Scanner

5. Write code to prompt a student for his/her grade using a Scanner, and use the grade method from the previous question to report the student’s grade:

What percent did you earn? 84

6. Write code to prompt the user for many integers and print the total sum and minimum of the numbers.

How many integers? 5

Next integer? 2

Next integer? 9

Next integer? 17

Next integer? 4

Next integer? 6

Sum = 38

Min = 2

You may assume that the user types at least one integer and that at least one integer will be less than 100.

30% OFF
Turnitin Report
Formatting
Title Page
Citation
Place an Order