Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1.  
  2.  
  3. import java.io.Serializable;
  4.  
  5.  
  6. class Computer implements Serializable {
  7. private String montrComp;
  8. private String sysUnit;
  9. private String mousComp;
  10. private String keybrdComp;
  11. boolean conditionOfComputer = false;
  12.  
  13.  
  14. public Computer(){
  15.  
  16. }
  17.  
  18.  
  19. Computer(String monitor, String systemUnit, String mous, String keyboard ) {
  20. this.montrComp = monitor;
  21. this.sysUnit = systemUnit;
  22. this.mousComp = mous;
  23. this.keybrdComp = keyboard;
  24. }
  25. public String getMontrComp (){
  26. return montrComp;
  27. }
  28. public void setMontrComp(String newMontrComp) {
  29. montrComp = newMontrComp;
  30. }
  31. public String getSysUnit () {
  32. return sysUnit;
  33. }
  34. public void setSysUnit (String newSysUnit) {
  35. sysUnit = newSysUnit;
  36. }
  37. public String getMousComp () {
  38. return mousComp;
  39. }
  40. public void setMousComp (String newMousComp) {
  41. mousComp = newMousComp;
  42. }
  43. public String getKeybrdComp () {
  44. return keybrdComp;
  45. }
  46. public void setKeybrdComp (String newKeybrdComp) {
  47. keybrdComp = newKeybrdComp;
  48. }
  49.  
  50. public String toString(){
  51. return montrComp + " " + sysUnit + " " + mousComp + " " + keybrdComp;
  52.  
  53. }
  54. protected void switchOn(){
  55. conditionOfComputer = true;
  56. System.out.println("I'm turned on");
  57. }
  58. protected void switchOff () {
  59. conditionOfComputer = false;
  60. System.out.println("I'm turned off");
  61. }
  62. }
  63. class OperationSystem {
  64. boolean installOperationSystem = false;
  65. boolean conditionOperationSystem = false;
  66.  
  67. protected void installOs () {
  68. installOperationSystem = true;
  69. System.out.println("Operating system has been installed");
  70. }
  71. protected void runOperationSystem () {
  72. conditionOperationSystem = true;
  73. System.out.println("The operating system was launched");
  74. }
  75. }
  76.  
  77.  
  78.  
  79. public class TestComputer {
  80. public static void main (String [] args){
  81. Computer mycomp = new Computer("lgFlatron", "asus", "asusMouse", "keyboard");
  82. OperationSystem operSystem = new OperationSystem();
  83. Calculator calculator = new Calculator();
  84. FileManager filemanager = new FileManager();
  85. System.out.print("List of unnecessary things: ");
  86. System.out.println(mycomp.toString());
  87. mycomp.switchOn();
  88. operSystem.installOs();
  89. operSystem.runOperationSystem();
  90. calculator.installCalculator();
  91. filemanager.installFileManager();
  92. /*В классе Calculator добавил boolean переменную и метод installCalculator()
  93. void installCalculator() {
  94. conditionCalculator = true;
  95. System.out.println("Calculator has installed");
  96. }
  97. аналогично с классом FileManager
  98. */
  99.  
  100. }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement