/*1st - What I want to do is have the user input 2 numbers. Program should determine which is lowest and highest, then spit it out. Then I’m trying to have the user input a 3rd number that is equal to or in between the lowest number and highest number. This is the part where I get stuck. Any suggestions? I know it has to be some type of while loop.*/
import java.util.*;
class noob{
public static void main(String[] args) {
Scanner console = new Scanner (System.in);
System.out.println("Enter first number");
int a = console.nextInt();
System.out.println("Enter second number");
int b = console.nextInt();
int lowestNumber = lowest(a,b);
int highestNumber = highest(a,b);
System.out.println("The lowest number is " + lowestNumber);
System.out.println("The highest number is " + highestNumber);
System.out.println("Choose a number betweem " +lowestNumber+" and " +highestNumber+".");
int c = console.nextInt();
}
public static int lowest(int a, int b) {
if (a > b) {
return b;
} else {
return a;
}
}
public static int highest(int a, int b) {
if (a > b) {
return a;
} else {
return b;
}
}
}
muraj 0 Newbie Poster
Akill10 96 Posting Pro
muraj 0 Newbie Poster
Akill10 96 Posting Pro
muraj 0 Newbie Poster
muraj 0 Newbie Poster
Akill10 96 Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.