Pseudocode Construct

Can anyone give me construct a pseudocode for this program want to be able to better understand the processes and functions require to write the code. Its about a Movie Theater.


1. Login: when this activity is performed, the user enters their user-id; the program
searches the “login.bat” or “login.txt” file for that user-id. If the user-id is not found
in the login file the program informs the user that he/she is not a registered user and
then asks if he/she would like to register with the application. If the user chooses to
register with the application, initiate the Registration functionality (see functionality

2). Otherwise, if the user-id is found ask the user to enter their password and then
compare it with a copy of the password from the “login.*” file. If the credentials
match the program displays the program menu; other wise, advise the user that their
credentials are incorrect and ask the user is he/she wish to exit the program.

2. Register: when this activity is performed, the program accepts the following
customer date: full name, date of birth, age [calculated using date of birth], email
address, contact number, password, and date registered. The program should generate
a sequential user-id. Save all data (except the password) to a file called
“customer.dat”. The following data is saved to the login file (“login.dat” “login.txt”):
user-id, password, and category. The program randomly assigns a category [Worker,
Customer] to the user and informs the User of the category he/she is assigned. After
the user registers successfully offer the login screen (see functionality 1).

3. Add Movie: when this activity is performed, the program accepts the following movie
data from a Worker: movie code, title, PG rating [13, 16, MA], duration in minutes,
director of the movie, type of movie [action, comedy, romance], status [active,
inactive]. Only ACTIVE movies can be scheduled for showing. The Worker uses this
activity to add a new movie to the “movies.dat” file. This file will have data
pertaining to all movies shown/showing at the movie theatre.


4. Update Movie: when this activity is performed, the program accepts the movie code
from the Worker and changes the corresponding movie status in the “movies.dat”
file.

5. Movie Schedule: when this activity is performed the program generate a daily movie
schedule from the “movies.dat” file based on ACTIVE movies. All movies are
schedule 3 hours apart. Movies are shown from 11:00A.M. to MIDNIGHT every day.
The following data is stored in a file called “movieschedule – dd-mm-yyyy.dat”:
movie code, title, PG rating [13, 16, MA], duration in minutes, director of the movie,
type of movie [action, comedy, romance], and show time and price of movie ticket.
Only one (1) movie can be scheduled in a cinema at a time.

6. Buy Ticket: when this activity is performed the program displays a copy of the movie
schedule for that day. The Customer enters the movie code and the program searches
the “movieschedule – dd-mm-yyyy.dat” file using the movie code and displays the
movie title, duration, PG rating, show date, show time and price of the ticket. The
programs then asks the user to enter payment for the ticket if he/she is sure they want
to buy that ticket. Payment must be greater than or equal to the cost of the ticket.
Once payment is validated the program prints receipt and automatically initiates the
Generate Movie Ticket functionality.

7. Generate Movie Ticket: when this activity is initiated, ticket details such as: movie
title, date of movie, show time, PG rating, and price is displayed for the customer to
view on the screen and then added to a file called “tickets.dat”.

Notes
• On STARTUP the program should ONLY display the login screen. See
functionality 1.
• The Worker can perform all functionalities. While the Customer menu can ONLY
perform 1, 2, 6, and 7.
• The theatre can only seat 100 persons. Therefore the number of tickets sold
CANNOT exceed the number of seats in the cinema. See functionality 6.
• A customer can ONLY purchase 2 tickets at a time. See functionality 6.

Instructions
* use of modularity, randomization, arrays, repetition, structures, unions,
enumeration, and files.The user should be able to exit a screen/area of the program at
anytime.
There are several mostly independent pieces here. I'd write each one separately and test it. Then you can worry about hooking them together. For example, write the code to add a movie. Then use a small main() program to call that function. Run it an examine the movies.dat file to see if you did it right.

Some other thoughts:

I'd have the login() function return 3 possible values: successful login, registration request or unsuccessful login. The calling code can decide what to do based on that. Put another way, I would NOT have the login function call the registration code directly. One function should do one thing.

Q: if the user's password is wrong and they DON'T want to exit the program, what happens?

Q: #4: "changes the corresponding movie status" seems vague. Does this mean that that the sole function of "update" is to switch the movie status from active to inactive or vice versa? Can you edit the details of a movie?

If you can indeed edit the details of a movie then I'd have one function that edits an in-memory movie instance. The "add movie" function calls this with an empty record. "Update movie" calls it with a record read from the movies.dat.

I'd split up #6 into two bits of code. The first selects a movie, the second collects the payment.

Hope this helps.
i understand but its just to test if the used of the calling function is understand first before doing it into one function.
No the details remain the same basically the whole program can be constructed to a better working program but that the scenario i wanna solve whats given first before going onto more complex forms as you explained. so help me out with this psuedocode.
@Ndrewm
Show us your attempt at the first part then we can provide assistance/comment. If you can't get started then revise your class notes and textbook.:)
Well manage for my psuedocode so far but stuck NEED HELP BADLY!!!!!!!!!


Int Login()
START
DECLARE userId[10] , paswrd[10], cChoice AS CHARACTER
DECLARE CHANCES AS INTEGER
DECLARE userId 1[] = “ndrew”
DECLARE password1[] = “program”

PRINT “Enter USER Id Number”
INPUT userId
PRINT “Enter Your Password”
INPUT password

WHILE (chances)
PRINT“ENTER USER ID ----->”
INPUT userId
PRINT “ENTER YOUR PASSWORD---”
INPUT password

IF (strcmp(userId1, userId) == 0 AND strmp(passwrd1, password) == 0)
PRINT”Correct Username And Password”
break
Else
PRINT”INVALID USER NAME AND ID”
chances—
IF (!chances)

PRINT”YOU HAVE NO MORE CHANCES”
PRINT”DO YOU WANT TO REGISTER Y\N”)
IF (cChoice ==’y’ or cChoice == ‘y’)
PRINT”ENTER YOUE NEW ID USERNAME--”
INPUT userId1
PRINT “





Chances = 3
ENDWHILE

Void Register()
START
DECLARE custName[20], AS CHARACTER
DECALRE emailAdd, dateReg AS INTEGERS
DECLARE dob, age, birthyr, curryr = 2014 AS INTEGERS

PRINT”Enter Your Name”
INPUT custName
PRINT”Date Of birth”
INPUT dob
PRINT”ENTER YOUR BIRTH YEAR”
INPUT birthyr
PRINT”ENTER YOUR EMAIL ADDRESS”
INPUT emailAdd
PRINT”ENTER DATE REGISTERED”
INPUT dateReg

age = curryr – birthyr
save as cutomer.dat
display Login()
save as login.dat
STOP

Int AddMovie()
START
DECLARE movieCode AS INTEGER
DECLARE char MovieTitle[20] AS CHARACTER
DECLARE PgRating[] = {13, 16, MA} AS CHARACTER
DECLARE m_dur AS FLOAT
DECLARE movieDictr[20] AS CHARACTER
DECLARE movieType[] = {action, comedy, romance} AS CHARACTER
DECLARE movieStatus[] = {active, inactive} AS CHARACTER

IF movieStatus search == movie.dat
PRINT”%s”, active”
PRINT“MOVIE AVAIBLE FOR ENTRY”
PRINT”

ELSE
IF movieStatus search <> movie.dat
PRINT”inactive”
PRINT”MOVIE NOT AVAIBLE FOR SHOWING”
Fclose(movie.dat)
STOP

Int updateMovie()
DECLARE movieCode as INTEGER

PRINT”ENTER MOVIE CODE”

IF moviecode search = movie.dat file
1. Login:

- display login screen
- user inputs ID
- search login file for corresponding ID
- if no corresponding ID found on file
then inform user is not registered and ask user if user wants to register
- if user wants to register initiate registration function
otherwise display login screen
That's for the login cant wait to see the rest of it.
Cute, I thought that would be the response but not so fast! It's your turn to produce.
Look at my first post I did up to movie status n that's where it got complicated I jus like to get a different point if view of the pseudocodes before implementing in into c language. Reason y so fast I have till 8am to in morning to summit this pseudocode :-(
The sample I gave is, more or less, the way I was shown how to write pseudo code which is simply a translation of the given problem as a basis for detailed coding. You can see that it is substantially different to what you wrote. However it's your call where you go with it.

All the best with your assignment. :-)
Yea your input is fine i just transfer it to my format so please finish help me out and i code it to the way i know.
Registered users can post here. Sign in or register to post.