Home > Back-end >  The great god online solution method about assignments
The great god online solution method about assignments

Time:10-06

The specific requirements:
Use method overloading:
Enter the specific number of
1 type int, determine the number of parity
Two parameters of type int, calculate the number of two and

Three type int number with the ternary operator, it is concluded that the maximum

Four type int, sorted

2 a float, and multiply

CodePudding user response:

Homework assignments are simple, yourself ha!

CodePudding user response:

Import the Java. Util. ArrayList;
The import java.util.Com parator;
Import the Java. Util. List;

/* *
* @ description:
* @ company:
* * @ author: James gosling
: * @ version 1.0.0
Date: * @ 2020-03-11 10:47:31
*/
Public class CalculatorServiceImpl implements CalculatorService {
@ Override
Public Boolean calculate (int num) {
Return num % 2==1;
}

@ Override
Public int calculate (int num1, int num2) {
Return num1 + num2;
}

@ Override
Public int calculate (int num1, int num2, int num3) {
Return (num1 & gt; Num2? Num1: num2) & gt; Num3? (num1 & gt; Num2? Num1: num2) : num3;
}

@ Override
Public List Calculate (int num1, int num2, int num3, int num4) {
List NumList=new ArrayList<> (a);
NumList. Add (num1);
NumList. Add (num2);
NumList. Add (num3);
NumList. Add (num4);
Paring numList. Sort (Comparator.com (e - & gt; E));
Return numList;
}

@ Override
Public float calculate (float num1, float num2) {
Return num1 * num2;
}
}

Interface CalculatorService {
/* *
* determine the odd or even number
* @ param num digital
* @ return true=an odd number, false=even
*/
Boolean calculate (int num);

/* *
Calculation of the two Numbers and
* @ param num1 number 1
* @ param num2 number 2
* @ return the sum of two Numbers
*/
Int calculate (int num1, int num2);

/* *
* by the ternary operator to calculate the maximum the value
* @ param num1 number 1
* @ param num2 number 2
* @ param num3 number 3
* @ return Max
*/
Int calculate (int num1, int num2, int num3);

/* *
* four numerical sorted
* @ param num1 number 1
* @ param num2 number 2
* @ param num3 number 3
* @ param num4 number 4
* @ return sorted collection of
*/
List Calculate (int num1, int num2, int num3, int num4);

/* *
* two float to multiply
* @ param num1
* @ param num2
* @ return
*/
Float calculate (float num1, float num2);
}

CodePudding user response:

reference 1st floor paullbm response:
are very simple operations, yourself ha!

I will help people to complete, how to drop

CodePudding user response:

reference 3/f, James 灬 Gosling response:
Quote: refer to 1st floor paullbm response:

Homework assignments are simple, yourself ha!

How is complete, I will be to help people to drop


That you are the father of the JAVA are muddied,,,

CodePudding user response:

reference 4 floor paullbm response:
Quote: reference 3/f, James 灬 Gosling response:

Quote: refer to 1st floor paullbm response:

Homework assignments are simple, yourself ha!

How is complete, I will be to help people to drop


That you are the father of the JAVA are muddied,,,


Buddha says: save a life - made seven pagoda, I help people do a job, at least than building level pagoda

CodePudding user response:

refer to fifth floor James 灬 Gosling response:
Quote: refer to 4th floor paullbm response:

Quote: refer to the third floor, James 灬 Gosling response:

Quote: refer to 1st floor paullbm response:

Homework assignments are simple, yourself ha!

How is complete, I will be to help people to drop


That you are the father of the JAVA are muddied,,,


Buddha says: save a life - made seven pagoda, I help people do a job, at least than building level pagoda
thank you very much

CodePudding user response:

The
reference ins 6 floor? . Reply:
Quote: refer to fifth floor James 灬 Gosling response:
Quote: refer to 4th floor paullbm response:

Quote: refer to the third floor, James 灬 Gosling response:

Quote: refer to 1st floor paullbm response:

Homework assignments are simple, yourself ha!

How is complete, I will be to help people to drop


That you are the father of the JAVA are muddied,,,


Buddha says: save a life - made seven pagoda, I help people do a job, at least than building level pagoda
thank you very much


Don't mention it, lift a finger, we build better homes together, common to the universe  nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related