method help!!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: method help!!

  1. #1
    Join Date
    Feb 2005
    Posts
    1

    Exclamation method help!!

    i have been working on a program that makes seating reservations for a virtual airline. the object of the program is for the user to be able to add and remove his/her seat. i'm having a very hard time with these two methods, can anyone help me?
    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468

    Reservation system help

    What kind of problems are you having? Are you asking conceptual questions or are you having an execution issue?

    Is your code compiling? I could not get it to do so ...

    One thing I saw was that the declaration of your "findSeat" method says that the method will be returning a char, but the variable you are returning is typed as a boolean. Then I noticed that you were probably having a problem with it since you weren't calling it since your choice "3" was commented out. This is the error which led to the "return value expected" compile error.

    Many of your choice items are supposed to be a char but you just have a word there ... not a c == 'w' or the such ... I guess you just hadn't changed these placeholders, yet...

    [a small English editing aside ... you are asking whether the person wants an "aisle" seat, not "isle" seat ... next to the passage separating columns of seats, not on an island ...]

    I notice that you are trying to return the length of your Seating Chart to serve as an upper limit to the loops but your declaration of the method says that you are expecting a char type in "max" rather than the integer which is returned by the length value ... won't work ... change this to an int ...

    After these changes are made your code runs into a problem with "smoking", in that the compiler was concerned that it had not been initialized.

    After initializing smoking (I assigned a ' ' when it was declared) the program compiled but then ran into a run time array out of bounds error in a call to find seating while I was trying to select a seat.

    I'll leave that to you to work out ... think about what length it is that is the loop control variable in the findSeat method ... and how you determine that value with a two dimensional array ...

    Happy hunting!
    Last edited by nspils; 02-21-2005 at 12:25 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center