1 2 Previous Next 16 Replies Latest reply: Nov 26, 2006 12:23 PM by 807607 RSS

    problem with passing a integer!!!!!

    807607
      hi..

      basically i want to print the price of cars and the number of days the car has been rented. the problem i always get days rented out = 0. but the print out should display the days entered in the textfield?.....

      help would be great!!

      ---GUI
      private int numberOfDays = 0;
       car.setMake((String) carBox.getSelectedItem());
                  car.setNumberOfDays(numberOfDays);
                   car.printDetails();
      --car class

      below is the code in the car class.
       public void printDetails()
          {System.out.println("Price for " + numberOfDays + " Days Car Rental: " + "�" + price_per_day * numberOfDays);
      }
        • 1. Re: problem with passing a integer!!!!!
          807607
          That is not enough code for us to tell whats wrong.
          • 2. Re: problem with passing a integer!!!!!
            807607
            the program is very large, so ive taken out the parts that are relevant to the question that im asking.

            below are the full methods im working with --
             try
                                {
                                    //order.addNew();
                                    //order.printDetails();
                                    car.setMake((String) carBox.getSelectedItem());
                                    car.setNumberOfDays(numberOfDays);
                                    car.printDetails();
                                    //car.setOn_loan(true);
                                    //car.update();
                                    //carRegList.removeElementAt(carBox.getSelectedIndex());
                                    //carBox.removeItemAt(carBox.getSelectedIndex());
                                    //car.setMake((String) carBox.getSelectedItem());
                                    System.out.println("car: " + carBox.getSelectedItem());
                                    order.addNew();
                                    
                                }
            -----car
               //set the price for a car
                public void printDetails()
                {
                    if(make.equals("Ford GT40"))
                    {
                        price_per_day = 20; 
                    }
                    //print the information 
                    System.out.println("Price for the Car Rental: ");
                    //System.out.println("Customer Name: " + customer.getName());
                    //System.out.println("Customer Age: " + customer.getAge());
                    //System.out.println("Customer Address: " + customer.getAddress());
                    //System.out.println("Customer ID: " + customer.getPhoneNo());
                    System.out.println("number OF days: " + numberOfDays);
                    System.out.println("Price for " + numberOfDays + " Days Car Rental: " + "�" + price_per_day * numberOfDays);
                        
                }
                
            • 3. Re: problem with passing a integer!!!!!
              796440
              That is not enough code for us to tell whats wrong.
              And it's too many bloody exclamation marks to make me care what's wrong.

              Why to people think that helps? It's just fuckall annoying.
              • 4. Re: problem with passing a integer
                807607
                You showed us where you set numberOfDays to 0, but you dont appear to be changing it.
                • 5. Re: problem with passing a integer!!!!!
                  807607
                  And it's too many bloody exclamation marks to make me care what's wrong.
                  Why to people think that helps? It's just fuckall annoying.
                  Listen here you girls blouse ......it got your attention ----- do me a favour a keep your opinions to yourself......guys like you are very annoying!!! ass
                  • 6. Re: problem with passing a integer!!!!!
                    807607
                    Listen here you girls blouse ......it got your
                    attention ----- do me a favour a keep your opinions
                    to yourself......guys like you are very annoying!!!
                    ass
                    Here we go again...
                    • 7. Re: problem with passing a integer!!!!!
                      807607
                      private int numberOfDays = 0
                      i thought by decalring number of days to 0 at beginning of the GUI this would be fine. I have tried to use interger.parseInt but i get an error message.

                      I was thinking that I wasnt getting number of days from the textfield but couldnt figure out a way to fix that any ideas?
                      • 8. Re: problem with passing a integer!!!!!
                        796440
                        And it's too many bloody exclamation marks to make
                        me care what's wrong.
                        Why to people think that helps? It's just fuckall
                        annoying.

                        Listen here you girls blouse ......it got your
                        attention ----- do me a favour a keep your opinions
                        to yourself......guys like you are very annoying!!!
                        ass
                        You stupid, pathetic, self-centered child. The exclamation marks absolutely, positively did NOT ge your question answered any faster. They did NOT draw people in to answer that wouldn't have noticed it otherwise. I 100% guarantee it.

                        Captain answered your question despite the whining the !!!! imply, not because of it. People here are not impressed with stupid little tricks to "get our attention" like !!!!! and PLZZZZZZZZ and URGENT. That shit is just annoying and detracts from your message.

                        If you want the best help possible, as soon as possible, then you should focus on clearly, concisely, thoroughly conveying your problem, and on nothing else.

                        It got my attention all right--enough to irritate me to NOT try to help you with this question. Your pissy attitude has convinced me not to ever help you with any other questions that might come up.
                        • 9. Re: problem with passing a integer!!!!!
                          807607
                          You stupid, pathetic, self-centered child. The exclamation marks >absolutely, positively did NOT ge your question answered any faster. They >did NOT draw people in to answer that wouldn't have noticed it otherwise. I >100% guarantee it.
                          It got my attention all right--enough to irritate me to NOT try to help you with >this question. Your pissy attitude has convinced me not to ever help you >with any other questions that might come up.
                          ok. but maybe instead of swearing the first time, you could have asked politley and the response would have been polite....if you are rude to someone dont expect anything else but the same right back at you!
                          all that had to be said was please dont do this, and the probelm was solved.....but you got personal!!
                          • 10. Re: problem with passing a integer!!!!!
                            807607
                            private int numberOfDays = 0
                            i thought by decalring number of days to 0 at
                            beginning of the GUI this would be fine.
                            !!F!ine!f!!!o!r!!!w!!h!a!t!!!?!!!!!!!
                            I have tried
                            to use interger.parseInt but i get an error message.
                            S!o!!!!y!o!u!!!m!ean!!!!!y!o!!!!u!t!r!y!!!a!!!!!!!!!!n!d!c!h!a!ng!!e i!!!!!!!!t! t!o s!o!m!e!!!!t!h!i!n!g!e!ls!!!!e!but!!it!f!ails!!!!!?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Th!!en!!it!i!s!s!!t!i!l!l z!e!r!o!!You!!!!!s!h!!!!!o!u!!!ld!!!l!o!!o!k!a!t!!w!!!!!!!h!!y!t!h!a!t! !i!s! !h!a!p!p!e!n!i!n!g!.!

                            >
                            I was thinking that I wasnt getting number of days
                            from the textfield but couldnt figure out a way to
                            fix that any ideas?
                            Y!e!!!!s.!You!!!!!!!post your code!!!!!!!!!!!!!!!w!!h!e!r!e!o!u!t!r!y! !an!d!s!!!e!t! !n!u!m!b!e!!!!!!r!O!f!D!a!y!s! !t!o! !s!o!m!!!!e!t!h!i!n!g! !e!!!!ls!e.!!!T!he!r!e! !i!s!!!! !n!o!t!h!i!n!!!!!!!!!g!!w!!r!o!!!n!g! !!!w!h!e!!!r!e! !!!y!ou!!!! c!!!!r!e!a!!!!!t!e!!!! !!!t!h!e! !o!bj!ec!!!!!!!!!t! o!r !u!!!s!e! !t!h!!e! !v!a!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!r!i!a!b!l!e!!!!! !t!o! !s!e!t! !i!t!.! !B!u!t! !a!s! !!!n!!o!t!e!d! !i!f! !n!u!m!b!e!r!O!f!D!!!a!y!s!! !d!o!!!!e!s! !n!o!t!!c!h!a!!n!!!!g!e! !t!h!e!n! !y!o!u! !h!a!v!e!!!! !a! !p!r!o!b!l!e!m!.! !S!o! !p!l!e!a!s!e! !p!!!!!!!o!s!! !t!h!a!t! !c!!o!d!e!.!!!!!!!!!!!!!!!!!!!!!!!!!
                            • 11. Re: problem with passing a integer!!!!!
                              796440
                              Using all the exclamation marks in the first place was impolite. It's like yelling, "Hey! Look at me! Answer my question first!" It's like you're telling us that we should consider your question to be more important than others'. Because you led off with that annoying rudeness, I didn't feel any compulsion to be polite in my comments.
                              • 12. Re: problem with passing a integer!!!!!
                                807607
                                Using all the exclamation marks in the first place was impolite. It's like yelling, >"Hey! Look at me! Answer my question first!" It's like you're telling us that we >should consider your question to be more important than others'. Because you >led off with that annoying rudeness, I didn't feel any compulsion to be polite in >my comments.
                                ok fair enough...if i knew that rule i wouldnt have done it......im not a rude person at all.....if those are the rules then i apologise for that, but i will stand up and fight my corner when things get taken to far. all that had to be said was please dont do this, and the i wouldnt have done it....quick, painless and harmful...
                                • 13. Re: problem with passing a integer!!!!!
                                  807607
                                  Y!e!!!!s.!You!!!!!!!post your
                                  code!!!!!!!!!!!!!!!w!!h!e!r!e!o!u!t!r!y!
                                  !an!d!s!!!e!t! !n!u!m!b!e!!!!!!r!O!f!D!a!y!s! !t!o!
                                  !s!o!m!!!!e!t!h!i!n!g! !e!!!!ls!e.!!!T!he!r!e!
                                  [snip]

                                  It's Prttey fnuny how we can raed tihs einrte snetnece wtih all tehse ltters all out of palce, and we can cnotniue to keep raednig and sitll mekas snece of waht we are raeding. No mttar how mnay tmies you raed tihs oevr and oevr you can sitll mkae snece of it.
                                  How is taht pssoible?
                                  • 14. Re: problem with passing a integer!!!!!
                                    796440
                                    Using all the exclamation marks in the first place
                                    was impolite. It's like yelling, >"Hey! Look at me!
                                    Answer my question first!" It's like you're telling
                                    us that we >should consider your question to be more
                                    important than others'. Because you >led off with
                                    that annoying rudeness, I didn't feel any compulsion
                                    to be polite in >my comments.

                                    ok fair enough...if i knew that rule i wouldnt have
                                    done it......im not a rude person at all.....if those
                                    are the rules then i apologise for that, but i will
                                    stand up and fight my corner when things get taken to
                                    far. all that had to be said was please dont do this,
                                    and the i wouldnt have done it....quick, painless and
                                    harmful...
                                    Okay, that's reasonable. I would have thought it would just be common sense not to add !!!!!!, but maybe not. Sorry for getting bitchy. You see stuff like that enough and it gets to be be much more irritating than any one occurrence would otherwise be by itself.
                                    1 2 Previous Next