needs to be in basic pseudocode. with no specific language. I am looking for the
ID: 3869283 • Letter: N
Question
needs to be in basic pseudocode. with no specific language.
I am looking for the pseudoccode to look just like this.
start
Declarations
num itemPrice
num salespersonCommission
num customerDiscount
output “Welcome to the sales price calculator.”
output “This program will help you calculate the final”,
"price of a product adding in all factors.”
finalPrice= calculatePrice()
output “The total price after Commission, $” salespersonCommission, “and customer discount,”
“ customerDiscount “%, is”, finalPrice
stop
Please. this is the 3rd time I've posted this trying to get someone to help with the answer that I need in the way I need it.
3) 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
start
Declarations
num NumberOfRows = 70
num SeatsPerRow = 100
char seatingmap[NumberOfRows][SeatsPerRow]
num desiredRowNumber
num desiredSeatNumber
num currentRow
num currentSeat
num rowSeatsReserved
num totalSeatsReserved
num seatsAvailable
boolean bValidRowSeat = false
boolean bQuitProgram = false
initialize all values of seatingmap array to ''
set totalSeatsReserved to 0
seatsAvailable = NumberOfRows * SeatsPerRow
while seatsAvailable > 0 and bQuitProgram is false
while bValidRowSeat is false
Input the desired row
set desiredRowNumber to the input value
Input the desired seat
set desiredSeatNumber to the input value
call procedure IsValidRowSeat()
set return value to bValidRowSeat
if bValidRowSeat is false then
output “SEAT IS NOT AVAILABLE”
end if
endwhile
call procedure bookSeat()
call procedure printSeatingMapStatus()
call procedure verifyifProgramhastoQuit()
set bQuitProgram to return value
end while
stop
start Procedure IsValidRowSeat()
bValidRowSeat = True
if desiredRowNumber < 1 or desiredRowNumber > NumberOfRows then
bValidRowSeat = False
end if
if desiredSeat < 1 or desiredSeat > SeatsPerRow then
bValidRowSeat = False
end if
if bValidRowSeat is True then
if seatingmap[NumberOfRows][SeatsPerRow] = 'X' then
bValidRowSeat = false
end if
end if
return bValidRowSeat
stop Procedure
start Procedure verifyifProgramhastoQuit()
input "Quit Yes/No"
if input value is Yes then
set bQuitProgram = true
else
set bQuitProgram = false
end if
return bQuitProgram
stop Procedure
start Procedure printSeatingMapStatus()
output "Seating Map Reserved Seats"
for currentRow = 1 to NumberOfRows
output "Row: " + CurrentRow
for currentSeat = 1 to SeatsPerRow
if seatingmap[i][j] = 'X' then
output " Seat: " + currentSeat
end if
end for loop of currentSeat
end for loop of currentRow
output "TOTAL NUMBER OF RESERVED SEATS : " + totalSeatsReserved
output "TOTAL NUMBER OF AVAILABLE SEATS : " + seatsAvailable
stop Procedure
start Procedure bookSeat()
set seatingmap[desiredRowNumber] [desiredSeat]= 'X'
totalSeatsReserved = totalSeatsReserved + 1
seatsAvailable = seatsAvailable - 1
output "SEAT IS RESERVED. THANK YOU."
stop Procedure
Note:
I have shared the files at following link as well
https://drive.google.com/open?id=0B0-Ll2y6vo_sV0tYSWpfM3NQM1U
You can also go through the video talking about this pseudocode
https://youtu.be/kPD557HlqNg
please rate
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.