Advertisement
vencinachev

OOP1

Sep 19th, 2019
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1. public class App {
  2.  
  3.     static int getMax(int a, int b) {
  4.         return (a > b) ? a : b;
  5.     }
  6.  
  7.     static int getMin(int a, int b) {
  8.         return (a > b) ? b : a;
  9.     }
  10.  
  11.     static void printMax(int a, int b) {
  12.         int max = (a > b) ? a : b;
  13.         System.out.println(max);
  14.     }
  15.  
  16.     static String lastDigit(int number) {
  17.         int last = number % 10;
  18.         String text = "";
  19.         switch (last) {
  20.         case 0:
  21.             text = "zero";
  22.             break;
  23.         case 1:
  24.             text = "one";
  25.             break;
  26.         case 2:
  27.             text = "two";
  28.             break;
  29.         case 3:
  30.             text = "three";
  31.             break;
  32.         case 4:
  33.             text = "four";
  34.             break;
  35.         case 5:
  36.             text = "five";
  37.             break;
  38.         case 6:
  39.             text = "six";
  40.             break;
  41.         case 7:
  42.             text = "seven";
  43.             break;
  44.         case 8:
  45.             text = "eight";
  46.             break;
  47.         case 9:
  48.             text = "nine";
  49.             break;
  50.         }
  51.         return text;
  52.     }
  53.  
  54.     public static void main(String[] args) {
  55.         Scanner scan = new Scanner(System.in);
  56.         int num = scan.nextInt();
  57.         String digit = lastDigit(num);
  58.         System.out.println(digit);
  59.  
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement