Solved

# Implementing abstract data types

Posted on 1997-09-22

Hi,

I am trying to figure out how to do this problem and I don't have the faintest idea what to do. I need a few hints or advice on how to implement this reservation system. It suppose to use some sort of array system and if there is an easier way to handle this ... that will be great!

************************************************************

Implement the following abstract datatype reservation system (RS) that provides

the following 7 operations.

create: --> RS

Sem.: starts the reservation system

create-new-event: RSxEVNRxNAT -> RS

Sem.: creates a new event with NAT seats with a given event-number

cancel-event: RSxEVNR -> RS

Sem.: cancels the event with the given number

reserve-seat: RSxEVNRxSSN -> RS

Sem.: reserves a seat for a person with a given ssn for a given event

remove-per-res: RSxSSN -> RS

Sem.: removes the all reservation of a given person

get-ev-res: RSxEVNR -> set-of(SSN)

Sem.: gives the set reservations for a given event,

get-pers-res: RSxSSN -> set-of(EVNR)

Sem.: gives the set of events, a person has reservations for.

get-events: RS -> set-of(EVNR)

Sem.: returns the set of the currently defined events

In the above, the following types have the following meaning:

EVNR are numbers between 1 and 999999999 used to identify events; eventnumbers

are not necessarily consecutive.

NAT represents a positive integer between 1 and 1000 that is used to specify

the number of available seats for the event.

SSN represents social security numbers, which are used to identify persons that

made reservations for a particular event; ssn have to be numbers between

100000000 and 999999999.