Class Assignment 3

Due on Monday, March 15, 2004

Repetition Structures

Wendy is going to work until she has saved $9,500. for university.  She starts at a new job where she begins with a salary of $140.00 per week.  Each week she gets a raise of $5.00, such that her pay for the second week would be $145.00, the third week $150.00 and so on.

Write a program in Java with the method calcWorkTime that accepts as input the initial pay, the raise per week and the target savings.  The method should return the number of weeks that would be required to raise the target savings.  The first line of the method would be:

public static int calcWorkTime (double initialPay, double raise, double targetSavings)

**Note the method MUST use a while loop to calculate the number of weeks.

Evaluation:

Use of while loop        /4
Algorithm                   /4
Commenting                 /2

Hosted by www.Geocities.ws

1