import java.util.Scanner;
public class LoopPatterns {
/**
* @param args
*/
public static double Largest (){
Scanner s = new Scanner(System.in);
int num, largest = 0;
for ( int i = 1; i <= 10 ;i ++) {
System.out.print("Enter a number : ");
num = s.nextInt();
if ( num > largest)
largest = num;
}
System.out.println("Largest Number : " + largest);
}
public static double First(){
String name1, name2, name3 ;
boolean b, b1;
int i, i1, i2,i3;
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter first string: ");
name1 = keyboard.nextLine();
System.out.print("Enter second string: ");
name2 = keyboard.nextLine();
System.out.print("Enter third string: ");
name3 = keyboard.nextLine();
b = name1.equals(name2);
// Check if identical ignoring case
b1 = name1.equalsIgnoreCase(name2);
i = name1.compareTo(name2);
if (i < 0)
{
i1 = name1.compareToIgnoreCase(name3);
if (i1 < 0)
{
System.out.println(name1);
if (i1 > 0)
{
System.out.println(name3);
i2 = name2.compareToIgnoreCase(name3);
if (i2<0)
{
System.out.println(name2);
System.out.println(name3);
}
if (i2>0)
{
System.out.println(name3);
System.out.println(name2);
}
}
}
}
else if (i > 0)
{
i1 = name2.compareToIgnoreCase(name3);
if (i1 < 0)
{
System.out.println(name2);
if (i1 > 0)
{
i2 = name1.compareToIgnoreCase(name3);
if (i2<0)
{
System.out.println(name1);
System.out.println(name3);
}
if (i2>0)
{
System.out.println(name3);
System.out.println(name1);
}
}
}
}
}
public static void main(String[] args) {
Largest();
First();
}
}
line 9,23- this method must return a type of double