Question

In: Computer Science

Using RAPTOR Create a flowchart and create the pseudocode for the following question Le Chef Heureux...

Using RAPTOR Create a flowchart and create the pseudocode for the following question

Le Chef Heureux Restaurant has 20 tables that can be reserved at 5 p.m., 7 p.m., or 9 p.m. Design a program that accepts reservations for specific tables at specific times; the user enters the number of customers, the table number, and the time. Do not allow more than four guests per table or invalid table numbers or times. If an attempt is made to reserve a table already taken, reprompt the user. Continue to accept reservations until the user enters a sentinel value or all slots are filled. Then display all empty tables in each time slot.

Solutions

Expert Solution

Here is Solution for Above Program ::



import java.io.*;
import java.util.*;
class Restaurant {
        public static void main (String[] args) {
                Scanner sc=new Scanner(System.in);
                
                System.out.println("----------------Welcome to Le Chef Heureux Restaurant-----------------------------------");
            
             int tables=20;
             //Here 0 to 19 for time 5.00pm 20 to 39 for time 7.00pm and 40 to 59 for time 9.00pm
             int table_check[]=new int[60];
             Boolean status[]=new Boolean[60];
             
              for(int i=0;i<60;i++)
              {
                  status[i]=false;
                  table_check[i]=0;
              }
             int cust_no=0;
             int table_no=0;
             int time=0;
             System.out.println("\nEnter Details for Reservations Like :: No of Customer(Not more then 4 per table) , Table No(1 to 20) and Time(5,7 and 9 PM) ");
           
            while(true)
            {
               cust_no=sc.nextInt();
               table_no=sc.nextInt();
               time=sc.nextInt();
               if(cust_no<=4 && table_no<=20 && (time==5 || time==7 || time==9))
               {
                   
                       if((status[table_no-1]==false || table_check[table_no-1]+cust_no<=4)&& time==5  )
                       {
                           table_check[table_no-1]+=cust_no;
                           status[table_no-1]=true;
                          System.out.println("your request accepted!!"); 
                       }
                       else if((status[20+table_no-1]==false || table_check[20+table_no-1]+cust_no<=4)&& time==7  )
                       {
                           table_check[20+table_no-1]+=cust_no;
                           status[20+table_no-1]=true;
                          System.out.println("your request accepted!!"); 
                       }
                       else if((status[40+table_no-1]==false || table_check[40+table_no-1]+cust_no<=4)&& time==9)
                       {
                           table_check[40+table_no-1]+=cust_no;
                           status[40+table_no-1]=true;
                         System.out.println("your request accepted!!"); 
                       }
                   else{
                       
                      System.out.println("your request Rejected!!"); 
                   }
                   
               }
               else
               {
                 System.out.println("Invalid Entered Details! Please try again!");
               }
               int c=0;
               for(int i=0;i<20;i++)
                   {
                      if(status[i]==true && table_check[i]==4)
                       {
                           c++;
                       }
                      if(status[i+20]==true && table_check[i+20]==4)
                       {
                           c++;
                       }
                      if(status[i+40]==true  && table_check[i+40]==4)
                       {
                           c++;
                       }   
                   }
               if(c==60)
               {
                   System.out.println("All Slots are Full!");
                  break;
               }
               else{
                   
               System.out.println("Waiting for Request!");
               int x=sc.nextInt();
               System.out.println("Enter 0 for Exit or any key for continue");
               if(x==0)
                 break;
               }
               
               
               
            }
            
           int sum5=0;
           int sum7=0;
           int sum9=0;
                   for(int i=0;i<20;i++)
                   {
                       if(status[i]==false)
                       {
                           sum5++;
                       }
                       if(status[i+20]==false )
                       {
                           sum7++;
                       }
                       if(status[i+40]==false)
                       {
                           sum9++;
                       }
                       
                   }
                   System.out.println("Total Empty Tables for Time 5.00PM "+sum5);
                   System.out.println("Total Empty Tables for Time 7.00PM "+sum7);
                   System.out.println("Total Empty Tables for Time 9.00PM "+sum9);
                   System.out.println();
            
            
        }
}

Test is Input Look Like ::

input :

4 3 5
1
2 5 9
1
4 4 7
0

Output :

----------------Welcome to Le Chef Heureux Restaurant-----------------------------------

Enter Details for Reservations Like :: No of Customer(Not more then 4 per table) , Table No(1 to 20) and Time(5,7 and 9 PM) 
your request accepted!!
Waiting for Request!
Enter 0 for Exit or any key for continue
your request accepted!!
Waiting for Request!
Enter 0 for Exit or any key for continue
your request accepted!!
Waiting for Request!
Enter 0 for Exit or any key for continue
Total Empty Tables for Time 5.00PM 19
Total Empty Tables for Time 7.00PM 19
Total Empty Tables for Time 9.00PM 19

FLowchart can we developed from above code :

takeinput------>>checking value input ->>>if ok----->>go head --else say invalid details.

from go head to------->> checking table status if all ok ---> accept it else reject it. and ----------->>again takeinput


Related Solutions

create flowchart using Flowgorithm and Pseudocode for the following program example:   Design a program for Jones...
create flowchart using Flowgorithm and Pseudocode for the following program example:   Design a program for Jones College. The current tuition is $12,000 per year, and tuition is expected to increase by 5 percent each year. Display the tuition amount for each year over the next five years (use a looping structure).
Need this program in Raptor. Post the pseudocode and the flowchart please! Brewster’s Used Car, Inc....
Need this program in Raptor. Post the pseudocode and the flowchart please! Brewster’s Used Car, Inc. employs several salespeople. Brewster, the owner of the company, has provided a file named sales.txt that contains the sales records for each salesperson for the past month. Each record in the file contains the following two fields: The salesperson’s ID number, as an integer The amount of a sale, as a real number The records are already sorted by salesperson ID. Design a program...
DESIGN IN RAPTOR PROGRAMMING APP Le Chef Heureux Restaurant has 20 tables that can be reserved...
DESIGN IN RAPTOR PROGRAMMING APP Le Chef Heureux Restaurant has 20 tables that can be reserved at 5 p.m., 7 p.m., or 9 p.m. Design a program that accepts reservations for specific tables at specific times; the user enters the number of customers, the table number, and the time. Do not allow more than four guests per table or invalid table numbers or times. If an attempt is made to reserve a table already taken, reprompt the user. Continue to...
what is the flowchart in RAPTOR for the following: Write a program that allows a tax...
what is the flowchart in RAPTOR for the following: Write a program that allows a tax accountant to compute personal income tax. Your program will ask for a filing status (0 for single, 1 for married filing jointly, 2 for married filing separately) and a taxable income. The program will compute the tax. Please use the following chart to find the tax rate to use to compute the tax:  (0) Single: o $0 - $33,950 --> 10% o $33,951...
Write a Python program that: Create the algorithm in both flowchart and pseudocode forms for the...
Write a Python program that: Create the algorithm in both flowchart and pseudocode forms for the following requirements: Reads in a series of positive integers,  one number at a time;  and Calculate the product (multiplication) of all the integers less than 25,  and Calculate the sum (addition) of all the integers greater than or equal to 25. Use 0 as a sentinel value, which stops the input loop. [ If the input is 0 that means the end of the input list. ]...
Homework Arrays and Tables In this assignment you are to create an algorithm, flowchart, and pseudocode...
Homework Arrays and Tables In this assignment you are to create an algorithm, flowchart, and pseudocode for a solution of the following problem. This solution will include the use of arrays needed to complete all parts of the logic. You have requested to develop a program that will record and process the rainfall totals of a 12 month period. You would use an array to store each months total. Once all 12 months amounts are entered then your solution need...
Design a program using a flowchart or pseudocode that accepts a person’s loyalty card number and...
Design a program using a flowchart or pseudocode that accepts a person’s loyalty card number and amount spent in the store last month. Display the data only if the customer is a high spender – a person who spent more than $1000 in the store. A program that accepts customer info continuously until a sentinel value is entered and displays a list of high spenders.
Selection/Conditional Structure: Create a flowchart and pseudocode for the problem below: Juan dela Cruz Restaurant is...
Selection/Conditional Structure: Create a flowchart and pseudocode for the problem below: Juan dela Cruz Restaurant is offering a 20% discount to all customers whose last name is also dela Cruz. Input the last name of the customer and the total amount due to the customer and then output the amount to be paid. (C++ Program, choose only the LAST NAME)
Using RAPTOR create a program that allows the user to input a list of first names...
Using RAPTOR create a program that allows the user to input a list of first names in on array and last names into a parallel array. Input should be terminated when the user enters a sentinel character. the output should be a list of email address where the address is of the following form: [email protected]
Write an algorithm (flowchart OR Pseudocode) for the following problem Take input character from the user...
Write an algorithm (flowchart OR Pseudocode) for the following problem Take input character from the user unless he enters '$'. Thereafter display how may vowels were entered by the user. Also display the number of each vowel ('a', 'e', 'i', 'o' and 'u') separately. For example if the user enters B a b e c o o d i u g o a l $ Then we have the output below: #A=2 #E=1 #I=1 #O=3 #U=2
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT