|
| 1 | +package p2; |
| 2 | + |
| 3 | +import p1.Checker; |
| 4 | +import p1.DisplayAll; |
| 5 | +import p1.Utility; |
| 6 | +import java.util.Scanner; |
| 7 | + |
| 8 | +public class Demo { |
| 9 | + public static void main(String[] args) { |
| 10 | + boolean shouldRun = true; |
| 11 | + Checker check = new Checker(); |
| 12 | + DisplayAll all = new DisplayAll(); |
| 13 | + Utility utili = new Utility(); |
| 14 | + Scanner refchoice = new Scanner(System.in); |
| 15 | + |
| 16 | + while(shouldRun) { |
| 17 | + System.out.println("[1]Check Armstrong [2]Check Palindrome [3]Print Reverse [4]Display Palindrome [5]Display Armstrong [6]Exit"); |
| 18 | + System.out.println("Enter your Choice : "); |
| 19 | + int choice = refchoice.nextInt(); |
| 20 | + switch(choice) { |
| 21 | + case 1: |
| 22 | + System.out.println("Enter the Num : "); |
| 23 | + Scanner Armref = new Scanner(System.in); |
| 24 | + int checkarm = Armref.nextInt(); |
| 25 | + check.checkArmstrong(checkarm); |
| 26 | + break; |
| 27 | + |
| 28 | + case 2: |
| 29 | + System.out.println("Enter the Num : "); |
| 30 | + Scanner palref = new Scanner(System.in); |
| 31 | + int checkpal = palref.nextInt(); |
| 32 | + System.out.println(check.isPalindrome(checkpal)); |
| 33 | + break; |
| 34 | + |
| 35 | + case 3: |
| 36 | + System.out.println("Enter the Num : "); |
| 37 | + Scanner palrev = new Scanner(System.in); |
| 38 | + int palreve = palrev.nextInt(); |
| 39 | + System.out.println(utili.Reverse(palreve)); |
| 40 | + break; |
| 41 | + |
| 42 | + case 4: |
| 43 | + System.out.println("Enter the Num : "); |
| 44 | + Scanner revpal = new Scanner(System.in); |
| 45 | + int pal = revpal.nextInt(); |
| 46 | + all.DisplayPalindrome(pal); |
| 47 | + break; |
| 48 | + |
| 49 | + case 5: |
| 50 | + System.out.println("Enter the Num : "); |
| 51 | + Scanner armall = new Scanner(System.in); |
| 52 | + int allarm = armall.nextInt(); |
| 53 | + all.DisplayPalindrome(allarm); |
| 54 | + break; |
| 55 | + |
| 56 | + case 6: |
| 57 | + System.out.println("Thank You"); |
| 58 | + shouldRun=false; |
| 59 | + break; |
| 60 | + |
| 61 | + default: |
| 62 | + System.out.println("Enter the correct Value : "); |
| 63 | + break; |
| 64 | + } |
| 65 | + |
| 66 | + } |
| 67 | + |
| 68 | + refchoice.close(); |
| 69 | + } |
| 70 | +} |
0 commit comments