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

Question #244748
Code a method named createVenue(). This method has no parameters, but returns a
Venue object.
Required:
a) Define a Scanner variable to read from the keyboard.
b) Define variables for building name, room number and number of seats. Prompt
the user to type data values for each of the variables and and read the values from
the keyboard.
c) Define and create a Venue object from the data read from the keyboard.
d) Return this Venue object
1
Expert's answer
2021-09-30T04:46:35-0400
public Venue createVenue() {
		// a) Define a Scanner variable to read from the keyboard.
		Scanner keyboard = new Scanner(System.in);
		// b) Define variables for building name, room number and number of seats.
		// Prompt the user to type data values for each of the variables and and read
		// the values from the keyboard.
		System.out.print("Enter a building name: ");
		String buildingName = keyboard.nextLine();
		System.out.print("Enter a room number: ");
		String roomNumber = keyboard.nextLine();
		System.out.print("Enter a number of seats: ");
		int numberSeats = keyboard.nextInt();
		// c) Define and create a Venue object from the data read from the keyboard.
		Venue venue = new Venue(buildingName, roomNumber, numberSeats);
		// d) Return this Venue object
		keyboard.close();
		return venue;
	}

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