Answer to Question #243111 in Java | JSP | JSF for Chadwin Fritz

Question #243111

ComputerLab

-numberWorkingComputer:int

+<>ComputerLab()

++<>ComputerLab(int,String,String,int)

+setNumberWorkingComputers(int):void

+getNumberWorkingComputer():int

+toString():String

+show():void

+problemVenue():boolean

Code the attributes and methods as per diagram for the ComputerLab class. 1 Remember to call the superclass constructors in the coding of the ComputerLab constructors. 2 Remember to call the superclass toString() in the ComputerLab toString(). 3 Code the show() method. This method is void and displays the details of a ComputerLab object. Again, remember to call the show() of the superclass. Building name: Engineering, Venue number: 1.24, Number of seats: 40, Number of working computers: 35 4, Code the method problemVenue. This method returns a boolean value of true if the numberSeats in the computer lab is more than the numberWorkingComputers, else a boolean value of false is returned.


1
Expert's answer
2021-09-28T11:43:13-0400
public class ComputerLab extends Building {
    private int numberWorkingComputer;

    public ComputerLab() {
        super("Unknown", "0", 0);
        numberWorkingComputer = 0;
    }

    public ComputerLab(int numberWorkingComputer, String buildingName, String venueNumber, int numberOfSeats) {
        super(buildingName, venueNumber, numberOfSeats);
        this.numberWorkingComputer = numberWorkingComputer;
    }

    public void setNumberWorkingComputer(int numberWorkingComputer) {
        this.numberWorkingComputer = numberWorkingComputer;
    }

    public int getNumberWorkingComputer() {
        return numberWorkingComputer;
    }

    public void show() {
        super.show();
        System.out.println(", Number of working computers: " + numberWorkingComputer);
    }

    public boolean problemVenue() {
        return getNumberOfSeats() > numberWorkingComputer;
    }

    @Override
    public String toString() {
        return super.toString() + ", Number of working computers: " + numberWorkingComputer;
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS