COMPANY INCREMENT
Problem Description
At a particular company, employees are rated at the end of each year. The rating scale begins at 0.0, with higher values indicating better performance and resulting in larger raises. The value awarded to an employee is either 0.0, 0.4, or 0.6 or more.
Values between 0.0 and 0.4, and between 0.4 and 0.6 are never used. The meaning associated with each rating is shown in the following table. The amount of an employees raise is 5000.00 multiplied by their rating.
Rating Meaning
0.0, 0.1,0.2,0.3 Unacceptable performance
0.4 Acceptable performance
0.6 or more Meritorious performance
Write a program that reads a rating from the user and indicates whether the performance was unacceptable, acceptable or meritorious. The amount of the employees raise should also be reported.
Your program should display an appropriate error message if an invalid rating is entered.
Test case:
Input 1:
0.4
Output 1:
Acceptable
2000.0
CODING ARENA
#include <stdio.h>
int main()
{
float a;
scanf("%f",&a);
if(a>=0.0 && a<0.4)
{
printf("Unacceptable\n");
printf("0");
}
else if(a>=0.4 && a<0.5)
{
printf("Acceptable\n");
printf("%.0f",a*5000);
}
else if(a>=0.6)
{
int b=a*5000;
printf("Meritorious\n");
printf("%d",b);
}
return 0;
}
Test Case 1
Input (stdin)0.3
Expected Output
Unacceptable
0
Test Case 2
Input (stdin)0.9
Expected Output
Meritorious
No comments:
Post a Comment