Page 1 of 2 12 LastLast
Results 1 to 20 of 27

Thread: Java Program

  1. #1
    icedragon770 is offline Member
    Join Date
    Oct 2008
    Posts
    36
    Rep Power
    0

    Default Java Program

    dont know how to do it. need the output to be: "The charge for this table is $400.00

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,607
    Rep Power
    23

    Default

    Use: System.out.println(<your message here>);

    Otherwise explain what you are doing.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    RTFM: Sun Java Tutorials

    Best of luck!

  4. #4
    icedragon770 is offline Member
    Join Date
    Oct 2008
    Posts
    36
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Use: System.out.println(<your message here>);

    Otherwise explain what you are doing.
    yo whats ur aim?
    System.out.println("The charge for this table is $" + charge); thats what i need but i do not know how to initialize

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    please see my link.

  6. #6
    icedragon770 is offline Member
    Join Date
    Oct 2008
    Posts
    36
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    please see my link.
    didnt help yo

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    didnt help yo
    Then maybe you need to ask a better question to get a better answer. This site has helped me in the past, perhaps it can help you: How To Ask Questions The Smart Way

  8. #8
    icedragon770 is offline Member
    Join Date
    Oct 2008
    Posts
    36
    Rep Power
    0

    Default

    what does this mean
    a variable for cost of table to initialized to 0.00 is there a code for that??
    also do have aim?

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    so you have a variable named "charge", how would you initialize this to 0?

  10. #10
    icedragon770 is offline Member
    Join Date
    Oct 2008
    Posts
    36
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    so you have a variable named "charge", how would you initialize this to 0?
    int CostTable= 0

  11. #11
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    OK, a variable called costTable (try to follow java conventions and avoid capitalizing the first letter of a variable). This would work but if you want to use it in floating point calculations, this shouldn't be an int but rather a double. Also, don't forget the semicolon at the end of the line.

  12. #12
    icedragon770 is offline Member
    Join Date
    Oct 2008
    Posts
    36
    Rep Power
    0

    Default

    ok how do i get to output of 400.0 charge if the charges for all tables is a minimum of 150.00 if surface area (tableLength * tableWidth) is over 750.00, add $50.00. if wood is "mahogany" add $200.00; for "oak" add $100.00. no charge is added for "pine". For extension leaves for table, there is an additional $50.00 charge. how do i do a java structure?

  13. #13
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    You write the appropriate code to do the calculations, then output as Norm showed you above. As most of us believe that the best way for students to learn is to try it themselves, I suggest you study your texts and notes, and try to come up with some code yourself. If you then have some bugs, please print your code and your questions specific to your code. Good luck!

  14. #14
    icedragon770 is offline Member
    Join Date
    Oct 2008
    Posts
    36
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    You write the appropriate code to do the calculations, then output as Norm showed you above. As most of us believe that the best way for students to learn is to try it themselves, I suggest you study your texts and notes, and try to come up with some code yourself. If you then have some bugs, please print your code and your questions specific to your code. Good luck!
    okay it wants a variable for cost of table to be initalized to 0.00
    a variable for length of table initalized to 50 inches
    a variable for Width of table in 40 inches.
    a variable for surface area of table. a vairable for wood type initialized with the value "oak".
    a variable for the number of extension leaves initialzed with value 2.
    what does it mean by that and the information before this

  15. #15
    icedragon770 is offline Member
    Join Date
    Oct 2008
    Posts
    36
    Rep Power
    0

    Default

    thanks for a bit help

  16. #16
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    It sounds like you're in a beginning Java course and are completely lost. First off, don't panic; this is common when trying to learn something new and different from what you're used to. Next of all, in this situation if you cannot make heads or tails from your books or notes, then you're probably beyond what we can help you with here. You need to contact your teacher or a tutor without delay and get some one-on-one help. It's the best way to get up to speed quickly. Lastly, please don't ask to IM any of us as per your private note to me. We're volunteers here and all value our privacy.

    Again, good luck.

  17. #17
    icedragon770 is offline Member
    Join Date
    Oct 2008
    Posts
    36
    Rep Power
    0

    Default

    okay so how do i intalized that variable?

  18. #18
    icedragon770 is offline Member
    Join Date
    Oct 2008
    Posts
    36
    Rep Power
    0

    Default

    so do i do double varible ; ??

  19. #19
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,607
    Rep Power
    23

    Default

    Depends on what range of values you need. For dollar/currency amounts, its recommended that you use an integer to prevent rounding errors.
    There have been many threads on this forum on how to compute and format dollar/currency amounts. Use Search.

  20. #20
    icedragon770 is offline Member
    Join Date
    Oct 2008
    Posts
    36
    Rep Power
    0

    Default

    so how do i initalized a variable like charge for cost of table?

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  2. New to Java Program
    By jvasilj1 in forum New To Java
    Replies: 1
    Last Post: 02-05-2008, 07:22 AM
  3. Replies: 0
    Last Post: 10-04-2007, 09:33 PM
  4. help with java program
    By mattvgt in forum New To Java
    Replies: 3
    Last Post: 07-14-2007, 04:57 PM
  5. java program
    By nehasahu in forum New To Java
    Replies: 5
    Last Post: 07-12-2007, 11:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •