Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you will create several methods, each doing some specific task. You only need to edit the Main.java file, which has some dummy

In this assignment you will create several methods, each doing some specific task. You only need to edit the Main.java file, which has some dummy/stub boilerplate code already in place. The code can be compiled, but the results are not correct. You need to fix each method so it does what it's supposed to, according to the following description:
Method sum(...) that expects two integers, and returns the sum of the expected integers.
Method difference(...) that expects two integers, and returns the difference between the expected integers.
Method division(...) that expects two integers, and returns the first number divided by the second (hint: pay attention to the types of the variables involved!).
Method multiplication(...) that expects two integers, and returns their values multiplied.
Method remainder(...) that expects two integers, and returns the remainder of the division of the first number by the second.
Method isOdd(...) that expects one integer, and returns true if the given value is odd, false otherwise.
Method isEven(...) that expects one integer, and returns true if the given value is even, false otherwise.
Method lowest(...) that expects an array of integers and returns the lowest value inside the given array.
Method highest(...) that expects an array of integers and returns the highest value inside the given array.
Method average(...) that expects an array of integers and returns the average of the values inside the given array.
Method reversed(...) that expects an array of integers and returns a new array in reversed order.
Method determinant(...) that expects a 2-D array of integers that represents a 2 by 2 matrix, and returns the determinant of that matrix.
Boilerplate code:
public class Main {
public static void main(String[] args){
// Test your method implementations here!
}
// Modify all the methods below, so they do what they are supposed to do.
static int sum(int a, int b){ return 0; }
static int difference(int a, int b){ return 0; }
static double division(int a, int b){ return 0; }
static int multiplication(int a, int b){ return 0; }
static int remainder(int a, int b){ return 0; }
static boolean isOdd(int a){ return true; }
static boolean isEven(int a){ return true; }
static int lowest(int[] list){ return 0; }
static int highest(int[] list){ return 0; }
static double average(int[] list){ return 0; }
static int[] reversed(int[] list){ return list; }
static int determinant(int[][] matrix){ return 0; }
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building The Data Warehouse

Authors: W. H. Inmon

4th Edition

0764599445, 978-0764599446

More Books

Students also viewed these Databases questions

Question

Ensure continued excellence in people management.

Answered: 1 week ago

Question

Enhance the international team by recruiting the best people.

Answered: 1 week ago