Search:

Type: Posts; User: Cal S.

Search: Search took 0.26 seconds.

  1. Replies
    9
    Views
    1,012

    [SOLVED] Re: Nested 'If' Statements

    Definitely keep that in mind for the future, thank you.
  2. Replies
    9
    Views
    1,012

    [SOLVED] Re: Nested 'If' Statements

    Yeah, there weren't any red lines or anything. I just skipped over it when writing it the first time and never saw it again.
  3. Replies
    9
    Views
    1,012

    [SOLVED] Re: Nested 'If' Statements

    You've got to be kidding me...

    Wow. Newer to this than I thought! ;))

    I figured it had to be something simple. Oy vey. It works now, thanks so much!
  4. Replies
    9
    Views
    1,012

    [SOLVED] Re: Nested 'If' Statements

    The zero index simply says "Choose Shape" and is not coded. As far as I can tell, it hasn't affected the rest of the program.

    I should put an error message in there if the end user leaves it like...
  5. Replies
    9
    Views
    1,012

    [SOLVED] Nested 'If' Statements

    Hello again, all,

    I am in the process of creating a calculator GUI that calculates different answers based on inputs two main comboboxes and numbers in the appropriate textfields. The first one...
  6. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    That's kind of what I was hoping you could tell me.

    It's set up so that the user has an option of choosing a material from a drop-down menu (materialDropDown). Then they choose a shape--cylinder...
  7. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    Because it's a GUI, the output shows up in the JLabel that has its setText determined in each statement without the need for the println statements. I can and have run line-by-line debug through...
  8. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    Norm, I just want to say I really appreciate your help thus far. I also thank you for your patience in dealing with me. Here is the code in its (relative) entirety. I have determined that if I...
  9. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    I'm sorry, but the "Println" statements would literally only show what's written to the JLabel in the setText statements; the '$0.0' outputs. There are no errors, it just fails to do the math...
  10. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    Let me try to go through the brief history with comments in the code:

    Real quick, this code is hundreds of lines long. The ending }s are in fact in the code, but not for another 50 lines or so....
  11. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    Strangely the cylinder portion functions properly without them. Good fortune on my part, I suspect. Still doesn't fix the errors encountered with the rectangle portion, as amended here:



    //If...
  12. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    Looks like celebration was a tad premature on my account.

    I'm not entirely sure how that made the first one work, but it's not working on the second or subsequent lines of code. They're still...
  13. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    Yes indeed, that's what I was thinking. Thanks again!
  14. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    Thank you!

    It seems to work this way now. This:



    if(materialDropDown.getSelectedIndex()==0)
    totalPrice.setText("The price is: $"
    +...
  15. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    double number1, number2, number3, number4;
    // Make sure numbers entered are whole numbers
    try {
    number1 = Double.parseDouble(
    this.diameterBox.getText());
    ...
  16. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    Like this?

    double number1, number2, number3, number4;
    // Make sure numbers entered are whole numbers
    try {
    number1 = Double.parseDouble(
    this.diameterBox.getText());
    number2 =...
  17. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    Not sure exactly how to do that.

    Also, because I'm multiplying and inputting decimal numbers I cannot use 'int' variable, I have to use 'double' or 'float'. However, now that I've done that, the...
  18. Replies
    27
    Views
    2,722

    [SOLVED] Re: Formatting answers to 2 decimal places

    Thank you for the quick response! Maybe I'm a little newer than I thought. I just edited my question after you answered, so I apologize for that, but here's a snippet of my declarations:
    ...
  19. Replies
    27
    Views
    2,722

    [SOLVED] Formatting answers to 2 decimal places

    Hello all,

    I've been scanning forums for answers to this problem, but most deal with simple programming that you might find in a classroom (i.e. "System.out.printf") which will not work in the GUI...
Results 1 to 19 of 20