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

Database Systems For Advanced Applications 17th International Conference Dasfaa 2012 Busan South Korea April 2012 Proceedings Part 1 Lncs 7238

Authors: Sang-goo Lee ,Zhiyong Peng ,Xiaofang Zhou ,Yang-Sae Moon ,Rainer Unland ,Jaesoo Yoo

2012 Edition

364229037X, 978-3642290374

More Books

Students also viewed these Databases questions

Question

Evaluate the integral. /3 sin e cot e - de sec e /6

Answered: 1 week ago

Question

What is paper chromatography?

Answered: 1 week ago

Question

Explain the cost of capital.

Answered: 1 week ago