each worker receives 5% raise each year.
lets say I type in 20000 for starting salary and the dude is age 65 how would I computer that each year
here is the code I have so far and it gives me 21000 as the asnwer. I know my math is not right somewhere
WHOLE CODE:
import java.io.*;
public class problem6
{
public static void main(String[] args)
throws java.io.IOException
{
double age, lcv, startsalary, endsalary = 0;
String s1, s2, s3;
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
System.out.println ("Please enter your name:");
s1 = br.readLine().toUpperCase();
System.out.println ("Please enter your age:");
s2 = br.readLine();
age = Double.parseDouble(s2);
System.out.println ("Please enter your starting salary:");
s3 = br.readLine();
startsalary = Double.parseDouble(s3);
for (lcv = 0; lcv <= 65; lcv++)
{
endsalary = (startsalary *= 1.05);
}
System.out.println (age + "\t" +s1+ "\t" +startsalary);
System.out.println (endsalary);
}
}
lets say I type in 20000 for starting salary and the dude is age 65 how would I computer that each year
here is the code I have so far and it gives me 21000 as the asnwer. I know my math is not right somewhere
WHOLE CODE:
import java.io.*;
public class problem6
{
public static void main(String[] args)
throws java.io.IOException
{
double age, lcv, startsalary, endsalary = 0;
String s1, s2, s3;
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
System.out.println ("Please enter your name:");
s1 = br.readLine().toUpperCase();
System.out.println ("Please enter your age:");
s2 = br.readLine();
age = Double.parseDouble(s2);
System.out.println ("Please enter your starting salary:");
s3 = br.readLine();
startsalary = Double.parseDouble(s3);
for (lcv = 0; lcv <= 65; lcv++)
{
endsalary = (startsalary *= 1.05);
}
System.out.println (age + "\t" +s1+ "\t" +startsalary);
System.out.println (endsalary);
}
}
