subject

40 POINTS In Java PLS The Extremes class represents the range of Integer values.

Fill in the Extremes methods. In the constructor, set min and max to the minimum and maximum value of Integer. Use Integer. MIN_VALUE and Integer. MAX_VALUE. Also fill in the minDiff and maxDiff methods to return the difference between the users guess and the actual max/min values of Integer.

Main
In main, use the comments as a guide to ask the user to guess the maximum and minimum values. Compute the difference between the guess and the values, then print it out.

Be aware that if you choose a number too big or too small, it will cause an error since the number cannot be stored.

The results in main should look something like this:

Guess the maximum Integer value:
543214
You were off by 2146940433
Guess the minimum Integer value:
2145678321
You were off by 1805327

Main:
import java. util. Scanner;
import java. lang.*;

public class ExtremeMain
{
public static void main(String[] args)
{
// Create a Scanner object

// Create an Extremes object

// Ask the user to guess the maximum value of an Integer

// Compute and display the difference
// between the max and the guess

// Ask the user to guess the minimum value of an Integer

// Compute and display the difference
// between the min and the guess

}
}

Extreme Class:

public class Extremes
{
Integer min;
Integer max;

// Constructor
public Extremes()
{
//Set min and max values
}

// Returns the difference
// max - number
public Integer maxDiff(Integer number)
{

}

// Returns the difference
// min - number
public Integer minDiff(Integer number)
{

}

// Returns a String representation
// in the form
// [min, max]
public String toString()
{
return "[" + min + ", " + max + "]";
}
}

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, Akkenson17871
The "instance" relationship shows that something is an object of a
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, MoneyMike42
Alex’s family members live in different parts of the world. they would like to discuss the wedding plans of one of their distant relatives. however, alex wants all the family members to talk to each other simultaneously so that they can make decisions quickly. which mode of internet communication should they use? a. blog b. email c. wiki d. message board e. instant messaging
Answers: 2
image
Computers and Technology, 23.06.2019 02:50, CrusaderLord
Define a class named movie. include private fields for the title, year, and name of the director. include three public functions withprototypes void movie: : settitle(cstring); , voidmovie: : setyear(int); , void movie: : setdirector(string); . includeanother function that displays all the information about a movie. write a main() function that declares a movie object namedmyfavoritemovie. set and display the object's fields. this is what i have but know its wrong since it will notcompile: #include#includeusing namespace std; //class declarationclass movie{private: string movietitle ; string movieyear; string directorname; public: void settitle(string title); void setyear(string year); void setdirector(string director); void displayinfo(); }; //class implementationvoid movie: : settitle(string title){ movietitle = title; cout< < "what is the title of themovie? "< > temp; myfavoritemovie. settitle(temp); cout< < "enter movie year"< > temp; myfavoritemovie. setyear(temp); cout< < "enter director'sname"< > temp; myfavoritemovie. setdirector(temp); //display all the data myfavoritemovie. displayinfo(); system("pause"); return 0; this code is not entirely mine someone on cramster edited my firstcode but then i try manipulating the new code and i still get acompile error message : \documents\visual studio 2008\projects\movie\movie\movie. cpp(46) : error c2679: binary '< < ' : no operator found which takes aright-hand operand of type 'std: : string' (or there is no acceptableconversion)c: \program files (x86)\microsoft visual studio9.0\vc\include\ostream(653): could be'std: : basic_ostream< _elem,_traits> & std: : operator< < > (std: : basic_ostream< _elem,_traits> & ,const char *)w
Answers: 1
image
Computers and Technology, 23.06.2019 14:30, carter1809
Choose the answers that best complete each sentence. on average, are more expensive than other kinds of postsecondary schools. the cost of room and board includes. to save money, some students attend auniversity in their home state.
Answers: 2
You know the right answer?
40 POINTS In Java PLS The Extremes class represents the range of Integer values.

Fill i...

Questions in other subjects:

Konu
Mathematics, 18.03.2021 20:00