469,126 Members | 1,255 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,126 developers. It's quick & easy.

program

I need help.

I have to write a pseudocode of this one problems (with visual basic):

- The Sleeping-Barber Problem. A barbershop consists of a waiting room
with n chairs and the barber room containing the barber chair. If there
are no customers to be served, the barber goes to sleep. If a customer
enters the barbershop and all chairs are occupied, then the customer
leaves the shop. If the barber is busy but chairs are available, then
the customer sits in one of the free chairs. If the barber is asleep,
the customer wakes up the barber. Write a program to coordinate the
barber and the customers.
Nov 20 '07 #1
3 836
debasisdas
8,127 Expert 4TB
Here we don't do homework / assignment of others.
Nov 20 '07 #2
lotus18
866 512MB
I agree with debasisdas

Please observe posting guidelines

http://www.thescripts.com/forum/faq...._or_coursework
Nov 20 '07 #3
jamesd0142
469 256MB
I need help.

I have to write a pseudocode of this one problems (with visual basic):

- The Sleeping-Barber Problem. A barbershop consists of a waiting room
with n chairs and the barber room containing the barber chair. If there
are no customers to be served, the barber goes to sleep. If a customer
enters the barbershop and all chairs are occupied, then the customer
leaves the shop. If the barber is busy but chairs are available, then
the customer sits in one of the free chairs. If the barber is asleep,
the customer wakes up the barber. Write a program to coordinate the
barber and the customers.

little help.. finish yourself...

Define variable:
dim BarberAsleep = false
dim BarberChair = 1
dim NoOfChairs = 5 'for example

Code:
'customer enters...
if BarberAsleep = true then
BarberAsleep = false
else
'check if barbaerseat is ocupied...
yes..
check waiting room seats
no...
customer sits...
all full
customer leaves,...

etc...
Nov 20 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

22 posts views Thread by edgrsprj | last post: by
11 posts views Thread by christopher diggins | last post: by
1 post views Thread by Eric Whittaker | last post: by
9 posts views Thread by Hemal | last post: by
7 posts views Thread by ibtc209 | last post: by
Banfa
2 posts views Thread by Banfa | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.