Results 1 to 1 of 1
Thread: Do while loop
- 02-12-2012, 03:50 PM #1Member
- Join Date
- Feb 2012
- Rep Power
Do while loop
How would I insert the following code, into a do while loop following the below critieria
int contribution=(int) (salary*(limit/100));
int cumulcontribution += contribution;
System.out.println(age +salary +limit +contribution +cumulcontribution);
(A) Compute a cumulative total retirement contribution.
The limit to contributions is determined by the age, as follows:
-- if age is greater than 50, limit is 40%.
-- if age is greater than 40 but less than or equal to 50, limit is 30%.
-- limit is 25 % in all other cases.
( Assume the contributions begin at age 30 and amount equal to the limit is contributed.)
(B) Increment the salary by 3 % every year
(C) Using a product of salary and limit percent, compute the current year's contribution and add to the cumulative total
(D) Check if current age is a multiple of 5, using the modulus (%) operator. If so, print out the current values of: age, salary (truncate fraction or cents.. example: print 38504 if value is 38504.82), limit (%), contribution and cumulative contribution.
}while (age>=30 && age <=60);
if (age > 50)
limit = 40;
else if (age > 40 && age <= 50)
- By JavaProg in forum New To JavaReplies: 2Last Post: 11-07-2011, 03:25 AM
- By JPH in forum New To JavaReplies: 1Last Post: 10-01-2011, 02:12 AM
- By Streetproject in forum AWT / SwingReplies: 2Last Post: 02-16-2011, 06:46 PM