Our restaurants can’t seat parties of more than 8
people, and we don’t want reservations for 0
or less because that would be silly.
Inside Reservation()
constructor method , write a conditional that uses ||
.
If count
is less than 1
OR greater than 8
we want to write the following message: Invalid reservation!
.
So this is the question and
`
public class Reservation {
int guestCount;
int restaurantCapacity;
boolean isRestaurantOpen;
boolean isConfirmed;
public Reservation(int count, int capacity, boolean open) {
// Write conditional statement below
if(guestCount<1||guestCount>8)
{
System.out.println(“Invalid reservation!”);
}
`
this is the code i have written but my output is this
Invalid reservation!
Invalid reservation!
Reservation confirmed
Please enjoy your meal!
Reservation denied
Please enjoy your meal!
But if i write count in the place of guestCount in if condition in Reservation() constructor method the output is different.why is that?
Can anyone please help me with this??