Search:

Type: Posts; User: JohnEliot

Search: Search took 0.29 seconds.

  1. How do you add a value to a 2-d array by row number and column number?

    Let's say I have a 2-d array of doubles of 3 rows and 5 columns named sales
    double [][] sales = new double [3][5];

    How do i add a value to a specific row and column, or cell? I am trying to write...
  2. Replies
    4
    Views
    241

    Re: Can't declare Variable in new method

    The if statement is not a loop. In only needs {} if it is a loop, no?
  3. Replies
    4
    Views
    241

    Can't declare Variable in new method

    In the very last method below


    import javax.swing.JOptionPane;
    public class program08 {
    public static void main(String[] args) {
    String getWeightString = JOptionPane.showInputDialog(null,...
  4. Replies
    7
    Views
    433

    Re: How can I make a loop repeat?

    Okay, I have made some indentations at key points and just including the final loop. This is the part I want fixed.


    String reply = JOptionPane.showInputDialog
    (null, "Enter 'E' to buy...
  5. Replies
    7
    Views
    433

    Re: How can I make a loop repeat?

    Okay I have enclosed the loop, but it still won't repeat when yes is selected. I have also attempted to make the program more readable with indentations


    import javax.swing.JOptionPane;
    public...
  6. Replies
    7
    Views
    433

    How can I make a loop repeat?

    import javax.swing.JOptionPane;
    public class program7 {

    public static void main(String[] args) {

    //ask user how many euros a dollar buys
    String euroExchangeRateString =...
  7. Replies
    1
    Views
    309

    How can I make a loop repeat?

    import javax.swing.JOptionPane;
    public class program7 {

    public static void main(String[] args) {

    //ask user how many euros a dollar buys
    String euroExchangeRateString =...
  8. [SOLVED] How to round to 2 decimal places in a dialog box

    I know how to print using the printf method, but can't for the life of me get it to round to two decimal places using a dialog box.


    import javax.swing.JOptionPane;

    public class Program6 {

    ...
  9. Replies
    5
    Views
    256

    [SOLVED] Re: Need help with loop

    How do I make a non-numeric letter represent an integer value? It can only be "Y" "N" or "Q"
  10. Replies
    5
    Views
    256

    [SOLVED] Re: Need help with loop

    Here it is:
    Exception in thread "main" java.lang.NumberFormatException: For input string: "y"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at...
  11. Replies
    5
    Views
    256

    [SOLVED] Need help with loop

    It is a loop program that counts Yes votes with 'Y', no votes with "N" and to quit is "Q" and after quit is chosen it shows number of yes votes and number of no votes, all in a dialog box. Here it...
Results 1 to 11 of 11