write a pay-raise program that requests a person's first name, last name, and current annual salary, and then displays the person's salary for the next year. People earning less than $40,000 will receive a 5% raise, and those earning $40,000 or more will receive a raise of $2,000 plus 2% of the amount over $40,000. the main function should call three functions- one (multi-valued) for input, one to calculate the new salary, and one for output

Respuesta :

Without more information for what the programming language is I cannot give a full answer, so I listed a potential method for calculating salary.

To calculate the salary (Java):

public static double getSalary(double salary) {

   if (salary < 40000) {

        return salary + (salary * 0.05);

   }

   return 2000 + ((0.02 * salary) + salary);

}

To calculate the salary (VB .Net):

Function getSalary(ByVal salary As Double) As Double

   If salary < 40000 Then

       salary = salary + (salary * 0.05)

   Else

       salary = 2000 + ((0.02 * salary) + salary)

   End If

   Return salary

End Function