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
The objectivity of a site relates to its a. Appearance c. Graphics b. Biases d. Quotes from other Internet authors Please select
FromTheMoon [43]

The objectivity of any site is related to the biases present in the content of the site because it creates an imbalance of information and it is unfair.

<h3>What is the objectivity of a site?</h3>

The content in a site represents the thoughts of a specific author. Objectivity comes to the role when there is an imbalance in the data or information available on the site.

The information available on the site represents the opinion that helps readers to understand or decide on anything. When the information is fair completely balanced then it becomes fair for the users to refer to that content. But when the data is biased or unbalanced then it becomes a problem.

Therefore, the objectivity of any site is related to the biases present in the content of the site because it creates an imbalance of information and it is unfair.

Learn more about objectivity of a site here:

brainly.com/question/2018782

5 0
2 years ago
what must you consider when determining the efficiency of an algorithm? select two choices. group of answer choices the amount o
ozzi

If an algorithm's resource consumption, often referred to as computational cost, is at or below a certain threshold, it is said to be efficient. Generally speaking, "acceptable" indicates that it will operate on a machine that is available in a fair amount of time or space, usually based on the size of the input.

<h3>Explain about the efficiency of an algorithm?</h3>

Growth requires an understanding of an algorithm's effectiveness. Programmers write code with the future in mind, and efficiency is essential to achieve this. Reducing the number of iterations required to finish your task in relation to the size of the dataset is the goal of efficient algorithm development.

The use of asymptotic analysis can frequently help to solve these issues. As the size of the input increases, asymptotic analysis quantifies an algorithm's effectiveness or the program that implements it.

To express how time-consuming a function is, we use a method called "Big O notation." We use the Big O notation, a language, to describe how time-consuming an algorithm is. It's how we assess the value of several approaches to an issue, and U supports our decision-making.

To learn more about efficiency of an algorithm refer to:

brainly.com/question/13801939

#SPJ4

4 0
1 year ago
Unit testing: Select one:
ser-zykov [4K]

Answer:

e. tests each program separately.

Explanation:

Unit testing -

It is one of the software testing where the individual units are tested , is referred to as unit testing.

The focus of this step is to scan each and every unit separately and thoroughly so as to avoid any type of damage or malfunctioning .

Hence, from the question, the correct statement for unit testing is e. tests each program separately.

5 0
3 years ago
Before making a dish, we want to check whether we already have the necessary ingredients in our pantry or whether we need to go
Leona [35]

Answer:

class Pantry(AD):

              def __init__(self, ingredients):

""" We initialize the Pantry class by passing the ingredients that were passed in to the initializer for the superclass AD"""

              super().__init__(ingredients)

              def needed_ingredients(self, recipes):

""" Given a list of recipes, computes which ingredients to buy, and in which quantity to be able to make all recipes. Can be implemented in 10 lines of code."""

              # define the object new_pantry to contain the ingredients needed

               new_pantry = Pantry({})

                ingredients_present = self

                # loop over the recipes in the list

                for recipe in recipes:

                        # convert ingredients of recipe from AD to Pantry

                        ingredients = Pantry(recipe.ingredients)

                        # subtract the recipe's ingredients from ingredients_present

                          ingredients_present = ingredients_present - ingredients

                        # loop over the ingredients_present for key in ingredients_present:

                       # if any ingredients's quantity < 0, add it to new_pantry

                                                           if ingredients_present[key] < 0:

# check if ingredient is present in new_pantry, add the quantity to existing quantity

                                                               if key in new_pantry:

                                            new_pantry[key] += -1*(ingredients_present[key])

else: # if ingredient is not present in new_pantry, make a new entry for the ingredient

                                               new_pantry[key] = -1*(ingredients_present[key])

ingredients_present[key] = 0      # set the quantity of the ingredient in ingredients_present to 0

Explanation:

I believe everything else is provided in the question.

Copy all the details you were provided in the question as it is and add the needed_ingredients in the Pantry class.

If you are getting any assertion error, Update the code to set the negative quantities in ingredients_present to 0

6 0
3 years ago
Zahra wants to create a table for her clients’ phone numbers from a template. She clicks on the Create tab, and under the templa
Y_Kistochka [10]

Answer:

Zahra needs to select Contacts.

Explanation:

Zahra has already chosen application parts as a template category. And from the QuickStart table, it looks quite clear that Contacts is at the same level in software as issues, Tasks, and Users. And She needs to add all clients' contacts. Hence, she only needs to select the Contacts, and further, she needs to list all the clients' names and contact numbers which will definitely be shown as columns of the table which Contacts will create.

8 0
3 years ago
Other questions:
  • What are sums of money that are given out for specific reasons?
    5·2 answers
  • The first thing you must consider in any type of communication is ______.
    9·2 answers
  • "3. 4. Simple number search We will pass you 2 inputs an list of numbers a number, N, to look for Your job is to loop through th
    5·1 answer
  • What is obtained after processing data?​
    8·1 answer
  • Before you give your presentation to an audience, you should make sure that your ideas are organized in a clear and meaningful w
    8·2 answers
  • Which option will you use to expose your presentation to the audience
    11·2 answers
  • Universal Containers requires that all users add at least one Product Option from the Maintenance Feature to a bundle.
    5·1 answer
  • ______ communication channels develop outside the organizational structure and do not follow the chain of command.
    8·2 answers
  • (20points)
    6·1 answer
  • Write down the stages in the information prcessing cycle in correct order​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!