Status
Not open for further replies.

allmighty581772

Banned
Banned
39
2008
0
0
I am new, and also i am a java programmer, well i wanna become a good one and learning. (student).....

Code:
import javax.swing.JOptionPane;
public class GetUserInput
{
    public static void main(String[] args)
    {
        String input;
        boolean done = false;
        while (!done)
        {
            input = JOptionPane.showInputDialog("Enter some input (or Cancel to finish):");
            if (input == null)
            {
                done = true;
            }
            else
            {
                JOptionPane.showMessageDialog(null, "You entered " + input);
            }
        }
    }
}

Write a program called GetUserInput.java that allows the user to enter the prices of several items they have bought and then tells them the total amount. The user can enter the prices for as many items as they want, until they click Cancel. The program should then output the total amount they spent, in a message dialog box. Use pounds for all the amounts.

2euoi01.jpg


I have really been trying really hard to understand but its just not working!!!!!!!!!!!!!!

Please help me
 
1 comment
This coding was given by the teacher and told me to change the coding...i know that in between the ELSE statement, the code goes there and the JOptionPane for displaying the total should go outside the ELSE statement.

I also know that i need to make a new variable to store the amount of data such...
 
Status
Not open for further replies.
Back
Top