Java code X1 Practice ProblemYou are writing a programfor an architectural firm that needs to enter the areasof all the rooms in a building project they’re working on. Some rooms are square, some are round, and some are rectangular. Each room in the building has an ID number to help prevent adding the same room more than once. The program needs to prompt the user for the room ID number, the shape of the room, and the dimensionsneeded to calculate the area. It should store the ID number and the calculated area in sq. ft. (rounded to the nearest foot) of each room in a single integer ArrayList in the order:ID, area, ID, area, ... If the room ID has already been entered, it should let the user know and prompt for another. The program should continue running until the user chooses to close the program. It should also allow the user to view a list of the current rooms’IDs and areas, the total area, and the average room area.The program will need at least the following methods. The only global variable shouldbe a Scanner object.•public static void main(String[] args)controls the flow of the program and manages the integer ArrayList.It will present the user with the choice to enter a new room, view room statistics, or exit the program. If an invalid choice is made, it should just repeat the menu of choices.•public static void getRoomId(ArrayList data)asks the user for the ID of the room they’re reporting on, checks to make sure that ID has not already been entered, and adds the ID to the ArrayList. It should bulletproof input and allow the user to keep trying until a valid, unique ID is entered.•public static int getRoomShape() gets the room shape selection from the user by presenting a numbered menu (such as 1 –square, 2 –round, 3 –rectangular.) It should bulletproof input and allow the user to keep trying until a valid choice is entered.•public static int calcArea(int roomShape)calculates the room area based on the shape of the room selected, prompting the user for the data needed to do the calculation (width for square, diameter for round, length and widthrectangular.)•public static void displayStats(ArrayList data) reads all the data stored in the ArrayList, prints out the entire list of room IDs and areas, followed by the total area of all the rooms added together and the average room area based on the number of rooms currently entered.You are welcome to add more methods if necessary, but you have to have the above methods. The program should be error free and user friendly. Proper indentation and spacing is expected, but you do not have to add JavaDoc comments.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter11: More Object-oriented Programming Concepts
Section: Chapter Questions
Problem 2GZ
icon
Related questions
Question

Java code

X1 Practice ProblemYou are writing a programfor an architectural firm that needs to enter the areasof all the rooms in a building project they’re working on. Some rooms are square, some are round, and some are rectangular. Each room in the building has an ID number to help prevent adding the same room more than once. The program needs to prompt the user for the room ID number, the shape of the room, and the dimensionsneeded to calculate the area. It should store the ID number and the calculated area in sq. ft. (rounded to the nearest foot) of each room in a single integer ArrayList in the order:ID, area, ID, area, ... If the room ID has already been entered, it should let the user know and prompt for another. The program should continue running until the user chooses to close the program. It should also allow the user to view a list of the current rooms’IDs and areas, the total area, and the average room area.The program will need at least the following methods. The only global variable shouldbe a Scanner object.•public static void main(String[] args)controls the flow of the program and manages the integer ArrayList.It will present the user with the choice to enter a new room, view room statistics, or exit the program. If an invalid choice is made, it should just repeat the menu of choices.•public static void getRoomId(ArrayList<Integer> data)asks the user for the ID of the room they’re reporting on, checks to make sure that ID has not already been entered, and adds the ID to the ArrayList. It should bulletproof input and allow the user to keep trying until a valid, unique ID is entered.•public static int getRoomShape() gets the room shape selection from the user by presenting a numbered menu (such as 1 –square, 2 –round, 3 –rectangular.) It should bulletproof input and allow the user to keep trying until a valid choice is entered.•public static int calcArea(int roomShape)calculates the room area based on the shape of the room selected, prompting the user for the data needed to do the calculation (width for square, diameter for round, length and widthrectangular.)•public static void displayStats(ArrayList<Integer> data) reads all the data stored in the ArrayList, prints out the entire list of room IDs and areas, followed by the total area of all the rooms added together and the average room area based on the number of rooms currently entered.You are welcome to add more methods if necessary, but you have to have the above methods. The program should be error free and user friendly. Proper indentation and spacing is expected, but you do not have to add JavaDoc comments.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning