Advertisement
Guest User

ASs::: 1

a guest
Dec 13th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. package ass1;
  2. /*.......Author:Jobair Hasnat.
  3. * Assignment 1
  4. */
  5. import java.util.InputMismatchException;
  6. import java.util.Scanner;
  7. class Samsung{
  8. int x,y;
  9. Samsung(int x,int y){
  10. this.x=x;
  11. this.y=y;
  12. }
  13. void check() {
  14. try {
  15. int c=x/y;
  16. System.out.println(y);
  17. }
  18.  
  19. catch(ArithmeticException e) {
  20. System.out.println(e);
  21. }
  22. }
  23.  
  24. }
  25. public class SmartPhone {
  26.  
  27. public static void main(String[] args) {
  28. int a,b;
  29. Scanner get=new Scanner(System.in);
  30. try {
  31. a=get.nextInt();
  32. b=get.nextInt();
  33. Samsung mobile=new Samsung(a,b);
  34. mobile.check();
  35. }
  36. catch(InputMismatchException e) {
  37. System.out.println(e);
  38. }
  39.  
  40. get.close();
  41.  
  42.  
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement