-
Posts
4 -
Joined
-
Last visited
Awards
This user doesn't have any awards
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
adrian nogo's Achievements
-
thank you master. have a good day
-
how to create a global data? can you give me and example please?
-
it compiles and there's no issues, when I tried to run the program works and functions but when I tried the different choices it doesn't show the entered data when I tried updating, searching and displaying the data.
-
Good day everyone, I'm new in programming and using c language, I'am currently exploring and trying out but I expected my program to work but I don't know what the problem, What should I do? #include<stdio.h> void Entry_Array() { int Em_Num[10],a,r,c,t,p,s,m; int Hours_W[10]; char Em_Stat[10]={'r','R','p','P','c','C','t','T'}; char C_Stat[10]={'s','S','m','M'}; printf("Enter the Employee Number:\n"); for(a=0;a<10;a++) { scanf("%d",&Em_Num[a]); } printf("Enter the Employment Status:\n"); for(a=0;a<10;a++) { scanf("%s",&Em_Stat[a]); } printf("Enter the Civil Status:\n"); for(a=0;a<10;a++) { scanf("%s",&C_Stat[a]); } printf("Enter the Hours Work:\n"); for(a=0;a<10;a++) { scanf("%d",&Hours_W[a]); } for(a=0;a<10;a++) { printf("\nEmployee Number:%d\n",Em_Num[a]); printf("Employment Status:%c\n",Em_Stat[a]); printf("Civil Status:%c\n",C_Stat[a]); printf("Hours Work:%d\n",Hours_W[a]); } } void Search_Array() { int Em_Num[10],a,r,c,t,p,s,m; int Hours_W[10],Search,Flag; int G_Inc,Net_Inc,RPD,RPH,OTH,OT,Basic,P_Health; float SSS,P_i,T_Ded; char Em_Stat[10]={'r','R','p','P','c','C','t','T'}; char C_Stat[10]={'s','S','m','M'}; printf("Enter the Employee Number to be Search:"); for(a=0;a<10;a++) { scanf("%d",&Search); } printf("\n"); for(a=0;a<10;a++) { if(Em_Num[a]==Search) { Flag=1; break; } } if(Flag==1) { switch(Em_Stat[a]) { case 'R': RPD=800; break; case 'P': RPD=600; break; case 'C': RPD=500; break; case 'T': RPD=450; break; default: RPD=400; break; } RPH=RPD/8; if(Hours_W[a]>120) { OTH=Hours_W[a]-120; OT=1.5*(RPH*OTH); Basic=120*RPH; G_Inc=Basic+OT; } else { Basic=Hours_W[a]*RPH; G_Inc=Basic; } if(C_Stat[a]=='S'||C_Stat[a]=='s') { P_Health=500; } else if(C_Stat[a]=='M'||C_Stat[a]=='m') { P_Health=300; } else { P_Health=400; } if(G_Inc>12000) { SSS=0.1; P_i=0.05; } else if(G_Inc>5000) { SSS=0.08; P_i=0.03; } else if(G_Inc<=5000) { SSS=0.05; P_i=0.02; } T_Ded=P_Health+SSS+P_i; Net_Inc=G_Inc-T_Ded; printf("\nEmployee Number:%d\n",Em_Num[a]); printf("Employment Status:%c\n",Em_Stat[a]); printf("Civil Status:%c\n",C_Stat[a]); printf("Hours Work:%d\n",Hours_W[a]); printf("Gross Income=%d",G_Inc); printf("Total Deduction=%f\n",T_Ded); printf("Net Income=%d\n",Net_Inc); } else { printf("\nEmployee Number is not Found"); } } void Update_Array() { int Em_Num[10],a,r,c,t,p,s,m; int Hours_W[10],Search,Flag,TBU,TU; int G_Inc,Net_Inc,RPD,RPH,OTH,OT,Basic,P_Health; float SSS,P_i,T_Ded; char Em_Stat[10]={'r','R','p','P','c','C','t','T'}; char C_Stat[10]={'s','S','m','M'}; printf("Enter the Employee Number to be Updated:\n"); scanf("%d",&TBU); for(a=0;a<10;a++) { if(Em_Num[a]==TBU) { printf("Enter the Values to Update:\n"); scanf("%d",&TU); Em_Num[a]=TU; printf("Successfully Updated the Values\n"); } else { printf("The Employee Number does not exist\n"); } } } void Display_Array() { int Em_Num[10],a,r,c,t,p,s,m; int Hours_W[10],Search,Flag,TBU,TU; int G_Inc,Net_Inc,RPD,RPH,OTH,OT,Basic,P_Health; float SSS,P_i,T_Ded; char Em_Stat[10]={'r','R','p','P','c','C','t','T'}; char C_Stat[10]={'s','S','m','M'}; switch(Em_Stat[a]) { case 'R': RPD=800; break; case 'P': RPD=600; break; case 'C': RPD=500; break; case 'T': RPD=450; break; default: RPD=400; break; } RPH=RPD/8; if(Hours_W[a]>120) { OTH=Hours_W[a]-120; OT=1.5*(RPH*OTH); Basic=120*RPH; G_Inc=Basic+OT; } else { Basic=Hours_W[a]*RPH; G_Inc=Basic; } if(C_Stat[a]=='S') { P_Health=500; } else if(C_Stat[a]=='M') { P_Health=300; } else { P_Health=400; } if(G_Inc>12000) { SSS=0.1; P_i=0.05; } else if(G_Inc>5000) { SSS=0.08; P_i=0.03; } else if(G_Inc<=5000) { SSS=0.05; P_i=0.02; } T_Ded=P_Health+SSS+P_i; Net_Inc=G_Inc-T_Ded; printf("\nEmployee Number:%d\n",Em_Num[a]); printf("Employment Status:%c\n",Em_Stat[a]); printf("Civil Status:%c\n",C_Stat[a]); printf("Hours Work:%d\n",Hours_W[a]); printf("Gross Income=%d",G_Inc); printf("Total Deduction=%d\n",T_Ded); printf("Net Income=%d\n",Net_Inc); } void Choice() { int Choice; char Answer; do { printf("----MENU----\n\n 1.ENTRY \n 2.SEARCH \n 3.UPDATE \n 4.DISPLAY \n 5.EXIT\n\n"); printf("Enter Choice: "); scanf("%d",&Choice); switch(Choice) { case 1: Entry_Array(); break; case 2: Search_Array(); break; case 3: Update_Array(); break; case 4: Display_Array(); break; case 5: printf("Do you want to Exit?"); break; default: printf("Invalid Input\n"); break; } printf("Do you wish to exit[y/n]:\n"); scanf("%s",&Answer); }while(Answer=='n'||Answer=='N'); } void main() { Choice(); }
-
Please help me with my mother who is suffering from luekemia. My moms birthday is on December 23 and I want buy her a cake and a present for my lovable mother. Please help me just donating a small amount of money in [Link removed]. I want also to buy her food, drink and also flowers to thank my mother. Sorry for asking a small donation because I don't have a money to surprise her and sorry also for my grammar because I'm a Pilipino. Thank you for all of the support and God Bless [Link removed]