I need a pseudocode that looks like this example please. nothing else only a pse
ID: 3869597 • Letter: I
Question
I need a pseudocode that looks like this example please. nothing else only a pseudo that looks this way will give a thumbs up.
THIS IS AN EXAMPLE ONLY!
I am looking for the answer to the question that will appear AT THE BOTTOM and this EXAMPLE is how I'm looking for it to be.
BEGIN EXAMPLE
start
Declarations
string customerName
string serviceType
num feeForService
num calculateParkingFee
num calculateShuttleFee
output “Welcome to the airports service calculator”
output “This program will help you calculate you fee”,
“depending on what service you would you need.”
output “Enter your name”
input customerName
output “What service will you be using today?”
input seriviceType
if (serviceType = parking) then
fee= calculateParkingFee()
else
fee= calculateShuttleFee()
endif
output “The total fee for”, customerName, “for service,” ,
serviceType, “, is $”, fee
stop
num calculateParkingFee()
Declarations
string frequentParkerProgramMember
num numOfDaysParking
num finalFee
output “Are you a frequent parking program member?”,
“Y or N”
input frequentParkerProgramMember
output “How many days will you be parked here?”
input numOfDaysParking
fee = 12 * numOfDaysParking
if (frequentParkerProgramMember = Y) then
finalFee = fee – (fee * (10/100))
return finalFee
else
return fee
endif
return
num calculateShuttleFee()
Declarations
num numberOfPassengers
num numberOfBags
num finalFee
output “How many passengers?”
input numberOfPassengers
output “How many bags will each passenger have?”
input numberOfBags
fee = 29 + (numberOfBags – 1)*2
if numberOfPassengers >=2 then
finalFee = fee * numberOfPassengers
return finalFee
else
return fee
endif
return
END EXAMPLE
START OF QUESTION I NEED ANSWERED. ABOVE IS EXAMPLE ONLY
The seating map for a particular performance at a theater contains 70 rows of 100 seats each.
Assume that the following declarations have been made:
num desiredRowNumber
num desiredSeatNumber
num currentRow
num currentSeat
num rowSeatsReserved
num totalSeatsReserved
num seatsAvailable
a) Declare any other variables and constants needed and a 2-dimensional array to represent the seating map. This seating map applies only to this particular show. For other shows, the seating map may contain a different number of rows and seats per row, and the program must be capable of being modified for those by editing only two lines of code. Page 3 of 3
b) Allow a user to continuously enter a row number and seat number until they enter an appropriate sentinel value for the row number in order to stop entering input. Each time the user enters a valid row and seat number, the program determines if that seat is available, and if so, marks it as reserved with an “X” (available seats are not marked in any way). If the seat is not available, the program informs the user of this.
c) Once the user quits, the program outputs
i) each row number followed by the seat numbers in that row that have been reserved
ii) the total number of reserved seats
iii) the total number of available seats
Explanation / Answer
Please find the psuedo code for the problem discussed.
Code:
Start
Declare booking as dynamic two dimentional array of char
declare i, j
input desiredRowNumber;
input desiredSeatNumber
while desiredRowNumber >= 1 and desiredRowNumber <= desiredRowNumber do:
output “enter current row required?”
input currentRow
if desiredRowNumber >= 1 and desiredRowNumber <=desiredRowNumber then
output “enter current seat required?”
input currentSeat
if currentSeat >= 1 and currentSeat <=desiredSeatNumber and booking[currentRow][desiredRowNumber] == X then
output "Seat is reserved"
else booking[currentRow][desiredRowNumber] = X
end if
end if
end While
totalSeatsReserved = 0
for i = 1 to desiredRowNumber
output “row number : ", i
for j = 1 to desiredSeatNumber
if booking[currentRow][desiredRowNumber] == X then
output "Seat number", j
totalSeatsReserved = totalSeatsReserved + 1;
end if
end for
end for
output "totalSeatsReserved : ", totalSeatsReserved
seatsAvailable = (desiredRowNumber * desiredSeatNumber) - totalSeatsReserved
output "seatsAvailable : ", seatsAvailable
Stop
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.