For loop not working & way to include an external file

Hi everyone, i am new to java and am having some problems with my program.
I have a for loop but it doesnt work it completely gets ignored and i have
no idea why it does that.
IS there a way that i add another option in the menu to open an external file
which would be similar to this but it would be for cabinBooking. If so how do
i do that. if opening an external file is impossible then could you please show me an example of how to extend the booking class.
Any help would be appreciated.
Thank you very much
import java.util.Scanner;
import java.io.*;
public class Booking{
Booking(String bId,     String bName,int bNum){
bookId = bId;
bookName = bName;
bookNum     = bNum;
String bookId;
String bookName;
int     bookNum;
public double calculateBookingPrice(){
double cost     = bookNum *     genBookingcost;
return cost;
double genBookingcost =     80;
public void     summary(){
     System.out.println();
System.out.println("Booking Number is: " + bookId + ", ");
System.out.println("Booking Made for : " + bookName);
System.out.println("Cost of booking = $" + calculateBookingPrice());
System.out.println();
public static void main(String[] args) throws IOException{
Scanner     keyboard = new Scanner(System.in);
BufferedReader charInput = new BufferedReader
(new InputStreamReader (System.in));
int bookCount = 0;
char answer;
Booking[] bookings = new Booking[6];
do {
     menu();
     System.out.println("book Count = " + bookCount);
     answer = charInput.readLine().charAt(0);
               if (answer == 'a' || answer == 'A'){
                    System.out.println("Booking     ID : ");
          String idstring     = keyboard.nextLine();
          System.out.println("Booking     Name : ");
          String namestring =     keyboard.nextLine();
          System.out.println("number of people : ");
          int     ppl     = keyboard.nextInt();
          bookings[bookCount] = new Booking(idstring,namestring,ppl);
          bookings[bookCount].summary();
                    bookCount++;
               }else if (answer == 'b' || answer == 'B'){
                    System.out.println("Enter printing");
                    bookings[0].summary();
                    bookings[1].summary();
                    // this is the loop that it is ignoring GGRRRR!!!
               for(int i = 0; i >= bookCount; i++){
                    System.out.println("Counter: " + i);
                    bookings.summary();
               }else if (answer == 'x' || answer == 'X'){
                    System.out.println("Exiting the programme...");
System.out.println();
System.exit(0);
}while (answer != 'x' || answer != 'X');
public static void menu(){
     System.out.println("********** Main Menu ***********");
          System.out.println(" A. Make General Booking");
          System.out.println(" B. Print Summary");
          System.out.println(" X. Exit program");
          System.out.println("*****************************");
          System.out.println("Select one of the options above");

in order to extend the Booking class, you can create anew class like this..
public class CabinBooking extends Booking
   public CabinBooking( /*String bId, String bName,int bNum .. more args or fewer, or none.. */)
    // add new methods or override ones from Booking
}

Similar Messages

  • Javascript For loop not working within a function

    Hi all,
    I'm a beginner to LiveCycle and I cant seem to get a loop working within a function.  The function is being called successfully because when I manually create the code it works but I am trying to clean things up.
    So here is my working example:
    function hideContent() {
            MainFlowedSub.LevelsSub.Table1.presence = "hidden";
            MainFlowedSub.LevelsSub.Table2.presence = "hidden";
           ... and so on....
             MainFlowedSub.LevelsSub.Table8.Row1.presence = "hidden";
            MainFlowedSub.LevelsSub.Table8.Row2.presence = "hidden";
           ... and so on....
    However when I try and creat a loop instead of listing every sing table/row nothing happens. this is important to my project as there will be alot of different rows depending on radio button selections earlier in the form.  Below is the current state of my code:
    function hideContent() {
        var i=0;
         for (i=1;i<=5;i++)
             MainFlowedSub.LevelsSub.Table[i].presence = "hidden";
        var j=0;
         for (j=1;j<=23;j++)
             MainFlowedSub.LevelsSub.Table8.Row[j].presence = "hidden";
        var k=0;
         for (k=24;k<=88;k++)
             MainFlowedSub.LevelsSub.Table8.Row[k].presence = "hidden";
    this will then continue as there will be hundreds of rows.
    Any help will be greatly appreciated and I am sure I am making a basic error  so thanks in advance.
    j

    thanks for your help paul.  Again, really appreciated as I know very little about all this.
    Unfortunately its still not working... One thing I am sure of is that I am doing something very basic wrong. So here is my code, I have applied your suggestion above which will cover all my data:
    To give an understanding, I have 5 tables of content, each has i amount of rows. and I am running this script to clear/remove all items being displayed.
    function hideContent() {
        for (var i=1;i<=5;i++)
            xfa.resolveNode("MainFlowedSub.LevelsSub.Table[" + i + "]").presence = "hidden";
        for (var i=1;i<=71;i++)
            xfa.resolveNode("MainFlowedSub.LevelsSub.Table8.Row[" + i + "]").presence = "hidden";
        for (var i=1;i<=93;i++)
            xfa.resolveNode("MainFlowedSub.LevelsSub.Table9.Row[" + i + "]").presence = "hidden";
        for (var i=1;i<=99;i++)
            xfa.resolveNode("MainFlowedSub.LevelsSub.Table10.Row[" + i + "]").presence = "hidden";
        for (var i=1;i<=101;i++)
            xfa.resolveNode("MainFlowedSub.LevelsSub.Table11.Row[" + i + "]").presence = "hidden";
        for (var i=1;i<=87;i++)
            xfa.resolveNode("MainFlowedSub.LevelsSub.Table12.Row[" + i + "]").presence = "hidden";
    It has to be something to do with my For loops because if I manually insert each line it works perfectly.
    Thanks again,
    johnny

  • ICloud for pc not working tried everything

    iCloud for pc not working tried everything ( uninstall - reinstall - delete files - old versions ) nothing helps it just downloads a couple of photos and off again my iPhone uploads perfectly as all the pics goes to the iPad seamlessly, Please Help i'm on windows 8.1 x64, Thanks

    I think that the card reader may in fact be defective, but it just doesn't make sense if I have already used it fine before. I've tried everything on this Apple support page, thank you though.
    Does anyone have any suggestions?

  • Including an External File

    I have an external file that contains a declaration of an ActiveX object that I need to include in several JSP's. The external file resides on a separate web server from where our applications reside.
    I can't use the Include directive or the <jsp:include> tag because they only permit relative URL's. I also have read that I can use the <c:import> action tag provided in the JSTL, but we do not use JSTL currently and it would require additional time to add that code to our applications and test it.
    Is there any other way to include this external file in my JSP pages?
    Thanks
    Tony

    Thanks for the help. It hasn't been decided where the external file will reside, but it will probably be on our mainframe running WebSphere so I don't think the second option will work.
    We were hoping that we could just add 1 line of code to our pages to pull in the external file to simply the development process, but that doesn't look like it will work. We might have to create a second file that can be referenced with a relative URL, and have this file use one of the URL Connection classes to get the first file and write out its contents.
    Anyway, thanks for the tips!
    Tony

  • Save for web not working in Photoshop element 6

    Save for web not working in Photoshop element 6. I am using Mac os x version 10.5.8   Anyone know how to fix that please tell me. Thanks

    I just copy the preferences from my computer for you to see what are shown about adobe
    file:///Users/raymondsmith/Library/Preferences/Adobe/
    file:///Users/raymondsmith/Library/Preferences/Adobe%20Illustrator%20CS2%20Settings/
    file:///Users/raymondsmith/Library/Preferences/Adobe%20Photoshop%20CS2%20Paths
    file:///Users/raymondsmith/Library/Preferences/Adobe%20Photoshop%20CS2%20Settings/
    file:///Users/raymondsmith/Library/Preferences/Adobe%20Photoshop%20Elements%206%20Paths
    file:///Users/raymondsmith/Library/Preferences/Adobe%20Photoshop%20Elements%206%20Settings /
    file:///Users/raymondsmith/Library/Preferences/AdobeUM/
    file:///Users/raymondsmith/Library/Preferences/AppleWorks/
    file:///Users/raymondsmith/Library/Preferences/ByHost/
    file:///Users/raymondsmith/Library/Preferences/CD%20Info.cidb
    file:///Users/raymondsmith/Library/Preferences/CDDB%20Preferences
    file:///Users/raymondsmith/Library/Preferences/cfx%23FBSxPfw
    file:///Users/raymondsmith/Library/Preferences/com.adobe.acrobat.90.sh.plist
    file:///Users/raymondsmith/Library/Preferences/com.adobe.Acrobat.Pro7.0.plist
    file:///Users/raymondsmith/Library/Preferences/com.adobe.acrobat.sh.plist
    file:///Users/raymondsmith/Library/Preferences/com.adobe.Acrobat.Uninstaller.plist
    file:///Users/raymondsmith/Library/Preferences/com.adobe.Adobe%20Help%20Viewer.plist
    file:///Users/raymondsmith/Library/Preferences/com.adobe.ami.installer.plist
    file:///Users/raymondsmith/Library/Preferences/com.adobe.bridge2.plist
    file:///Users/raymondsmith/Library/Preferences/com.adobe.mediabrowser.plist
    file:///Users/raymondsmith/Library/Preferences/com.adobe.PhotoshopElements.plist
    file:///Users/raymondsmith/Library/Preferences/com.adobe.Reader_ppc_9.0.plist
    file:///Users/raymondsmith/Library/Preferences/com.adobe.Reader.plist
    file:///Users/raymondsmith/Library/Preferences/com.aol.aim.plist

  • [svn:fx-trunk] 13257: Fix for @inheritDoc not working on a setter, but works on a getter

    Revision: 13257
    Revision: 13257
    Author:   [email protected]
    Date:     2010-01-04 10:49:13 -0800 (Mon, 04 Jan 2010)
    Log Message:
    Fix for @inheritDoc not working on a setter, but works on a getter
    QE notes: None.
    Doc notes: None
    Bugs: SDK-24727
    Reviewed By: Paul
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24727
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/ClassTable.java

    steabert wrote:
    Hi,
    I had a similar problem with my Dell Latitude E4310, and apparently also the E6410, E6510.
    The solution for me was to add the following line to /etc/modprobe.d/modprobe.conf:
    options snd-hda-intel model=dell-s14
    I tried that, unfortunately it does not work with this chipset. I do get a different set of channels though but it still cannot record anything. Maybe this chipset is too "new" for alsa. The latest release dates back from the end of January. Support for it is explicitly stated in the changelog to 1.0.24 but perhaps the recording part of it slipped through the cracks. ALSA bug tracking system seems quite closed.

  • Logging for AS not working

    Hi,
    In sm21, I cannot see any logs from the AS. I can only see the ones from CI.
    Any ideas how to solve this issue ?
    Anything is welcomed,
    Thanks.

    Hello
    This thread was locked for the following reasons:
    1) the topic does not relate to PI. This forum is for PI technical issues only.
    2) it is against forum rules to post the same issue on multiple forums - Re: Logging for AS not working
    Regards
    Moderator

  • 3?'s: Message today warning lack of memory when using Word (files in Documents) something about "idisc not working" 2. Message week ago "Files not being backed up to Time Capsule"; 3. When using Mac Mail I'm prompted for password but none work TKS - J

    3 ?'s:
    1  Message today warning lack of memory when using Word (files in Documents) something about "idisc not working"
    2. Message week ago "Files not being backed up to Time Capsule";                                                                                                                                             
    3. When using Mac Mail I'm prompted for password but none work
    Thanks - J

    Thanks Allan for your quick response to my amateur questions.
    Allan:     I'm running version Mac OS X Version 10.6.8     PS Processor is 2.4 GHz Intel core 15 
    Memory  4 gb  1067   MHz  DDr3  TN And @ 1983-2011 Apple Inc.
    I just "Updated Software" as prompted.
    Thanks for helping me!    - John Garrett
    PS.
    Hardware Overview:
      Model Name:          MacBook Pro
      Model Identifier:          MacBookPro6,2
      Processor Name:          Intel Core i5
      Processor Speed:          2.4 GHz
      Number Of Processors:          1
      Total Number Of Cores:          2
      L2 Cache (per core):          256 KB
      L3 Cache:          3 MB
      Memory:          4 GB
      Processor Interconnect Speed:          4.8 GT/s
      Boot ROM Version:          MBP61.0057.B0C
      SMC Version (system):          1.58f17
      Serial Number (system):          W8*****AGU
      Hardware UUID:          *****
      Sudden Motion Sensor:
      State:          Enabled
    <Edited By Host>

  • Skype 6.3 upgrade for Mac not working

    [Topic title updated by moderator to be more descriptive. Original topic title was: "Skype upgrade for Mac not working"]
    BE WARNED - just because you are being asked to upgrade your Skype, it does not mean it will work on your machine. I am a fairly regular user of Skype and this morning was unable to log-in, being told that I needed to upgrade. I did so to 6.3.0.602 but I was unable to log-in once the software had downloaded. After some research on the forums and finally a text chat with Support, I was told that Skype 6.3.0.602 requires a Mac OSX of 10.9 or above - I have 10.5.8
    "So what can I do", I asked the tech support. The answer is nothing (unless I get new OS X software) - there is no Skype software programme that supports my operating system and no timeframe for when it might be available.
    Huh? That's right. It's just not available. So for now, users with less than OS X 10.9 will be unable to use Skype when they are instructed to upgrade. It really doesn't make sense. But just so you know....

    jessicaed wrote:
    BE WARNED - just because you are being asked to upgrade your Skype, it does not mean it will work on your machine. I am a fairly regular user of Skype and this morning was unable to log-in, being told that I needed to upgrade. I did so to 6.3.0.602 but I was unable to log-in once the software had downloaded. After some research on the forums and finally a text chat with Support, I was told that Skype 6.3.0.602 requires a Mac OSX of 10.9 or above - I have 10.5.8
    "So what can I do", I asked the tech support. The answer is nothing (unless I get new OS X software) - there is no Skype software programme that supports my operating system and no timeframe for when it might be available.
    Huh? That's right. It's just not available. So for now, users with less than OS X 10.9 will be unable to use Skype when they are instructed to upgrade. It really doesn't make sense. But just so you know....
    Please look at the top of the community page, and you will find a box "Search:". Write your problem here "Upgrade not working" and see what crops up. Most likely you will be taken somewher like here: http://community.skype.com/t5/Mac/quot-We-ve-signed-you-out-because-your-using-an-outdated-version/m...  
    Here you will read that the latest versions of Skype will not work on some of the versions of MacOS, and that PPC requires one version, Leopard another, Snow leopard another, Mountain Lion another. They are indoctrinated with a stamp in their forehead to enforce their congregation of true believers to install the latest with all "security fixes" or death is looming. They are not used to software that is 2 years old. 
    So, with Mac, we have different operating systems and different sets of libraries - and things may go belly up if you upgrade - a OS feature is done differently, a libary has been placed inside the OS, and is no longer needed - and if you try to use it, you will be trapped.
    Install the latest version that works for your Mac, and make sure to freeze this. Update the "info.plist" file and tell Skype that you use their latest should they pry. As long as it works, do not change anything!
    And make the change to stop Skype from checking every time you start.

  • Default them for Mac not working firefox 4 beta 1

    Default them for Mac not working Firefox 4 beta 1
    == This happened ==
    Every time Firefox opened
    == I first opend FF4 beta 1 for the first time

    '''Ritrup''':
    Create a new profile as a test to check if your current profile is causing the problems
    See [[Basic Troubleshooting#Make_a_new_profile|Basic Troubleshooting&#58; Make a new profile]]
    There may be extensions and plugins installed by default in a new profile, so check that in "Tools > Add-ons > Extensions & Plugins"
    If that new profile works then you can transfer some files from the old profile to that new profile (be careful not to copy corrupted files)
    See http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • Itunes 10 will not load on windows 7 64 bit. Error code 2324. Old Itunes is gone or not working. Cannot play anything although files are still there. What the ??? is error 2324. Seems like alot of people ar ehaving the same problem

    Itunes 10 will not load on windows 7 64 bit. Error code 2324. Old Itunes is gone or not working. Cannot play anything although files are still there. What the ??? is error 2324. Seems like alot of people ar ehaving the same problem

    I have had this problem with Windows 7 and iTunes updates for some time. Each time it takes hours to solve but with the over the air upgrade to IOS6 on my iPhone and iPad, I was determined to solve and remember what I did, So here it is:
    http://www.care4pcs.co.uk/2012/09/pear-shaped-apple-ios-6-for-iphone-ipad.html
    I hope this helps you and any other users.

  • What is the best way to include an xml file in JSP?

    I have a jsp page that I need to include an xml file. The xml file
              uses an xsl to render the file. What is the best way to include the
              xml file and still maintain the structure of the style sheet?
              Thanks
              Jennifer
              

              The best way is using the tag lib. If you cannot, but you can use JAXP, you can
              try
              javax.xml.transform.Transformer.transform(Source xmlSource,
              Result outputTarget)
              throws TransformerException
              You construct the transformer with you xsl, use you xml file or DOM to form xmlSource,
              and use JSPWriter "out" to form outputTarget (StreamResult). But if your JSP page
              generates the xml itself, tag lib is the only way.
              [email protected] (Jennifer) wrote:
              >[email protected] (Jennifer) wrote in message news:<[email protected]>...
              >> I have a jsp page that I need to include an xml file. The xml file
              >> uses an xsl to render the file. What is the best way to include the
              >> xml file and still maintain the structure of the style sheet?
              >>
              >> Thanks
              >>
              >> Jennifer
              >
              >Or is there a way to parse the xml file with the jsp page to display
              >the information. I cannot use the Java Standard Tag Libraries as the
              >version of iplanet we are running does not support the JSTL
              >
              >Thanks
              >
              >Jennifer
              

  • New content for cutout not working

    I'm using Illustrator CS2, and last year I created a silkscreen master for a DVD label that included a big shape with other shapes (text and logos) cut out of it.  It was apparently made using the compound path method (I am aware that there are multiple ways to do this, but I found a compound path in the file, so that must have been the method I used.)  Now I need to change the product number and such.  So the first thing I did was to undo the compound path (sorry, I don't know the exact word in English, as I'm using the Japanese version of Illustrator, but something like "Release Compound Path" on the right-click menu).  I was left with the large path and a bunch of little paths of the various things that were cut out - some were in groups and others weren't, but I couldn't see any discernable pattern as to why the groups were the way they were (and I have since then removed all the groupings, but the symptoms don't change).  In the layer palette it seems like all the paths, including the inside and outside paths of letters like O and D, are all just paths, all the same color as the background shape.   But it works - I can make the compound path again and it looks right, with, for example, the inside of a zero opaque while the outside is transparent.  Somehow it knows what shapes need to be in and what ones need to be out.  I assumed it knew simply by location - e.g. concentric circles would alternate between transparent and opaque.
    But... it's not working on anything new that is added.  To make my changes, I deleted the old text outlines, made the new text, and turned it into outlines.  Then I selected it along with the rest of the stuff and selected "Create Compound Path".  But for some reason it's not "cutting out" anything new.  The new paths get incorporated into the compound path in the Layer palette, and their color becomes the same as the big shape, but transparent areas appear only where the pre-existing paths are, not the new ones.  What could be special about the old paths vs. the new ones?  I'm probably just missing a simple step in the process, but I've looked through various tutorials on this, and as far as I can tell I'm doing it correctly.
    I can send the file if someone wants to look at it.

    It took me a bit to find something called Pathfinder (I was looking on menus, but it was a little palette I needed to reveal), but once I figured it out, it worked like a charm - thanks!  That must have been what I did last year, and then it remembered what was a "minus" and what was a "plus" in the old content.
    No, I do not know the difference between a compound path and a compound shape - in fact, I don't know the difference between a path and a shape.  But it seemed to previously work find as a path, so I pressed Alt to keep it that way.  If it works, don't fix it!

  • Why does my While loop not work?

    I was using the SetInterval timer but this kept causing problems getting the timing right,
    So I thought - get the loop to work infiitely...
    var cond=0;
    while (cond !=1){
    $("#DivStage1").fadeIn(1000);
    $("#DivStage1").delay(6500).fadeOut(500); //8000
    $("#DivStage1_1").show("slide", {direction:'left'}, 1000);
    $("#DivStage1_1").delay(6500).hide("slide", {direction:'left'},500);
    $("#DivStage1_2").delay(1000).show("slide", {direction:'left'}, 1000);
    $("#DivStage1_2").delay(5500).hide("slide", {direction:'left'}, 1000);
    $("#DivStage2").delay(8000).fadeIn(1000);
    $("#DivStage2").delay(17000).fadeOut(500); //8000 to 16000
                            $("#DivStage2_1").delay(8000).show("slide", {direction:'left'}, 1000);
                             $("#DivStage2_1 h2 #1 style='color: #FFF;'").show();
                             $("#DivStage2_1").delay(16000).hide("slide", {direction:'left'},500);
    The page does not execute the loop.
    Thanks in advance for any feedback

    Create a function for the loop and call the function when the document is ready.
    Don't forget to include the jQuery library, jquery.js or similar.

  • Loops not work - File type not supported

    Hi guys and girls
    one of the imacs (10.6.7) at the site I work at has begun to display the following message when you try to select any of the loops from within garageband.
    "file type not supported" and then you have no other option other than to abort. I have tried deleting the loop directory before dragging the loops back into garageband which has always fixed any issues with loops in the past, however the error still displays.
    Can anyone shed any light on this issue?

    The message I get is "Cannot open the file. Verify that the path and file name are correct and try again".
    Please see the Microsoft support doument Windows Media Player 9 Series for Mac OS X Readme. Scroll down to the section on Playing Protected Files.
    Sometimes you can view the source code for the web page to locate the specific media file. If you copied that address and then pasted that address in File > Open URL in Windows Media Player, you may get to listen to or watch the file. This trick does not always work.

Maybe you are looking for