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

Question #243123

VenueControlClass

5. Code a method named createComputerLab().

Required: a. Define a Scanner variable to read from the keyboard. b. Define variables for building name, room number, number of seats and number of working computers. Prompt the user to type data values for each of the variables and read the values from the keyboard. c. Define and create a ComputerLab object from the data read from the keyboard. d. Return this ComputerLab object.

6. Code a method displayAllRooms(). This method has no parameters and is void. This

method displays all objects in the array. Required: a) Display a heading. 4 Applications Development Foundations b) Loop through the array and use the show() of every object to display the object details. c) Print a line after each object is displayed.


1
Expert's answer
2021-09-29T18:47:16-0400
import java.util.Scanner;

public class VenueControlClass {
    public ComputerLab createComputerLab() {
        Scanner in = new Scanner(System.in);
        System.out.println("Building name: ");
        String buildingName = in.nextLine();
        System.out.println("Room number: ");
        int roomNumber = Integer.parseInt(in.nextLine());
        System.out.println("Number of seats: ");
        int numberOfSeats = Integer.parseInt(in.nextLine());
        System.out.println("Number of working computers: ");
        int numberOfWorkingComputers = Integer.parseInt(in.nextLine());
        return new ComputerLab(buildingName, roomNumber, numberOfSeats, numberOfWorkingComputers);
    }

    public void displayAllRooms() {
        System.out.println("4 Applications Development Foundations:");
        for (ComputerLab lab : labs) {
            lab.show();
            System.out.println();
        }
    }
}

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