{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

iLAB2 - iLab week 2 Largest.Java import...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
iLab week 2 Largest.Java import javax.swing.JOptionPane; public class Largest { public static void main(String[] args) { int counter = 0; int number; int largest = 0; while (counter<11) { counter++; number = Integer. parseInt (JOptionPane. showInputDialog ( "Enter Number" )); if (number >= largest) largest = number; } System. out .println( "Program Name: Largest.java" ); System. out .println( "Programer's Name: Eric Errichiello" ); System. out .println( "Program Description: Enter 10 digits, will show Largest input." ); System. out .println( "Largest number input: " + largest); } } (will repeat 10 times, to enter 10 digits) After entering numbers(1,2,2,3,3,3,4,7,5,6)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Palindrome.java import java.util.Scanner; import javax.swing.JOptionPane; public class Palindrome { public static void main(String[] args) { while (true) { display(check(retrieveInput())); } } public static String retrieveInput() { Scanner scan = new Scanner(System.in); JOptionPane.showInputDialog(null, "Please enter a 5-digit number!"); return retrieveInput(); } public static boolean check(String input) { boolean check = false; try { Integer.parseInt(input); if (input.charAt(0)==input.charAt(4) && input.charAt(1)==input.charAt(3)) check = true;
Background image of page 2
} catch(Exception e) { check = false;
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}