Total Coding Newbie that's going to be asking a ton of dumb questions :)
Here's my latest project!
package money;
import java.awt.Component;
import javax.swing.JOptionPane;
public class Money
{
private static Component frame;
public static void main(String[] args)
{
int d = 0;
boolean fin = true;
Double[] z = new Double[3];
do
{
String x = JOptionPane.showInputDialog("Please enter the initial value, followed by the annual \nincrease as a percentage per year, then the term in years\nseparated with a ',' and without spaces. (eg. 1,2,3)");
x += ",";
int a = 0, y = -1;
for(int i = 0; i < x.length(); i++)
{
if(x.charAt(i) == ',')
{
z[a] = Double.parseDouble(x.substring((y + 1), i));
y = i;
a++;
}
}
while(z[2] > d && z[2] <= 15)
{
d++;
z[0] *= (1 + z[1]/100);
}
if(z[2] > 15)
{
JOptionPane.showMessageDialog(frame, "The length of time of the investment is too long! \nPlease enter a length of less than 15 years.");
}
else
{
JOptionPane.showMessageDialog(frame, "The final amount will be $" + (Math.floor(z[0] * 100) / 100.0));
fin = false;
}
}while(z[2] >= 15 && fin);
}
}