Closed Thread
Results 1 to 6 of 6

Thread: (Help) The model class

  1. #1
    450081592 is offline Newbie
    Join Date
    Oct 2009
    Posts
    13
    Rep Power
    0

    (Help) The model class

    The Model

    Create a Seat class that represents a seat at a stadium such that each seat is identified by 3 pieces of
    information as follows: the section number (a byte from 1 to 4), the row letter (a char from 'A' to 'Z') and
    the seat number within the row and section (a byte from 1 to 9). A seat must be identified by all three
    pieces of information, for example, seat 4B8 would be the seat number 8 in section 4, row B. Each seat
    has a cost according to the section. The seat costs are as follows: section 1 = $74, section 2 = $47,
    section 3 = $32 and section 4 = $19. Make the following static constant in the Seat class to store
    these: public static int[] PRICING = {74, 47, 32, 19}; Each seat may be purchased for up to 4
    games/events. Add a boolean[] array that keeps track of whether or not the seat has been purchased
    for any of the 4 games/events.
    Create a Stadium class that maintains a 2 dimensional array of Seat objects. The array should be
    exactly 35 columns by 27 rows in size. Not all of the locations in the grid represent seats. Some of the
    locations represent aisles and the rink/stage area itself.
    Get the following text files as off of the course webpage: "sections.txt", "rows.txt" and "numbers.txt".
    The "sections.txt" file contains a layout of characters representing the section numbers for all seats:

    Section:
    333333333 333333333 333333333
    333333333 333333333 333333333
    333333333 333333333 333333333

    3 22222222 2222222 22222222 3
    33 2222222 2222222 2222222 33
    33 2 2 33
    33 22 1111111 11111 1111111 22 33
    33 22 111111 11111 111111 22 33
    44 22 1 11111 11111 11111 1 22 44
    44 22 11 --------------- 11 22 44
    44 22 111| |111 22 44
    44 22 111| |111 22 44
    111| |111
    44 22 111| |111 22 44
    44 22 111| |111 22 44
    44 22 11 --------------- 11 22 44
    44 22 1 11111 11111 11111 1 22 44
    33 22 111111 11111 111111 22 33
    33 22 1111111 11111 1111111 22 33
    33 2 2 33
    33 2222222 2222222 2222222 33
    3 22222222 2222222 22222222 3

    333333333 333333333 333333333
    333333333 333333333 333333333
    333333333 333333333 333333333


    rows:
    CCCCCCCCC FFFFFFFFF IIIIIIIII
    BBBBBBBBB EEEEEEEEE HHHHHHHHH
    AAAAAAAAA DDDDDDDDD GGGGGGGGG

    Z BBBBBBBB DDDDDDD FFFFFFFF K
    ZY AAAAAAA CCCCCCC EEEEEEE JK
    ZY T H JK
    ZY TS CCCCCCC FFFFF IIIIIII GH JK
    ZY TS BBBBBB EEEEE HHHHHH GH JK
    DC TS X AAAAA DDDDD GGGGG L GH AB
    DC TS XW --------------- KL GH AB
    DC TS XWV| |JKL GH AB
    DC TS XWV| |JKL GH AB
    XWV| |JKL
    DC RQ XWV| |JKL IJ AB
    DC RQ XWV| |JKL IJ AB
    DC RQ XW --------------- KL IJ AB
    DC RQ X SSSSS PPPPP MMMMM L IJ AB
    XW RQ TTTTTT QQQQQ NNNNNN IJ LM
    XW RQ UUUUUUU RRRRR OOOOOOO IJ LM
    XW R J LM
    XW OOOOOOO MMMMMMM KKKKKKK LM
    X PPPPPPPP NNNNNNN LLLLLLLL M

    TTTTTTTTT QQQQQQQQQ NNNNNNNNN
    UUUUUUUUU RRRRRRRRR OOOOOOOOO
    VVVVVVVVV SSSSSSSSS PPPPPPPPP

    numbers:
    123456789 123456789 123456789
    123456789 123456789 123456789
    123456789 123456789 123456789

    5 12345678 1234567 12345678 1
    44 1234567 1234567 1234567 12
    33 7 1 23
    22 66 1234567 12345 1234567 12 34
    11 55 123456 12345 123456 23 45
    88 44 9 12345 12345 12345 1 34 11
    77 33 87 --------------- 12 45 22
    66 22 765| |123 56 33
    55 11 654| |234 67 44
    543| |345
    44 76 432| |456 11 55
    33 65 321| |567 22 66
    22 54 21 --------------- 78 33 77
    11 43 1 54321 54321 54321 9 44 88
    54 32 654321 54321 654321 55 11
    43 21 7654321 54321 7654321 66 22
    32 1 7 33
    21 7654321 7654321 7654321 44
    1 87654321 7654321 87654321 5

    987654321 987654321 987654321
    987654321 987654321 987654321
    987654321 987654321 987654321


    Notice that some characters are spaces, dashes or vertical bars. These are aisle and rink/stage
    locations and so they do not contain seats. The "rows.txt" file contains a similarly laid out set of
    characters representing the row letters. The "numbers.txt" file contains yet another arrangement of
    numbers representing the seat numbers. In the constructor for the Stadium, you should read in these
    three files and populate the grid (i.e., 2D array) with new Seat objects whose section, row and seat
    number match the data in the files. Below is what the files look like. (Hint: You can use two nested FOR loops,
    each time through you should read one char from each file (representing the same location), then construct the Seat object
    using these 3 chars as section, row and number (with appropriate conversions)).
    You may want to create a temporary test method in the Stadium class so as to see whether you loaded
    the files and created the Seat information correctly after creating a new Stadium.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Feb 2010
    Location
    Istanbul , Turkey
    Posts
    9
    Rep Power
    0

    Re: (Help) The model class

    so how can i help you ? I mean this looks like an programming assignment and if you tell what kind of help you're expecting I can be more helpful .

  4. #3
    450081592 is offline Newbie
    Join Date
    Oct 2009
    Posts
    13
    Rep Power
    0

    Re: (Help) The model class

    Quote Originally Posted by hakancemyilmaz View Post
    so how can i help you ? I mean this looks like an programming assignment and if you tell what kind of help you're expecting I can be more helpful .
    i really have no idea how to start it, it will be very helpful if you can show me the outline of the codes, thx so much

  5. #4
    Join Date
    Feb 2010
    Location
    Istanbul , Turkey
    Posts
    9
    Rep Power
    0

    Re: (Help) The model class

    ok first of all here comes the parsing stuff . you can parse the data in text to arrays ( 3 arrays i guess section , row number etc.. ) and after parsing call the constructor of seat class to instantiate seat objects with parsed data . Btw i guess you can skip the non-wanted stuff like "|" etc. when parsing . Then comes creating a Stadium object which consists of seats , you can use array of seats in that case i guess .

    I hope it can be helpful in starting

  6. #5
    450081592 is offline Newbie
    Join Date
    Oct 2009
    Posts
    13
    Rep Power
    0

    Re: (Help) The model class

    Quote Originally Posted by hakancemyilmaz View Post
    ok first of all here comes the parsing stuff . you can parse the data in text to arrays ( 3 arrays i guess section , row number etc.. ) and after parsing call the constructor of seat class to instantiate seat objects with parsed data . Btw i guess you can skip the non-wanted stuff like "|" etc. when parsing . Then comes creating a Stadium object which consists of seats , you can use array of seats in that case i guess .

    I hope it can be helpful in starting
    I don't understand the instruction, can you show me the codes please, just the outline of it

  7. #6
    Join Date
    Feb 2010
    Location
    Istanbul , Turkey
    Posts
    9
    Rep Power
    0

    Re: (Help) The model class

    ok lets think that way :
    -- import vector module java.xxx.vector ( i dont remember exactly lang,util sth like that )

    import java.xxx.Vector ;

    -- create three vector objects by using "new" keyword and dont forget to type <char> for character vectors .

    Vector charVector = new Vector<char>() ;

    -- parse each text file to the vectors and do not forget to skip unwanted characters like "\n" , tab or "|" . ( you can define a bool returning utility function which is called isValidChar(char ch) maybe . ) and if the char. is valid then just parse it . At the end of parsing each file all the vectors should be of the same size .

    -- Then it comes calling the constructors . < I assume you've coded the class >
    Even though you haven't coded it may be sth like that :

    class Seat {

    int sectionNo ;
    char rowLetter ;
    int seatNo;

    Seat(int secNo , int seat , char rowLet )
    {
    sectionNo = secNo ;
    seatNo=seat ;
    rowLetter = rowLet ;
    }
    // other funcs.

    }

    Please don't copy the functions , I just wrote them for you to have a general idea about what i've been talking from the beginning . Don't hesitate to ask anything

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 10-21-2011, 08:21 AM
  2. Replies: 2
    Last Post: 03-30-2011, 07:13 PM
  3. Replies: 4
    Last Post: 06-30-2010, 09:22 PM
  4. Model for ASP.NET 2.0 application
    By jhenry2808 in forum General Programming
    Replies: 0
    Last Post: 11-04-2007, 08:23 PM

Tags for this Thread

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