a little problem whit java code

From: peterx (aaabbse_at_yahoo.se)
Date: 11/19/04


Date: Thu, 18 Nov 2004 18:03:43 -0500

Hi again!
I have a litle problem whit this question:
I try to write a program about Salary. The user writes(puts in from
keyboard)
the workers name, hourePayment and hour(how many hours He has worked).
The program must compute first week ,second week....fourth week

The user writes just one time name and hourPayment,
but he must write hours(total hours he has worked)
for every week(may be ha has worked 30 hours first week and 40 hours
second week.....).
when the user puts in zero
the program stops(while(hour!=0)).

I wrote the program but I have problem whit
Test class when the program computes first ,second and...weeks, and if the
user don not put in zero the program must compute another persons salary
we should give new name new houre payement....
how do I use the same information for second person and computes his
salary.

[code]
 class Salary
{
    private String name;
    private int hourPayment;
    private int normalSalary;
 
    public Salary(String name, int hourPayment )
   {
    this.name= name;
    this.hourPayment=hourPayment;
   }
    public String getNamn()
   {
     return name;
   }
    public int getHourPayment()
   {
     return hourPayment;
   }
    public int SalaryCompute(int time)
   {
            if( time<=40)
           {
               normalSalary=(hourPayment*time);
            }
      else
              if(time>40 && time<=70)
     {
              normalSalary=(int)((40*hourPayment)+( time - 40)
                                 *(1.5)*hourPayment);
             }
       else
       if(time>70)
      {
              System.out.println("WARRNING:"+" "+"You have
                          worked more than 30 houres");
              normalSalary =(int) ((40*hourPayment)+(
             time - 40)*(1.5)*hourPayment);

      }
                return normalSalary;
    }
       public String toString()
      {
             return (name+" "+hourPayment);
      }

 }
  [/code]



Relevant Pages