Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.Serializable;
- class Computer implements Serializable {
- private String montrComp;
- private String sysUnit;
- private String mousComp;
- private String keybrdComp;
- boolean conditionOfComputer = false;
- public Computer(){
- }
- Computer(String monitor, String systemUnit, String mous, String keyboard ) {
- this.montrComp = monitor;
- this.sysUnit = systemUnit;
- this.mousComp = mous;
- this.keybrdComp = keyboard;
- }
- public String getMontrComp (){
- return montrComp;
- }
- public void setMontrComp(String newMontrComp) {
- montrComp = newMontrComp;
- }
- public String getSysUnit () {
- return sysUnit;
- }
- public void setSysUnit (String newSysUnit) {
- sysUnit = newSysUnit;
- }
- public String getMousComp () {
- return mousComp;
- }
- public void setMousComp (String newMousComp) {
- mousComp = newMousComp;
- }
- public String getKeybrdComp () {
- return keybrdComp;
- }
- public void setKeybrdComp (String newKeybrdComp) {
- keybrdComp = newKeybrdComp;
- }
- public String toString(){
- return montrComp + " " + sysUnit + " " + mousComp + " " + keybrdComp;
- }
- protected void switchOn(){
- conditionOfComputer = true;
- System.out.println("I'm turned on");
- }
- protected void switchOff () {
- conditionOfComputer = false;
- System.out.println("I'm turned off");
- }
- }
- class OperationSystem {
- boolean installOperationSystem = false;
- boolean conditionOperationSystem = false;
- protected void installOs () {
- installOperationSystem = true;
- System.out.println("Operating system has been installed");
- }
- protected void runOperationSystem () {
- conditionOperationSystem = true;
- System.out.println("The operating system was launched");
- }
- }
- public class TestComputer {
- public static void main (String [] args){
- Computer mycomp = new Computer("lgFlatron", "asus", "asusMouse", "keyboard");
- OperationSystem operSystem = new OperationSystem();
- Calculator calculator = new Calculator();
- FileManager filemanager = new FileManager();
- System.out.print("List of unnecessary things: ");
- System.out.println(mycomp.toString());
- mycomp.switchOn();
- operSystem.installOs();
- operSystem.runOperationSystem();
- calculator.installCalculator();
- filemanager.installFileManager();
- /*В классе Calculator добавил boolean переменную и метод installCalculator()
- void installCalculator() {
- conditionCalculator = true;
- System.out.println("Calculator has installed");
- }
- аналогично с классом FileManager
- */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement