SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 32
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    can this be done with php?

    Hiya..

    have got my first job interview this friday (although it's not strictly web development..

    The only problem is.. that i have to do a test:
    -------------------------------------------------------------------
    The Test

    Please bring a program with you, in the programming language of your choice, to solve the following problem:

    We have a number of seminar rooms, say N, of different sizes. The sizes are given in some form convenient to the programming language you use - in a file, in an array, or by inputting them from the keyboard.

    There will be a six seminar sessions in each room throughout the day. The session start times (which are the same for all of the rooms) are given somehow, and again you can assume any mechanism that makes your programming easy.

    Write a program to print tickets for this event. Each ticket must show the room, the session start time, and the seat number. They should be ordered by start time, and within that by room number, and within that by seat number.

    Assume there is some routine like PRINTTICKET(ROOMNO, STARTTIME, SEATNO) which prints the actual ticket - I'm not interested in the layout of the ticket, or the way the language you use actually handles output. I'm not interested either in the detailed syntax of the language you use.
    ----------------------------------------------------------------------------------
    s

    shouldn't be too hard should it?

  2. #2
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, it could be done in PHP; not that difficult really when you consider that the bulk of the scripting would need to be based on well thought out and designed database schema - proberly the most important part of the above question.- Get the database design/relationships wrong and your basically screwed since your scripts wouldn't be able to display the correct information

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    schema?. how the database is layed out relationships etc?
    by printing do u think he means print to HTML? or hardcopy.. or ??

  4. #4
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Saint John
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Think of a theater, there are X amount of rooms in the theater, and 6 movies are played throught the day. Each room has different sizes, lets say Room 1 has 40 chairs, Room 2 has 50 chairs, Room 3 has 100 Chairs, and so on...

    Now you need to make a program that prints tickets for this event. And each ticket musht show the room number, when the session starts, and what seat number people are to get.

    I think first of all you need to make a system that creates profiles for each room. Because there are x amount of rooms, you will need to create them as they grow.

    Now, you will also need to create profiles for the seminar times.

    That way you will know specifically which room, and what time.

    If you know Visual Basic, this should be a fun program to do.

    Are you applying to an airline job?

    Btw, if its due friday, get your butt working on it quick.

  5. #5
    Non-Member Icheb's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    1,474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think they gave you that test for a reason - to test YOUR programming skills. If you can't solve it on your own, you may not be qualified for that job.

  6. #6
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    they are an event registration company.. they do all the registration,ticket issues (all automeated) for exhibitions..
    Did VB about 2 yrs ago in college and can't remember a thing!!

    Problem is i am only just starting out in php.. have got the web database applications book - http://www.amazon.co.uk/exec/obidos/...817147-9387803

    i know a bit.. but still scratchin my head think what info to store in the database

  7. #7
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well.. the job app said (you have mastered.. or ready to master.. HTML.. web design and some it skills!)

    got the HTML and web design pretty much sorted have done a bit of c and vb... (know the very basics of programming.. which was on my cv!

  8. #8
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Saint John
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats true Icheb. :/

  9. #9
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yep totally agree!.. just wanted to know if it could be done in php.. cheers guys will crack on with it!

  10. #10
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Saint John
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    damn, you can quickly do it if you had a VB book that tells you about odbc,
    just make a database in your computer and your set.
    makes it easy however...
    You could create it in php or asp.
    THink of it as a umm... registration system

    You will defenatly need to use my sql if you do it by php or asp heh..

    If you do it by vb, you can even do it in arrays, or text files.

    Arrays get ugly though..
    Wrap up:
    VB you can use access to make your database and such.. easy language to master quickly.

    :/

    Start doing it somehow.. if you need help just post your problems!

  11. #11
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cheers.. haven't got VB in my computer.. will try it will php/mysql... have got some good things in that book of mine.. spose store room session info in database.. and sort info by room number,start time and seat no.. and output to html

  12. #12
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Saint John
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What language do you undrstand and know to work best with?

  13. #13
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well.. I have been trying to learn php/mysql for about 2-3 months now... I can't understand it really because the job didn't say programming on the advert.. it's a graduate trainee role for web design,database management and some project management... that's why i couldn't undertand about this test!

    to be honest.. i'd have to say i know php the most.. the others i did very simple stuff in yr 1 of uni! (C and VB) I know the fundamentals of programming but haven't built any (proper) systems of it..

  14. #14
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Saint John
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    o :/

  15. #15
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Stick with PHP and your laughing, C is more difficult to grasp and use, as for VB: don't even go down that road Good Luck - btw how many positions are opening ?

  16. #16
    SitePoint Enthusiast Valkyre's Avatar
    Join Date
    Jun 2003
    Location
    California
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep.
    altStudio - Coming Soon

  17. #17
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you are all making this too complicated. They are asking if you can set up two loops (room, seminar) and iterate over them calling a PRINTTICKET function.
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  18. #18
    SitePoint Zealot Egghead's Avatar
    Join Date
    Feb 2002
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    I think you are all making this too complicated. They are asking if you can set up two loops (room, seminar) and iterate over them calling a PRINTTICKET function.
    I have to agree here. Why make things awkward? If you are only just learning databases, why not just use things you may already know. It may be svelt to shove all the info in a database and have bells and whistles, but you could use just a couple of arrays and maybe a form to enter/hold the information, and send it all to a function which prints out tickets on a simple HTML page.
    Simple. Quick. Job done. (But they will probably give the job to some other gifted soul)

  19. #19
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gavt78
    have got my first job interview this friday (although it's not strictly web development..

    The only problem is.. that i have to do a test:
    <snip=problem>
    shouldn't be too hard should it?
    To put a fine point on it, this problem is simple enought that they are being extreamly generous to give it as "take home" homework. I might be inclined to ask a technical question of this complexity on the fly in an interview and expect a candidate to come up with an answer in a few minutes.
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  20. #20
    WebAmoeba mythix's Avatar
    Join Date
    Aug 2002
    Location
    here
    Posts
    578
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why not just write it out in pseudo code?

    - it's quite a good wheeze, open a job appointment get the candidates to write a program, then tell them that the post has gone, and bang! you've got your program at no cost, lol.
    Laws are like sausages. You have much more respect for them if you haven't actually seen how they're made.

    http://www.webamoeba.co.uk

  21. #21
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cheers for the help guys... think I;m am going hold the info in arrays (but suggest that it can be done other ways)... just wasn't sure how to output it.. should i create a custom routine to output the info to html?

  22. #22
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gavt78
    Assume there is some routine like PRINTTICKET(ROOMNO, STARTTIME, SEATNO)...
    PHP Code:
    function PRINTTICKET($roomno$starttime$seatno) {
    echo 
    'assumed';

    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  23. #23
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right... Have tried to do it both ways...

    * I set up a database with 3 tables in:

    1 Room number
    2. Start times
    3. Seat No

    then I have done the function to output the data from the database.. How do i order (sort) the information from the database. and how can i if the tables are seperate?? god damn!!

    sorry if this seems trivial!

  24. #24
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    cheltenham
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have got:

    <?php
    /* Two ways of doing this
    Get information from database */

    //with database.. connnect etc..
    $db = mysql_connect("localhost", "root");
    mysql_select_db("tickets",$db);

    // or with array
    $roomno = array ( "1", "2", "3", "4", "5" );
    $starttime = array ( "10:00", "12:00", "13:00", "14:00", "15:00", "16:00");
    úseatno = array ("

    //display results

    function PRINTTICKET($roomno, $starttime, $seatno) {
    echo blah blah ;
    } ?>
    </body>
    </html>

    Question is.. gow do i set up an array for intergers (instead of putting "1", "2", etc..

  25. #25
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wink

    As long as your new employer continues to allow you to get your answers from sitepoint forums you might use
    PHP Code:
    $rooms = array(
    'room 1' => 75,
    'room 2' => 50,
    'room 3' => 60,
    'big theater' => 300);

    $times = array( '9:00AM''11:00AM''1:00PM''3:30PM');

    foreach (
    $rooms as $room => $capacity) {
        foreach(
    $times as $time) {
            for(
    $i=0$i<$capacity$i++) {
                
    PRINTTICKET($room$time$i+1);
            }
        }
    }

    function 
    PRINTTICKET($r$t$s) {
    echo 
    "$r Time $t Seat $s<br />";

    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •