このコードが総賃金などを計算しない理由を誰かに教えてもらえますか?このコードには、プログラムが望んでいるように計算されないという問題があります。誰かが私がエラーを特定するのを手伝ってもらえますか?
#include <stdio.h>
#include <conio.h>
int main()
{
char fname[20];
char lname[20];
char IDnumber[20];
char Position;
float Hoursworked,Grosspay,Tax,Netpay;
printf(" ************iG Company************** \n\n");
printf("Enter the employee's First Name:\n");
scanf("%s", &fname);
printf("Enter the employee's Last Name:\n");
scanf("%s", &lname);
printf("Enter IDnumber:\n");
scanf("%s",&IDnumber);
printf("<1>Manager <2>Supervisor heart>Employee <4>Office Boy/girl \n");
printf("Enter Position:\n");
scanf("%s", &Position);
switch(Position)
{
case '1':
printf("Rate per hour:P150.00 \n");
printf("No. of hours worked:");
scanf("%d", &Hoursworked);
Grosspay = Hoursworked * 150;
printf("Gross: \n", Grosspay);
Tax = Grosspay * 0.1f;
printf("TAX:\n", Tax);
Netpay = Grosspay - Tax;
printf("NET PAY: \n", Netpay);
break;
case '2':
printf("Rate:P100.00 \n");
printf("No. of hours worked:");
scanf("%d", &Hoursworked);
Grosspay = Hoursworked * 100;
printf("Gross:\n", Grosspay);
Tax = Grosspay * 0.1f;
printf("TAX: \n", Tax);
Netpay = Grosspay-Tax;
printf("NET PAY: \n", Netpay);
break;
case '3':
printf("Rate:P70.00 \n");
printf("No. of hours worked:");
scanf("%d", &Hoursworked);
Grosspay = Hoursworked * 70;
printf("Gross: \n", Grosspay);
Tax = Grosspay * 0.1f;
printf("TAX:\n", Tax);
Netpay = Grosspay - Tax;
printf("NET PAY: \n", Netpay);
break;
case '4':
printf("Rate per hour:P50.00 \n");
printf("No. of hours worked:");
scanf("%d", &Hoursworked);
Grosspay = Hoursworked * 50;
printf("Gross:\n", Grosspay);
Tax = Grosspay * 0.1f;
printf("TAX:\n", Tax);
Netpay = Grosspay - Tax;
printf("NET PAY:\n", Netpay);
break;
default:
printf("Invalid");
}
getch();
}