1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MaRussiya [10]
3 years ago
8

Write a C program to calculate salary raise for employees. If salary is between$ 0 < $ 30000 the rate is 7.0%If salary is bet

ween$ 30000 <= $ 40000 the rate is 5.5%If salary is greater than$ 40000 the rate is 4.0%1. Let the user enter salary. Allow the user to enter as many salaries as the user wishes until the user enters a negative salary to quit. User can also decides to quite immediately after starting the program. Pick the proper loop.2. Calculate the raise, new salary, total salary, total raise, and total new salary.3. Sample input and output (leftmost column is user input): Salary Rate Raise New Salary Salary: 25000 25000.00 7.00 1750.00 26750.00 Salary: 30000 30000.00 5.50 1650.00 31650.00 Salary: 35000 35000.00 5.50 1925.00 36925.00 Salary 40000 40000.00 5.50 2200.00 42200.00 Salary: -1 Total 42200.00 7525.00 137525.00 Process returned 0 (0x0) execution time: 55.237 s Press any key to continue.
Computers and Technology
1 answer:
solmaris [256]3 years ago
5 0

Answer:

Written in C

#include <stdio.h>

int main(){

   float salary,rate,raise,newsalary,totalsalary = 0.0 ,totalraise = 0.0 ,totalnewsalary = 0.0;

   printf("Enter negative input to quit\n");

   printf("Salary: ");

   scanf("%f", &salary);

   while(salary>=0){

   if(salary>=0 && salary <30000){

       rate = 0.07;

   }

   else if(salary>=30000 && salary <=40000){

       rate = 0.055;

   }

   else{

       rate = 0.04;

   }

   

   raise = rate * salary;

   newsalary = salary + raise;

   totalraise +=raise;

   totalsalary+=salary;

   totalnewsalary+=newsalary;

   printf("Salary: %.2f\n", salary);

   printf("Rate: %.2f\n", rate);

   printf("Raise: %.2f\n", raise);

   printf("New Salary: %.2f\n", newsalary);

   printf("Salary: ");

   scanf("%f", &salary);

   }

   printf("Total Salary: %.2f\n", totalsalary);

   printf("Total New Salary: %.2f\n", totalnewsalary);

   printf("Total Raise: %.2f\n", totalraise);  

   return 0;

}

Explanation:

The declares all necessary variables as float

   float salary,rate,raise,newsalary,totalsalary = 0.0 ,totalraise = 0.0 ,totalnewsalary = 0.0;

This tells the user how to quit the program

   printf("Enter negative input to quit\n");

This prompts user for salary

   printf("Salary: ");

This gets user input

   scanf("%f", &salary);

The following iteration is repeated until user enters a negative input

   while(salary>=0){

This following if conditions check for range of salary and gets the appropriate rate of salary raise

<em>    if(salary>=0 && salary <30000){</em>

<em>        rate = 0.07;</em>

<em>    }</em>

<em>    else if(salary>=30000 && salary <=40000){</em>

<em>        rate = 0.055;</em>

<em>    }</em>

<em>    else{</em>

<em>        rate = 0.04;</em>

<em>    }    </em>

This calculates the raise by multiplying the salary by the rate of increment

   raise = rate * salary;

This calculates the new salary

   newsalary = salary + raise;

This calculates the total raise

   totalraise +=raise;

This calculates the total salary

   totalsalary+=salary;

This calculates the total new salary

   totalnewsalary+=newsalary;

This prints the salary

   printf("Salary: %.2f\n", salary);

This prints the rate of increment

   printf("Rate: %.2f\n", rate);

This prints the raise in salary

   printf("Raise: %.2f\n", raise);

This prints the new salary

   printf("New Salary: %.2f\n", newsalary);

This prompts user for salary input

   printf("Salary: ");

This gets user input for salary

   scanf("%f", &salary);

   } The while loop ends here

This prints the total salary

   printf("Total Salary: %.2f\n", totalsalary);

This prints the total new salary

   printf("Total New Salary: %.2f\n", totalnewsalary);

This prints the total raise in salary

   printf("Total Raise: %.2f\n", totalraise);  

   return 0;

You might be interested in
On tool hackers use to get sensitive information from victims is/are:
Feliz [49]
Pretty sure it’s keyloggers because it’s the only one that makes sense to me but I’m not 100% sure on that one
5 0
3 years ago
Read 2 more answers
You are about to repair and change the resistor (small components),but the components are too small to solder and hold,what tool
exis [7]

Answer:

Needle-nose pliers

Explanation:

Required

Tool used to hold small components

The device to do this is the needle nose pliers.

This device has several functions, but it is specifically designed to hold small components in the computer when the computer is being repaired.

Among the other functions are:

  • Picking small and tiny screws
  • Cutting of wires
  • Hold wires against the side of the computer case
8 0
3 years ago
XML Schemas consist of:
Contact [7]
None of the above is correct

4 0
3 years ago
What is the primary reason that organizations change their structure through downsizing, outsourcing, and offshoring as a means
sp2606 [1]

Answer:

Operating core is the primary reason that organizations change their structure through downsizing, outsourcing, and offshoring as a means of improving their operating efficiency

Explanation:

  • At the bottom of the organization is the operating core.
  • These are the people that do the basic work of producing the products or delivering the services.
  • In the simplest organizations, the operators are largely self-sufficient, coordinating through mutual adjustment.
  • In those organizations, there is almost nothing but operating core.
8 0
4 years ago
Jason logged into a banking website. A few later, he found that money from his account had been transferred to another account w
NemiM [27]
I think it’s bank fraud or cybercrime idk
8 0
3 years ago
Other questions:
  • While creating your résumé, what should you do before making a final copy to fix any typos or errors?
    6·1 answer
  • A device that produces a permanent human-readable text of graphic document.
    15·1 answer
  • Teachers in most school districts are paid on a schedule that provides a salary based on their number of years of teaching exper
    10·1 answer
  • Which of the following typically have the highest auto insurance premiums?
    14·1 answer
  • What is the standard markup language of the world wide web?
    14·1 answer
  • A kerberos __________ is a set of managed nodes that share the same kerberos database.
    10·1 answer
  • What’s the difference between the logical and physical structure of a file? What are the advantages of not having an application
    15·1 answer
  • 4-One possible performance multiplication enhancement is to do a shift and add instead of an actual multiplication. Since 9 * 6,
    12·1 answer
  • I'm looking for the best free chat website to Answer computer and statistic question and answers
    10·2 answers
  • 1) Discuss when it is best to use indexes. ​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!