Forum: Ruby Project for Ruby- Theater seating

6f8a67981ff5878b4239c91c340581d0?d=identicon&s=25 Sarah Jones (kristina_g)
on 2013-10-28 23:24
I need help...This is a project I have been trying to finish.

Write a program that can be used by a small theater to sell tickets.
The theater auditorium has 15 row of seats with 30 seats in each row.
The program should display a screen that show which seats are available
and which are taken.
Seats taken use *, seats available use #

When a program begins it should ask the user to enter the seat price for
each row. The prices can be stored in a separate array.(alternatively
the price can read from a file.)

Once price entered the program should display a seating chart. The user
may enter the row and seat number for tickets being sold. Every time a
tickets or group of tickets is purchased the program should display the
total ticket prices and update the seating chart.

The program should keep a total of all ticket sales. The user should be
given an option of viewing this amount.

The program should give the user an option to see a list of how many
seats have been sold, how many available in each row, and how many seats
are available in the entire auditorium.

input validation when tickets are being sold, do not accept row or seat
numbers that do not exist. When someone request a particular seat the
program should make sure seat is available before it is sold.

This is what I have so far...

def initialize(selections)

puts "_"*75q
3.times{puts " "*75+"|"}
puts " "*68+"EXIT"+[0x2b00].pack("U")
puts " "*76+"/"
puts " "*75+"/"
3.times{puts " "*75+"|"}

seats = (0...15).map{Array.new(30,"#")}
seats[5][2] = "*" # sample input
seats[6][3] = "*" # sample input
seats.each_index do |x|
  puts " "*(5 + x%2) + seats[x].join(" ") + " "*(11-x%2)+"|"
  puts " "*75+"|"
end
Ddc7d5a5874895f766400aa74966e4a2?d=identicon&s=25 chuong vu (Guest)
on 2013-10-29 03:39
(Received via mailing list)
You asked us this at the beginning of the month and said it was due in a
day or two. The code you provided was from another user and it looks the
same? Did you manage to do anything else?
Ddc7d5a5874895f766400aa74966e4a2?d=identicon&s=25 chuong vu (Guest)
on 2013-10-29 03:45
(Received via mailing list)
Oh and by the way I tried to run what you have so far and got an
unexpected
end error.
15000f55138ae94b0f362ed7c625461a?d=identicon&s=25 unknown (Guest)
on 2013-10-29 09:50
(Received via mailing list)
Am 28.10.2013 23:24, schrieb Kristina G.:
> def initialize(selections)
>
> puts "_"*75q

syntax error!

>   puts " "*(5 + x%2) + seats[x].join(" ") + " "*(11-x%2)+"|"
>   puts " "*75+"|"
> end

You are stuck here in the middle of a method definition
-> another syntax error

'def initialize' without a class is a little unusual.

And you never use the method argument 'selections'.

You can use "\u2b00" instead of [0x2b00].pack("U").

You should use variables for number of rows / seats per row
instead of hard coding the numbers into your program.

Frankly, considering you are working on this since a couple of
weeks ago, the result so far is a mess...
Before posting here you should at least try to run your code.

Regards,
Marcus
E0d864d9677f3c1482a20152b7cac0e2?d=identicon&s=25 Robert Klemme (robert_k78)
on 2013-10-29 14:03
(Received via mailing list)
On Tue, Oct 29, 2013 at 9:49 AM,  <sto.mar@web.de> wrote:

> Frankly, considering you are working on this since a couple of
> weeks ago, the result so far is a mess...

Also the deadline must have long since passed:

On Thu, Oct 3, 2013 at 2:07 AM, Kristina G. <lists@ruby-forum.com>
wrote:
> I have 1 more day and we are moving to another language....

I agree to what has been said before: for someone who has learned C++
and Java Ruby should not be too far off the mark.  After all concepts
of OO are the same regardless of language.

Cheers

robert
6f8a67981ff5878b4239c91c340581d0?d=identicon&s=25 Sarah Jones (kristina_g)
on 2013-10-29 14:44
Thanks. Sorry. Wrong post. Already completed! But if someone post
something they need help not opinions.
C993c6aaffc6cf7b477a5075099e1d36?d=identicon&s=25 Peter Hickman (Guest)
on 2013-10-29 15:13
(Received via mailing list)
On 29 October 2013 13:44, Sarah Jones <lists@ruby-forum.com> wrote:

> Thanks. Sorry. Wrong post. Already completed! But if someone post
> something they need help not opinions.
>
>
Thats your opinion and you are welcome to it :)
E0d864d9677f3c1482a20152b7cac0e2?d=identicon&s=25 Robert Klemme (robert_k78)
on 2013-10-29 16:50
(Received via mailing list)
On 29.10.2013 14:44, Sarah Jones wrote:
> Thanks. Sorry. Wrong post. Already completed! But if someone post
> something they need help not opinions.

Yes.  And what constitutes "help" of course depends on the case at hand.

Kind regards

  robert
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.