posted 19 years ago
To start I changed the class name from Panel to MyPanel (saver confusion with sun's Panel class)
Here's a few modifications, but there's still something wrong
your 2nd panel is due to these 2 lines in Cost()
Panel cust;
cust = new Panel();
I changed those to a parent (if that is what you are trying to do)
the problem is here (in changing num1 = cust.getnum() to num1 = parent.getnum())
in MyPanel() num = 1, 2 or 3
so num1 = 1, 2 or 3
then your if/else tests for num1 > screen1, screen2 and screen3 (values are 50, 75, 100)
so "Booking Not Accepted" is always the result. The if/else is also the wrong way around
if > 50
else if > 75
else if > 100
if num1 is 100, the if > 50 will execute, which is probably not what you want
perhaps these should be < 50 etc (or start at 100, and work back)
this line was also a problem
if (day != "1" || month != "Apr" || year != "2004")
changed to !day.equals("1") etc
hope this makes sense
[ edited to remove the evil tab character and break long lines in the code -ds ]
[ November 27, 2004: Message edited by: Dirk Schreckmann ]