My teacher says its easy but I still can't find a solution for this, when i use %if i could get the answer but there is an f at the end of the answer so i tried using %lf again but it even gets worse and the answer becomes 0.00000 . I really couldn't find for a solution for this yet and it's been 3 days. My teacher said that we should make some research about this but i really can't find the answer even in google and youtube. This is my first time engaging in Programming so it really gave me a headache. I hope that i could get help in here. Thanks.
The output that my teacher wants us to do is just like this sample:
Enter Employee Type:r
Enter # of Hours:40
The Salary of the Regular Employee is 13280
...............................................................................................................
Here is the given,,
Employee type Salary
Regular Employee 332/hrs
Part-time Employee 283/hrs
Commision Employee 8000+%Commission Employee
... here is the file that i made... midterm practical.c
#include<stdio.h>
#include<conio.h>
void main()
{
int Salary=0;
int Hours;
char type;
printf("Enter Employee Type:");
scanf("%c",&type);
if(type=='r'||type=='R')
{
printf("Enter # of Hours:");
scanf("%d",&Hours);
Salary=332*Hours;
printf("The Salary of the Regular Employee is %lf",Salary);
}
else if(type=='p'||type=='P')
{
printf("Enter # of Hours:");
scanf("%d",&Hours);
Salary=283*Hours;
printf("The Salary of the Part-time Employee is %lf",Salary);
}
else if(type=='c'||type=='C')
{
printf("Enter # of Hours:");
scanf("%d",&Hours);
Salary=325*Hours;
printf("The Salary of the Commission Employee is %lf",Salary);
}
else
{
printf("The Input is Invalid");
}
getch();
}