Hi, can someone please help me with this as I'm still a noob to this.
When i do this using ints it works fine but as soon as I use doubles it fails.
double price = 0, total = 0;
for (int i = 1; i <= 3; i++)
{
price= Double.parseDouble(JOptionPane.showInput… enter price"));
price+=total;
}
System.out.print("Total = " +total);
Now it loops 3 times if I enter "2" three times with that using Ints it prints Total = 6. Using doubles it shows up as Total = 0.0.
Any help would be appreciated,
Thanks
When i do this using ints it works fine but as soon as I use doubles it fails.
double price = 0, total = 0;
for (int i = 1; i <= 3; i++)
{
price= Double.parseDouble(JOptionPane.showInput… enter price"));
price+=total;
}
System.out.print("Total = " +total);
Now it loops 3 times if I enter "2" three times with that using Ints it prints Total = 6. Using doubles it shows up as Total = 0.0.
Any help would be appreciated,
Thanks