Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

c0c0pIe

6. Suppose a company decides to raise the salaries of its employees according to the following table: employee_status years_of_service percent_raise Full-time Less than 5 years 4.0 Full-time 5 years or more 5.0 Part-time Less than 5 years 2.5 Part-time 5 years or more 3.0 If employee_status value is ‘F’, the employee is Full-time; if it is ‘P’, he or she is a part-timer. Write this program that computes the new salary of an employee given his or her employee_status, year_of_service and salary by the users. Input validation: Do not accept a negative value for the number of years_of_service,

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. c0c0pIe
    Best Response
    You've already chosen the best response.
    Medals 0

    help me to with this programming..its about selection =D

    • 2 years ago
  2. shankvee\
    Best Response
    You've already chosen the best response.
    Medals 0

    Do you know how to use if else and all?

    • 2 years ago
  3. c0c0pIe
    Best Response
    You've already chosen the best response.
    Medals 0

    yeah..i know...i hve do it..but cant get the answer =( #include<stdio.h> int main () { int year; char status; float salary, new_salary; printf ("Please type F (Full-Time) or P (Part-timer): "); scanf ("%c", &status); printf ("\nEnter your year of service: "); scanf ("%d",&year); printf ("\nPlease enter our current salary: RM"); scanf ("%.2f",&salary); if (status =='F'&& year<5){ new_salary = 4.0 / 100 * salary + salary; } else if (status =='F'&& year>=5){ new_salary = 5.0 / 100 * salary + salary; } else if (status =='P'&& year<5) {new_salary = 2.5 / 100 * salary + salary; } else if (status ='P'&& year>=5) {new_salary = 3.0 / 100 * salary + salary; } printf ("Your new salary is : %.2f", new_salary); return 0; }

    • 2 years ago
  4. shankvee\
    Best Response
    You've already chosen the best response.
    Medals 0

    Ah i see your problem make that 5/100as 0.05 and 4/100 as 0.04 and so on.

    • 2 years ago
  5. shankvee\
    Best Response
    You've already chosen the best response.
    Medals 0

    This is because if the computer divides 5/100 it gives 0 as both numerator and denominator are integer type. If you make it 0.05 which is a float type it upgrades all other variables to the float type...

    • 2 years ago
  6. c0c0pIe
    Best Response
    You've already chosen the best response.
    Medals 0

    i have change it to 0.03 *salary + salary, but still i cant get the answer =(

    • 2 years ago
  7. shankvee\
    Best Response
    You've already chosen the best response.
    Medals 0

    hmm i can't see any other problem with the code... maybe there's something in c i don't know c i know only c++

    • 2 years ago
  8. c0c0pIe
    Best Response
    You've already chosen the best response.
    Medals 0

    hurm...do c++ have large difference with c??

    • 2 years ago
  9. Vibhor16
    Best Response
    You've already chosen the best response.
    Medals 1

    no but it is more easy to learn C++.I am learning C and whenever I get a problem I write the program in C++ and then convert the syntax into C.

    • 2 years ago
  10. Vibhor16
    Best Response
    You've already chosen the best response.
    Medals 1

    I'll just try. But by the way what selection are you talking about?

    • 2 years ago
  11. Vibhor16
    Best Response
    You've already chosen the best response.
    Medals 1

    /******************************************************************************* Suppose a company decides to raise the salaries of its employees according to the following table: employee_status years_of_service percent_raise Full-time Less than 5 years 4.0 Full-time 5 years or more 5.0 Part-time Less than 5 years 2.5 Part-time 5 years or more 3.0 If employee_status value is ‘F’, the employee is Full-time; if it is ‘P’, he or she is a part-timer. Write this program that computes the new salary of an employee given his or her employee_status, year_of_service and salary by the users. Input validation: Do not accept a negative value for the number of years_of_service, *************************************************************************/ #include<stdio.h> #include<conio.h> /*For better view*/ #include<stdlib.h> /*For exit function*/ int main() { char time=0; int yrs=0; float sal=0,nsal=0; printf("Welcome,do tou work full time(f) or part time(p): "); scanf("%ch",&time); printf("For how many years have you been working here?: "); scanf("%d",&yrs); printf("What you they pay you?(per month): RM"); scanf("%f",&sal); /*Nested if for new salary*/ if(time=='f'&&yrs>5) { nsal=sal*0.05; nsal+=sal; } else if(time=='f'&&yrs<=5) { nsal=sal*0.04; nsal+=sal; } else if(time=='p'&&yrs>5) { nsal=sal*0.03; nsal+=sal; } else if(time=='p'&&yrs<=5) { nsal=sal*0.025; nsal+=sal; } else { printf("Something went wrong!!!Please check your output."); /*If input is no a number*/ exit(0); } printf("Your new salary is:RM %f",nsal); /*Change %f to %d if want an output in round figure*/ getch(); return 0; }

    • 2 years ago
  12. c0c0pIe
    Best Response
    You've already chosen the best response.
    Medals 0

    thanks a lot..i'll learn C++ after C programming =D

    • 2 years ago
  13. llib_xoc
    Best Response
    You've already chosen the best response.
    Medals 0

    We could advise you better if you showed us the answer that you *do* get...

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.