Urgent array help needed! come get some duke points

this program keeps track of rentals for a shop. Other methods and classes not shown (like Customer, Transaction classes) are also in this program. Every item (created with a constructor in Item class) can hold an array of up to 20 transactions; part of a Transaction object is a rental total, based on a number of rental days * specific rental price for that item rented (backhoe, edger, etc.) If the user presses "t" for total amount of transactions, the following method is called, which calls the getTotalPrice() in another class called Item. My problem here is that even if I enter in transaction amounts, when I press "t", the program just quits, not producing the report and returning me to the main class. I have been over it with the debugger and I am still lost. Below is some selected code; I hope it is sufficient. Please let me know if I need to put up more
//main
String input = JOptionPane.showInputDialog(null, "Enter a rental transaction (x)" +
                                                  "\nAdd a customer (c)" +
                                                  "\nAdd an item (i)" +
                                                  "\nReport on a specific item (r)" +
                                                  "\nReport on total dollar amounts of rentals for all items (t)" +
                                                  "\nReport on total rentals for a specific customer (s)" +
                                                  "\nStrike cancel to exit from the program");
          //big huge while
          while (input != null){
               if (input.equals("x")){
                    rentalTrans();
               }//if
               if (input.equals("c")){
                    addCustomer();
               }//if
               if (input.equals("i")){
                    addItem();
               }//if
               if (input.equals("r")){
                    specificItemReport();
               }//if
               if (input.equals("t")){
                    allItemReport();
               }//if
               if (input.equals("s")){
                    customerReport();
               }//if
               input = JOptionPane.showInputDialog(null, "Enter a rental transaction (x)" +
                         "\nAdd a customer (c)" +
                         "\nAdd an item (i)" +
                         "\nReport on a specific item (r)" +
                         "\nReport on total dollar amounts of rentals for all items (t)" +
                         "\nReport on total rentals for a specific customer (s)" +
                         "\nStrike cancel to exit from the program");
//allItemReport()
public static void allItemReport(){ //menu item t
          Item temp = null;
          for (int index = 0; index < items.length; index++){
               temp = items[index];
          }//for
          JOptionPane.showMessageDialog(null, "Total rental transactions to date amount to: $" + temp.getTotalPrice());
//Item Class
public String getTotalPrice() {
          double total = 0;
          String output = "";
          for (int i = 0; i < trans.length; i++) {
               if (trans[i] == null) {
                    if (i == 0) {
                         output = "There are currently no transactions.";
                    }// if
                    break;
               }// if
               else{
               total += getPerDayRentalPrice();
               }//else
          }// for
          output+= total;
          return output;
     }//getTotalPrice

Don't flag your questions as urgent. It's rude. Also don't think that waving with a couple of worthless Dukes is going to get you better/quicker help.
The reason I respond to your question is because you have explained your problem well and used code tags.
Try this:class Main {
    public static void main (String[] args) {
        String message = "Enter a rental transaction (x)\nAdd a customer (c)" +
            "\nAdd an item (i)\nReport on a specific item (r)\nReport on total "+
            "dollar amounts of rentals for all items (t)\nReport on total rentals"+
            " for a specific customer (s)\nStrike cancel to exit from the program";
        String input = JOptionPane.showInputDialog(null, message);
        while(input != null){
            if (input.equals("x")) rentalTrans();
            else if (input.equals("c")) addCustomer();
            else if (input.equals("i")) addItem();
            else if (input.equals("r")) specificItemReport();
            else if (input.equals("t")) allItemReport();
            else if (input.equals("s")) customerReport();
            else System.out.println("Invalid option!");
            input = JOptionPane.showInputDialog(null, message);
        System.out.println("Bye!");
    // the rest of your methods ...
}

Similar Messages

  • Sunday Morning Question: Or, Come Get Some Easy Points.

    To get the cheese, just post a link to where ever you think the best place to get MBP RAM is, at the best price of course (1GB sticks). Please don't reference ebay or craig's list.
    Thanks in advance,
    SX

    I ordered 512MB on thursday, and should receive Monday or Tuesday. I've bought RAM from them before.
    This RAM should match what you have in your machine currently and is about $30 cheaper than Apple.
    Here's the link:
    http://www.crucial.com/store/ListParts.asp?mfr=Apple&model=MacBookPro+1%2E83GHz+Intel+Core+Duo%2815%2E4%2Dinch%29
    Cheers,
    Ken

  • Help me in getting some more powerful authentication....

    I am looking for your help regarding the validation of users in JAVA,mysql , i am looking for some code help .regarding this matter.i have a code which uses cookie to authenticate the users but can you help me in getting some more powerful authentication....

    I'm not sure what you mean by "IP Community list", but here are 3 reference sites for Regular Expressions:
    Regular Expression Tutorial - Learn How to Use Regular Expressions
    http://www.regular-expressions.info/tutorial.html
    Regular Expressions Cheat Sheet by DaveChild
    http://www.cheatography.com/davechild/cheat-sheets/regular-expressions/
    Regular Expressions Quick Reference
    http://www.autohotkey.com/docs/misc/RegEx-QuickRef.htm

  • Can somebody help me in getting some good material for Regular Expressions and IP Community list

    can somebody help me in getting some good material for Regular Expressions and IP Community list

    I'm not sure what you mean by "IP Community list", but here are 3 reference sites for Regular Expressions:
    Regular Expression Tutorial - Learn How to Use Regular Expressions
    http://www.regular-expressions.info/tutorial.html
    Regular Expressions Cheat Sheet by DaveChild
    http://www.cheatography.com/davechild/cheat-sheets/regular-expressions/
    Regular Expressions Quick Reference
    http://www.autohotkey.com/docs/misc/RegEx-QuickRef.htm

  • We need to get some help and explanations about iChat video not working.

    I've read so many postings about iChat Video hoping for an answer to my problem, but not only did I not find an answer, no one else has been receiving an answer either.
    I've had multiple problems with my ichat video not working.
    I either get an error saying someone didn't accept which isn't the case, or I get some error-8 or something ridiculous like that.
    Can we get some help from apple support or something?!

    Short answer: No, we can´t...!
    Apple don´t care about us users, unless you pay for an Apple Care Service. Try your best to follow some advices from around this forum. That´s the only help you will get.
    Some people have got their iChat video working again after following some advice. By the way. I´m not one of them... I´ve tried every single tip I read here, but I´m still stuck with text chat only...
    Good luck.

  • Help need in getting thread join to actionperformed event.

    Hi,
    I am trying to building a small application which should give me the following functionality.
    My main function should span two windows. One window(1) will be receiving the input from the user and after the user enter a string and press the OK butten, the other window(2) should display this string and first window should set unvisible.
    To have this function working my window(2) should wait for the window(1) ActionPerform event complete and receive the message from it.
    Can any of you please help me getting some hints or sample codes for this action to be done.
    Thanks.

    Varad,
    Not sure what you are suggesting is what I am looking to do. I believe with your example here that I would need to create a new item table in my current DB in order to recall this data. This table would be populated with the items I selected (checkbox) from the original page. This is one solution, but the issue is that this is dynamic and these values would change as a new search is generated or different values are selected.
    Is there anyway in which to make (code) in ApEx so as that the values (i.e. P1_items 123 : 234 : 456) (note that these items are defaulted to colon delimitation by ApEx) are properly formatted so as SQL can read them as independent items. Note if I simply rewrite the original SQL script and replace the :P1_item with generic values (123 , 234 , 456) the SQL operates as intended.
    Thank you for your support and help,
    Randy

  • Urgent(Transformation help needed)

    Hello
    Can anybody help me in the transformation.
    I am selecting data from the table, i used (Database adapter-Single table
    selection).
    I need to place that data into the text file of Fixedlength format.Each record is
    of diffent types.
    My target xsd is:
    ==============
    ?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd=..........>
    <xsd:element name="Root-Element">
    <xsd:complexType>
    <xsd:sequence minOccurs="0" maxOccurs="unbounded">
    <xsd:element name="REC_2701" minOccurs="0" nxsd:startsWith="2701" maxOccurs="unbounded" nxsd:style="array" nxsd:cellSeparatedBy="${eol}">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="C3" type="xsd:string" nxsd:style="fixedLength" nxsd:length="1">
    </xsd:element>
    <xsd:element name="C4" type="xsd:string" nxsd:style="fixedLength" nxsd:length="6">
    </xsd:element>
    <xsd:element name="C5" type="xsd:string" nxsd:style="fixedLength" nxsd:length="5">
    </xsd:element>
    <xsd:element name="C6" type="xsd:string" nxsd:style="fixedLength" nxsd:length="12">
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="REC_2702" minOccurs="0" nxsd:startsWith="2702" maxOccurs="unbounded" nxsd:style="array" nxsd:cellSeparatedBy="${eol}">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="C3" type="xsd:string" nxsd:style="fixedLength" nxsd:length="1">
    </xsd:element>
    <xsd:element name="C4" type="xsd:string" nxsd:style="fixedLength" nxsd:length="6">
    </xsd:element>
    <xsd:element name="C5" type="xsd:string" nxsd:style="fixedLength" nxsd:length="5">
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    When i tranform the data I am getting result fixed length data file in the following format.
    2701C50 50 MUVT01
    2701C03451 03451SIMUL1
    2701C44034 44034SIMUL3
    2702C50 50
    2702C03451 03451
    2702C44034 44034
    But i need to get the fixed length file data in the below format
    ============================================
    2701C50 50 MUVT01
    2702C50 50
    2701C03451 03451SIMUL1
    2702C03451 03451
    2701C44034 44034SIMUL3
    2702C44034 44034
    Can anybody suggest me the solution to the above case ?
    Thanking you
    mki

    Only a guess, but could you try removing the nxsd:style="fixedLength" from the xsd?
    Another option might be to concatenate the values in BPEL into one field, trimming the spaces. You could then have an xsd with the file adapter to write out this one column.
    Toby
    Message was edited by:
    tobyc

  • IPhone stuck on restore -- need to get some photos off!

    Hi,
    My iPhone is stuck in restore mode. I don't know how it got like that, it was freezing up and I tried to reset it, maybe I did it on accident.
    Anyways, I have some photos on it that I need to get off -- so I don't want to do the restore yet! Every time I connect it to my iTunes it says that it is in restore mode. How can I take it out of restore mode to get these pictures off of it first??
    Thanks in advance

    Try PhoneView.
    http://ecamm.com/mac/phoneview/
    Dave M.
    MacOSG Founder/Ambassador  An Apple User Group 
    Creator of Mac611 - Mobile Mac Support (designed exclusively for an iPhone/iPod touch)

  • Help needed in getting the previous Quarter Data

    Hello folks,
    I have this procedure where i have to modify the current procedure in the following manner:
    I need to get rid of the variables p_start and p_end so that i cannot see them in the crystal report and include the Frequency in the procedure to get the Data based on the Dates.
    and Main requirement is" If the Frequency is Quarterly " it should get the previous quarter Data, if "Frequency is monthly" it should return the previous month data.Can anyone please let me know where shud i make changes. Am including the procedure for refernce. Any help is appreciated
    Thanks a millioin,
    CREATE OR REPLACE PROCEDURE hcsc_recovery_report_h(report_record in out cr_return_types.gen_cursor,
    p_start       string,
    p_end         string)
    IS
    v_startdate date;
    v_enddate date;
    BEGIN
    v_startdate := to_date(p_start, 'YYYY/MM');
    v_enddate := last_day(to_date(p_end, 'YYYY/MM'));
    open report_record for
    select --distinct r.recovery_id
    r.event_id,
    r.event_case_id,
    c.client_id,
    c.client_code,
    c.client_name,
    b.branch_group_code,
    b.branch_group_description,
    g.employer_group_code,
    g.employer_group_name,
    e.client_policy_identifier,
    e.date_of_incident,
    e.event_type_code,
    sum(nvl(r.amount, 0)) as amt_received,
    nvl(sum(case
    when r.amount >= 0 then
    rd.fees
    else
    rd.fees * (-1)
    end),
    0) as fees,
    ec.close_date, *001* commented
    (case
    when ec.close_date <= to_date(to_char(v_enddate, 'MMDDRRRR') || '235959',
    'MMDDRRRR HH24MISS') then
    ec.close_date
    else
    null
    end) as close_date, --*001*  added
    get_case_value(ec.event_id, ec.event_case_id, v_enddate) as case_value,
    nvl(etl.fee_percent_flag, 'N') workmans_comp,
    max(to_char(r.recovery_date, 'FMMonthYYYY')) Year_Month,
    max(to_char(r.recovery_date, 'YYYYMM')) Y_M,
    max(to_date(to_char(r.recovery_date, 'MMYYYY'), 'MM/YYYY')) date_MY
    from recovery r,
    recovery_detail rd,
    event e,
    client c,
    branch_group b,
    employer_group g,
    event_case ec,
    event_type_lookup etl
    where r.event_id = e.event_id
    and r.event_case_id = ec.event_case_id
    and ec.event_id = e.event_id
    and rd.recovery_id(+) = r.recovery_id
    and r.recovery_date between v_startdate and
    to_date(to_char(v_enddate, 'MMDDRRRR') || '235959',
    'MMDDRRRR HH24MISS')
    and e.client_id = c.client_id
    and g.client_id = c.client_id
    and b.client_id = c.client_id
    and g.employer_group_id(+) = e.employer_group_id
    and b.branch_group_id(+) = g.branch_group_id
    and e.event_type_code = etl.event_type_code -- SST 130852 04/14/09
    group by r.event_id,
    r.event_case_id,
    c.client_id,
    c.client_code,
    c.client_name,
    b.branch_group_code,
    b.branch_group_description,
    g.employer_group_code,
    g.employer_group_name,
    e.client_policy_identifier,
    e.date_of_incident,
    e.event_type_code,
    ec.close_date,
    get_case_value(ec.event_id, ec.event_case_id, v_enddate),
    nvl(etl.fee_percent_flag, 'N')
    having sum(nvl(r.amount, 0)) <> 0
    order by c.client_code,
    b.branch_group_code,
    g.employer_group_code,
    r.event_case_id;
    Edited by: user11961230 on Oct 20, 2009 9:02 AM

    user11961230 wrote:
    1. I want to get rid of the p_start and p_end. So how do i declare the v_startdate and v_enddate in the following part?
    v_startdate := to_date(p_start, 'YYYY/MM');
    v_enddate := last_day(to_date(p_end, 'YYYY/MM'));I'm not sure what you mean by "declare".
    In PL/SQL, "declare" means state (at the beginning of a block) that there will be a certain variable with a certain name (such as v_startdate) and datatype (such as DATE). You're already declaring the variables v_startdate and v_enddate correctly, right before the BEGIN statement.
    Declaring a variable is not the same as initializing it, that is, giving it a value for the first time. Your next question seems to be about initializing..
    2. where exactly shud i include the logic that u have mentioned. sorry a dumb questionIn place of the two assignment statments that reference p_start and p_end.
    3. This time am gonna use frequency instead of report_type so that i will get rid of the p_start and p_end from the procedure.Do you mean you want to pass an argument (called frequency) that tells if you want a quarterly or a mionthly report, just like the variable report_type in my example?
    If so, replace report_type in my example with frequency.
    I think you want something like this:
    CREATE OR REPLACE PROCEDURE hcsc_recovery_report_h
    (      report_record         in out     cr_return_types.gen_cursor
    ,      frequency         IN           VARCHAR2
    IS
         -- Declare local variables:
         v_startdate     date;
         v_enddate      date;
    BEGIN
         -- Initialize v_startdate and v_enddate, depending on frequency
         IF  frequency = 'QUARTERLY'
         THEN
              v_startdate := TRUNC ( ADD_MONTHS (SYSDATE, -3)
                                           , 'Q'
              v_enddate := TRUNC (SYSDATE, 'Q');
         ELSIF  frequency = 'MONTHLY'
         THEN
              v_startdate := TRUNC ( ADD_MONTHS (SYSDATE, -1)
                             , 'MM'
              v_enddate := TRUNC (SYSDATE, 'MM');
         END IF;
         --   Subtract one second from v_enddate
              v_enddate := v_enddate - ( 1
                                            / (24 * 60 * 60)
         open report_record for
         select --distinct r.recovery_id
                r.event_id,
         and     r.recovery_date  BETWEEN  v_startdate     
                         AND       v_enddate
         ...When you post formatted text on this site (and code should always be formatted), type these 6 characters:
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
    Edited by: Frank Kulash on Oct 20, 2009 2:37 PM
    Changed query to use BETWEEN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Help needed, M getting this message sandbox environment error no test user account, when downloading any application from iTunes, friend told me to sign out and sign in iTunes it might solve the problem but instead I cannot login I to my itune account.

    Help needed,
    I am getting this message sandbox environment error no test user account, when downloading any application from iTunes, friend told me to sign out and sign in iTunes it might solve the problem , and i triyed it but still  I cannot login I to my itune account. Same message keeping. Popping up,  this problem started supricly today.

    Take a look at the instructions here.
    http://www.technogal.net/2012/03/this-is-not-test-user-account-please.html

  • Help needed in getting real time system performance monitor

    Hi,
    I need a real time system performance monitor for my solaris.
    i am able to graph system usage graph on a daily/weely basis using the ksar grapher.
    In the same way i need to capture the system utilisation real time to be viewed on a webpage. Please let me know if there are any free tool/scripts capable of doing it.

    Hi,
    Process Chain Errors
    /people/mona.kapur/blog/2008/01/14/process-chain-errors
    Common Process chain errors
    For Data Load Errors check this blog:
    /people/siegfried.szameitat/blog/2005/07/28/data-load-errors--basic-checks
    Implementation issues
    Lifecycle Implementation
    http://help.sap.com/bp_biv170/documentation/SolutionScope_EN.doc
    http://help.sap.com/bp_biv235/BI_EN/documentation/BWProjectPlan_EN.mpp
    Hope this helps.
    Thanks,
    JituK

  • Help needed in getting file url

    Hi,
    I work in a project where i need to get the url of the specified file. The code for that is as,
    URL fileURL = Thread.currentThread().getContextClassLoader().getResource();
    The required resource is available in the concerned path. But the file url returns null
    Can you please help in solving the problem.
    Thanks and Regards,
    Mclaren

    Where (text area, label, button) do you want it to do it.
    What do you want it do (browse within the local text area, open the default browser...)
    Text area, use above, JButton (or alike) and open default browser, use ActionListener and JDIC.

  • Urgent export help needed

    Extremely urgent help needed! I'm on a tight deadline. I'm working on a sequence, with all my settings set to DV. My client needs an AVI file as an output. After exporting using conversion, the file looks and plays fine, except for any transitions. At the start of each transition, there is 1 frame that is unrendered. I have rendered the entire sequence, and tried the export many times now, and I can't figure out what's wrong. I'm working on v5.1.4. Can someone please help?????

    Thank you, kind sir! < </div>
    Careful who you're callin' names around here, buddy!
    Thank you for the kind words, that's why we're here. Hrdly anyone ever closes their threads on a positive note, I thank you for that, too.
    Good luck with your future projects and those squeaky deadlines.
    bogiesan

  • Urgent help needed to get this home page up!

    Hi,
    I need urgent help with this and it is driving me crazy. For
    some reason my animation starts at its fastest and won't stop until
    you click the area then it works properly. I have no clue why it is
    doing this and only seems to do it on a PC browser not on a Mac.
    Can anyone help please!!!!!
    Link to sample:
    http://www.totalamber.com/test.html
    Link to fla:
    http://www.totalamber.com/flash/homepage.fla
    Thanks so much for anyone who can help or tries to help me.
    Neil
    Ps this is urgent and i can't find a solution by searching on
    here

    Thanks to anyone who has looked at this but i have found the
    answer.
    It is due to what many of the users on here will already know
    and can be explained in this link:
    http://blog.deconcept.com/swfobject/
    I had forgot about the legal patent going on with microsoft!
    Hope it helps anyone else as bad as i am.
    Neil

  • Help !! Bits and Bytes - Come get these Dukes

    Can someone please shed some light on this ... I come from a C background and had no problems reading files in bits. I can't seem to find a way to read bit by bit in Java.
    I have a file which is written in an unknown format. All I have been told is that it could be either 4 / 5 / 6 etc bits per byte.
    I want to write a program that can create the above byte sizes and then print the ascii equivilent.
    So any help or an example on how to read a file bit by bit would be most appreciated.
    Robin

    I come from a C background and had no problems reading files in bitsInteresting!
    I can't seem to find a way to read bit by bit in Java.That's because there isn't any bit reader in Java but there is nothing to stop you from reading a byte at a time and pick the bits you want..... It seems to me you're not going to get very far without having more info on what's in the file. BigEndian/LittleEndian could compound your problem.
    Have fun!
    ;o)
    V.V.

Maybe you are looking for

  • Elements Organizer 12 Doesn't Open under Mac OS 10.6.8

    I have just installed elements 12 (from a disk) onto my Mac with OSx10.6.8 and organiser fails to open with an error message (sent to Adobe). It asked my to reinstall which I have done byt I get the same error message and cannot use organiser (though

  • Goods issue print out

    Hi I have completed stock transport order purchase order.then i do in t.code mb11 351 movement type goods issue.i want to take print out on that 351 goods issue,i try to give output type in mb02 t.code that time showing error,plz help Output WA02 for

  • System will not boot after trying to upgrade to yosamite

    My wife tried to update her OS to yosamite on her MBP 2011. Now it wont boot at all. All she gets is the folder question mark screen. It won't boot in safe mode and won't do a recovery from internet. Please help !

  • Migration from non-Firewire MacBook to new Retina MacBook

    I have just purchased a new Retina MacBook.  My current MacBook is the 2008 model without a Firewire port.  Since the old MacBook does not have Firewire or Thunderbolt, and the new MacBook does not have Ethernet, I am left with Wi-Fi as the migration

  • External harddrive suggestion to boost my computer...

    Hello, I'm stuck at a standstill with my project because I'm all out of memory. I'm dealing with 32 hours of footage. I tend to put most of it on the computer before trimming it down, just to see what I'm working with. I still have roughly 20 hours o