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]
2 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]2 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
Isabel is creating a wireframe. She has drawn a layout for the home page along with outlining the navigation elements. She now w
Juli2301 [7.4K]

Answer: Filler content

Explanation: I think what the question is getting at is using filler content. This includes filler images and sample text. Once the website is all set up, the filler content is replaced with the actual content.

3 0
3 years ago
Read 2 more answers
In a block-style business letter, the paragraphs are double-spaced and indented. <br> True or False
Sav [38]
I am pretty sure it is true
5 0
2 years ago
Read 2 more answers
Carlos, an algebra teacher, is creating a series of PowerPoint presentations to use during class lectures. After writing, format
yarga [219]

Answer:

see explanation

Explanation:

Carlos can make a copy of the old presentation that preserves all the formatting, and replace old content with new information.

5 0
3 years ago
A ___________ variable is declared outside all functions.
velikii [3]

Answer:

B. global

Explanation:

A global variable lives on even when a function returns.

7 0
3 years ago
Suppose a computer has 16-bit instructions. The instruction set consists of 32 different operations. All instructions have an op
Kazeer [188]

Answer:

2^7= 128

Explanation:

An instruction format characterizes the diverse part of a guidance. The fundamental segments of an instruction are opcode and operands. Here are the various terms identified with guidance design:  Instruction set size tells the absolute number of guidelines characterized in the processor.  Opcode size is the quantity of bits involved by the opcode which is determined by taking log of guidance set size.  Operand size is the quantity of bits involved by the operand.  Guidance size is determined as total of bits involved by opcode and operands.

6 0
3 years ago
Other questions:
  • Explain the relationship between society and the technologies of using Earth's resources?
    14·1 answer
  • How to find i with superposition method
    8·1 answer
  • Type the correct answer in the box spell all words correctly
    8·1 answer
  • Study and compare the tables and draw conclusions.
    13·1 answer
  • Enter a formula using a database function to calculate the total value in the Cost column for expenses that meet the criteria in
    12·1 answer
  • Which type of microphone uses two metal plates?
    7·1 answer
  • Write a method that computes the sum of the digits in an integer. Use the following method header: public static int sumDigits(l
    5·1 answer
  • What is a key function of a scrum master plato answer plz
    13·1 answer
  • How many dlcs in total were in each black ops game (including dlc weapons) answer for 25 whole points
    8·1 answer
  • The chain of _____ documents that the evidence was under strict control at all times and no unauthorized person was given the op
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!