It is now your task to write the methods that this program


Assignment

Methods working together

In the following main method, there are three methods that are working together in order to complete a variety of tasks. This file can also be found on blackboard, if you wish to copy and paste the code. Do not alter the main method. Your program will be graded using a different main method.

import java.util.Scanner;
public class MethodLab{
public static void main ()
{
Scanner in = new Scanner(System.in);
System.out.println("Enter a number");
//Getting the value from the user.
int num = in.nextInt();
System.out.println("Your number is the following: " + num);
System.out.println("Your number is " + oddOrEven(num) );
//oddOrEven will return the string either odd or even depending on the value of
the parameter.
num = multByRand(num);
//multByRand multiplies the parameter by a random number between 1 and 10.
System.out.println("The new number is " + num);
printBoxes(num - 1, num);
// printBoxes will output the following when num = 4.
// [] [] []
// [] [] []
// [] [] []
// [] [] []
}
}

It is now your task to write the methods that this program uses. The descriptions are listed below.

oddOrEven: takes an integer parameter and returns the string "odd" if the number is odd and "even" if the number is even.

multByRand: takes the integer parameter and returns that number times a random number between 1 and 10.

printBoxes: takes two integer parameters. The first parameter is how many boxes per row it will output, and the second parameter is how many rows to output. It does not return any value, only prints out the boxes.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: It is now your task to write the methods that this program
Reference No:- TGS02741442

Expected delivery within 24 Hours