Question: public class ExerciseMethods 1 { / * * Integer method returns the maximum range between the 4 numbers given. intRange ( 1 , 2 ,

public class ExerciseMethods1{
/**
Integer method returns the maximum range between the 4 numbers given.
intRange(1,2,3,4) returns 3
intRange(8,6,4,2) returns 6
intRange(-1,-9,-7,-5) returns 8
intRange(7,-10,10,8) returns 20
intRange(1,1,1,1) returns 0
@param num1 int,
@param num2 int,
@param num3 int,
@param num4 int,
@return the distance between the max and min numbers given.
*/
public static int intRange(int num1, int num2, int num3, int num4)
{
// Your answer here. Edit the return statement as necessary.
return 0;//only here to compile, you will need to change.
}// end intRange
/**
Integer method returns the integer given reversed. Leading zeros do not
need to show.
intReverse(1234) returns 4321
intReverse(0) returns 0
intReverse(50) returns 5
intReverse(-501) returns -105
@param num1 int,
@return the integer given in reverse order.
*/
public static int intReverse(int num)
{
// Your answer here. Edit the return statement as necessary.
return 0;//only here to compile, you will need to change.
}// end intReverse
/**
Double method returns the sum of the areas of 3 individual triangles.
The base/height of each triangle are equal and are given.
(negitives can represent location as well as dimention)
The formula for triangle area is (b*h)/2 and in our case,
b = h = num.
threeTriangles(1.0,2.0,3.0) returns 7.0
threeTriangles(2.5,1.0,3.5) returns 9.75
threeTriangles(-1.0,-9.0,-7.0) returns 65.5
threeTriangles(0,0,8.0) returns 32.0
threeTriangles(1.0,1.0,1.0) returns 1.5
@param num1 double
@param num2 double
@param num3 double
@return the sum of the area of all three triangles.
*/
public static double threeTriangles(double num1, double num2, double num3)
{
// Your answer here. Edit the return statement as necessary.
return 0.0;//only here to compile, you will need to change.
}// end threeTriangles
/**
* Double method returns the fractional part of the number given.
*(due to internal storage of floating point numbers, this will not
* look exactly the same.)
*
* fractionalPart(3.14159) returns 0.14159
* fractionalPart(2.0) returns 0
* fractionalPart(-1.1) returns -0.1
* fractionalPart(184.9985) returns 0.9985
*
* @param num double
* @return The fractional part of the number.
*/
public static double fractionalPart(double num)
{
// Your answer here. Edit the return statement as necessary.
return 0.0;//only here to compile, you will need to change.
}// end fractionalPart
/**
boolean method returns true if the given string ends with the same letter it
begins with, regardless of case (false if otherwise)
firstLastEqual("Robert") returns false
firstLastEqual("Ariana") returns true
firstLastEqual("Taco cat") returns true
firstLastEqual("42") returns false
firstLastEqual("") returns false
firstLastEqual("Goodness, clean up that dog") returns true
firstLastEqual("HoHOho")) returns false
@param original String,
@return true if (ignoring case) the first letter is the same as the last
letter (Not just last character). False otherwise.
*/
public static boolean firstLastEqual(String original)
{
// Your answer here. Edit the return statement as necessary.
return false;//only here to compile, you will need to change.
}// end firstLastEqual
/**
* boolean method that returns true if the first string is shorter than the
* second (false if otherwise)
*
* shorterThan("Robert", "Robert") returns false
* shorterThan("Robert", "Susie Q") returns true
* shorterThan("", "anything") returns true
* shorterThan("abc","xyz") returns false
*
* @param s1 String,
* @param s2 String,
* @return true if string 1 is shorter than string 2
*/
public static boolean shorterThan(String s1, String s2)
{
// Your answer here. Edit the return statement as necessary.
return true; //only here to compile, you will need to change.
}// end shorterThan
/**
String method returns the given string reversed.
stringReverse("Taco Casa") returns "asaC ocaT"
stringReverse("what's up") returns "pu s'tahw"
stringReverse("23.9") returns 9.32
stringReverse("Platform Nine and Three-Quarters") returns
"sretrauQ-eerhT dna eniN mroftalP"
stringReverse("") returns ""
stringReverse("87") returns 78
@param s1 String,
@return the given string in reverse.
*/
public static String stringReverse(String s1)
{
// Your answer here. Edit the return statement as necessary.
return "";
}// end stringReverse
/**
Arrays are not allowed for this exercise. Do not use StringBuilder, imports, etc.
Compile code after completing each method using the javac command.
Evaluate the results using the java command.
Ensure all tests for a method, including hidden ones, pass for credit.
Avoid hardcoding; Gradescope will validate logic with additional hidden inputs.
Ensure the code compiles without errors. The code must compile without errors to receiv

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!