1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
const2013 [10]
3 years ago
14

ABC Resort and Hotel has approached you to write a program to keep track of the number of rooms needed for an event. Customers c

an request any one of the following types of rooms to be reserved. Because the hotel has limited rooms available for a given event, it can only reserve up to 39 rooms. However, the hotel does not know how many rooms, in total, will be reserved because the rooms are reserved on demand.
Create a program for use by the hotel staff to take reservation orders for rooms for an event. All events are single night stay events. So you do not need to worry about the number of nights they are staying. An order occurs when the user enters a room type by name (e.g. Single). Until the user has indicated they are finished entering room types, continue to prompt the user to enter a room type. You must validate the room type, providing an error message and re-prompting the user if an invalid room type is entered. Keep track of the number of rooms that will be reserved for each room type.

Room Type Price/per night
Single $79.95
Single Deluxe $99.95
Double $149.95
Double Deluxe $179.95

Once the user has indicated they are finished entering room types, display a well-formatted report containing a list of each room type with its associated price, the number of rooms needed for that room type, the total revenue from all rooms for the event, and the average revenue from a room for the event.
Your solution must demonstrate the concept of one-dimensional arrays.
Solution Design:
1) Create a defining diagram that shows the input, processing, and output.
2) Create a solution algorithm using pseudocode.
3) Show testing using the desk checking table method, to include test data, expected results, and a desk checking table. Make sure your desk checking considers multiple cases including both valid and invalid test data to prove your algorithm will work in all cases.
Computers and Technology
1 answer:
nexus9112 [7]3 years ago
5 0

Answer:

Check the explanation

Explanation:

/ Pseudocode for tracking the reservation of rooms for an event

Declaration

 

  string roomInput;

  string roomNames[4];

  number roomPrice[4];

  number roomCount[4];

  number i;

  boolean roomFound;

  number totalRevenue, avgRevenue;

  number totalRoomsNeeded;

Start

 

  // initialize the room names, and price for each room

  // array index starts from 0 and goes to n-1 where n is the total number of elements in the array

  roomNames[0] = "Single";

  roomNames[1] = "Single Deluxe";

  roomNames[2] = "Double";

  roomNames[3] = "Double Deluxe";

 

  roomPrice[0] = 79.95;

  roomPrice[1] = 99.95;

  roomPrice[2] = 149.95;

  roomPrice[3] = 179.95;

 

  // initialize each room count to 0 at the start

  for(i=0;i<4;i++)

  do

      roomCount[i] = 0;

  end for  

 

  // input the room type, user should type exit to indicate they are done

  Display "Enter room type ('exit' to quit ) : ";

  Input roomInput;

 

  // loop that continues till user types quit

  while(roomInput != "quit")

  do  

      roomFound = false;

      // loop to determine if user input is valid and increment the associated room count

      for(i=0;i<4;i++)

      do

          if(roomNames[i] == roomInput) then

              roomCount[i] = roomCount[i] + 1;

              roomFound = true;

          end if

      end for

     

      // if invalid room type, display error

      if(roomFound == false) then

          Display "Invalid input for Room type. Room type can be Single or Single Deluxe or Double or Double Deluxe ";

      end if  

     

      Display "Enter room type ('exit' to quit ) : ";

      Input roomInput;

  end while

 

  // set totalRevenue and totalRoomsNeeded to 0

  totalRevenue = 0;

  totalRoomsNeeded = 0;

  Display("Room Type Price($) Rooms Needed");

  // loop to display each room type details and calculate the totalRevenue and totalRoomsNeeded

  for(i=0;i<4;i++)

  do

      Display(roomNames[i],roomPrice[i],roomCount[i])

      totalRevenue = totalRevenue + (roomPrice[i]*roomCount[i]);

      totalRoomsNeeded = totalRoomsNeeded + roomCount[i];

  end for  

 

  // calculate average revenue

  if(totalRoomsNeeded > 0) then

      avgRevenue = totalRevenue/totalRoomsNeeded;

  else

      avgRevenue = 0;

  end if

 

  // display the total revenue and average revenue

  Display("Total revenue from all rooms : $",totalRevenue);

  Display("Average revenue from a room : $",avgRevenue);

 

End  

//end of pseudocode

You might be interested in
A Homecoming Crossword Puzzle
nasty-shy [4]

Answer:

Umm do you need ideas for that? Like words for it?

Explanation:

6 0
3 years ago
Which of the following statements is FALSE?
valentinak56 [21]
B. Late breaking news typically goes to television coverage before the Internet because of accessibility
4 0
3 years ago
Read 2 more answers
Describe the features of agile modeling​
Allushta [10]

Answer:

si gigi hadid tapos si bella poarch

Explanation:

7 0
3 years ago
In what ways was the first Mac OS different from the operating systems used by most early PCs? Users clicked on pictures to laun
777dan777 [17]

Users didn't have to memorize lots of commands.

3 0
3 years ago
Write a recursive method that tests whether a string is a palindrome. It should return a boolean T or F depending on whether or
Sveta_85 [38]

Answer:

// program in java.

// library

import java.util.*;

// class definition

class Main

{

// recursive function to check palindrome

   public static boolean isPalin(String str){

// base case

     if(str.length() == 0 ||str.length()==1){

        return true;

     }

// if first character is equal to last

     if(str.charAt(0) == str.charAt(str.length()-1))

     {

     // recursive call

        return isPalin(str.substring(1, str.length()-1));

     }

     // return

     return false;

  }

  // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // object to read input

Scanner scr=new Scanner(System.in);

System.out.print("Enter a string:");

 // read string from user

String myString =scr.nextLine();

 // call function to check palindrome

     if (isPalin(myString)){

        System.out.println("Given String is a palindrome");

     }

// if string is not palindrome

     else{

        System.out.println("Given String is not a palindrome");

     }    

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read a string from user and assign it to variable "myString" with scanner object. Call the method isPalindrome() with string input parameter.In this method, if  length of string is 0 or 1 then it will return true(base case) otherwise it will call itself and compare first character with last character.If string is palindrome then function will return true else return false.

Output:

Enter a string:ababa                                                                                                      

Given String is a palindrome

8 0
4 years ago
Other questions:
  • Database management systems _____. a. include transaction-processing reports for database analysis b. are used to create, organi
    6·1 answer
  • In which type of land contract does the seller earn interest on the difference between what the seller owes on an existing loan
    14·1 answer
  • Choose the correct statement about the UNIX family of operating systems:
    7·1 answer
  • Which term is used to define the wires on a motherboard that move data from one part of a computer to another?
    13·1 answer
  • Logical address is generated by,
    13·1 answer
  • Being able to express your thoughts in an email is a primary technology skill. true or false.
    9·2 answers
  • AI structure question. Please help
    9·1 answer
  • Can someone help plz, I’d really appreciate it
    7·1 answer
  • true false the if statement causes one or more statements to execute only when a boolean expression is true
    10·1 answer
  • A maxillary partial denture will have a ____ connector, and the mandibular partial denture will have a ____ connector.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!