Guest User

Untitled

a guest
Jun 25th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. //OpeningTester
  2.  
  3.  
  4. package com.batch5.day4.q2;
  5.  
  6. import java.util.Scanner;
  7.  
  8. public class OpeningTester extends Opening {
  9.  
  10. public static void main(String[] args) {
  11. Opening open1=new Opening();
  12. Scanner scan= new Scanner(System.in);
  13. System.out.println("Do you want to open anything ??(y/n)");
  14. String choice=scan.next();
  15. if(choice!="n")
  16. {
  17. System.out.println("What do you want to open ? 1. For Door, 2. For Window, 3. For Bank account ?");
  18. int choice1=scan.nextInt();
  19.  
  20. switch(choice1)
  21. {
  22. case 1:
  23. System.out.println("Which door do you want to open ??");
  24. String in1=scan.next();
  25. System.out.print("Door of"+" ");
  26. open1.open(in1);
  27. break;
  28. case 2:
  29. System.out.println("Enter the counter no. of window");
  30. int in2=scan.nextInt();
  31. System.out.print("Counter no."+" ");
  32. open1.open(in2);
  33. break;
  34.  
  35. case 3:
  36. System.out.println("Enter the account number");
  37. long in3=scan.nextLong();
  38. System.out.print("Account no."+" ");
  39. open1.open(in3);
  40. break;
  41.  
  42. default:
  43. System.out.println("wrong choice entered..");
  44.  
  45. }
  46.  
  47. }
  48. else
  49. {
  50. System.out.println("Thank you for visiting ...");
  51. }
  52. scan.close();
  53.  
  54. }
  55.  
  56.  
  57. }
  58.  
  59.  
  60.  
  61.  
  62. //Opening
  63.  
  64. package com.batch5.day4.q2;
  65.  
  66. public class Opening {
  67. /*private String door,window;
  68. private String bankAccount,conversation,box;
  69.  
  70. Opening(){}
  71.  
  72.  
  73.  
  74. public String getDoor() {
  75. return door;
  76. }
  77.  
  78.  
  79.  
  80. public String getWindow() {
  81. return window;
  82. }
  83.  
  84.  
  85.  
  86. public String getBankAccount() {
  87. return bankAccount;
  88. }
  89.  
  90.  
  91.  
  92. public String getConversation() {
  93. return conversation;
  94. }
  95.  
  96.  
  97.  
  98. public String getBox() {
  99. return box;
  100. }
  101.  
  102.  
  103.  
  104.  
  105.  
  106. public void setDoor(String door) {
  107. this.door = door;
  108. }
  109.  
  110.  
  111.  
  112. public void setWindow(String window) {
  113. this.window = window;
  114. }
  115.  
  116.  
  117.  
  118. public void setBankAccount(String bankAccount) {
  119. this.bankAccount = bankAccount;
  120. }
  121.  
  122.  
  123.  
  124. public void setConversation(String conversation) {
  125. this.conversation = conversation;
  126. }
  127.  
  128.  
  129.  
  130. public void setBox(String box) {
  131. this.box = box;
  132. }*/
  133.  
  134. //-----------------------------------------------------------------
  135.  
  136. public void open(String openType)
  137. {
  138. System.out.println(openType+" is opening");
  139. }
  140. public void open(int openType)
  141. {
  142. System.out.println(openType+"is opening");
  143. }
  144. public void open(long openType)
  145. {
  146. System.out.println(openType+"is opening");
  147. }
  148.  
  149.  
  150.  
  151. }
Add Comment
Please, Sign In to add comment