141k views
1 vote
This project is to mimic a meeting request system by checking the requesting party’s validity, and the number of people attending. Then it will make a decision as to whether the meeting can take place and display an informative message.

Display a welcome message and then ask the user to enter his/her name Display a personal welcome message by addressing the user by his/her name. Declare a constant and assign a number to it as the Conference Room capacity.

Ask the user how many people are attending the meeting. Display a meaningful message for each of the three different scenarios. The message informs the user whether he/she can have the requested room and also displays the number of people that must be excluded or that can still be invited based on the room capacity. Here are the three scenarios.

people attending are fewer than the Room Capacity
people attending are more than the Room Capacity
people attending are exactly the same as the Room Capacity

The system will keep running until the user quits (meaning all this happens in a loop)

1 Answer

4 votes

Answer:

See explaination for the program code

Step-by-step explanation:

Meeting.java

------

import java.util.Scanner;

public class Meeting {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

final int ROOM_CAPACITY = 100;

int numPeople, diff;

String name;

System.out.println("****** Meeting Organizer ******");

System.out.print("Enter your name: ");

name = input.nextLine();

System.out.println("Welcome " + name);

do{

System.out.print("\\How many people would attend the meeting? (type 0 to quit): ");

numPeople = input.nextInt();

if(numPeople < 0)

System.out.println("Invalid input!");

else if(numPeople != 0)

{

if(numPeople > ROOM_CAPACITY)

{

diff = numPeople - ROOM_CAPACITY;

System.out.println("Sorry! The room can only accommodate " + ROOM_CAPACITY +" people. ");

System.out.println(diff + " people have to drop off");

}

else if(numPeople < ROOM_CAPACITY)

{

diff = ROOM_CAPACITY - numPeople;

System.out.println("The meeting can take place. You may still invite " + diff + " people");

}

else

{

System.out.println("The meeting can take place. The room is full");

}

}

}while(numPeople != 0);

System.out.println("Goodbye!"); }

}

output

---

****** Meeting Organizer ******

Enter your name: John

Welcome John

How many people would attend the meeting? (type 0 to quit): 40

The meeting can take place. You may still invite 60 people

How many people would attend the meeting? (type 0 to quit): 120

Sorry! The room can only accommodate 100 people.

20 people have to drop off

How many people would attend the meeting? (type 0 to quit): 100

The meeting can take place. The room is full

How many people would attend the meeting? (type 0 to quit): 0

Goodbye!

User AToz
by
5.7k points