Question

Program Set 2 (10 points) 1. Using the same information as in program set 1. This program will ask the user to how many salar

Hi, this is an intro to C Programming Class. Please do not use arrays, functions, math.h, or struct to store any data except to declare strings char strVar[20].

Furthermore, can you please do a good check to make sure the final program does not have any problems because when I copy and paste them the app I use says there are some problems and it won't run the program. So if you can double check to make sure that everything will run ok that will be greatly appreciated. When you provide the program answer, can you also please put the proper format using spaces and other required things, because my professor is really focused on the formatting and spacing of the program lines. Additionally, the question in PS1 states that the user can input salaries and keep going on until the user enters -1. Or the user enters -1 as the first value to quit the program. This will be a loop that uses a sentinel similar to the using -999 as a sentinel, instead a -1 is used. Moreover, we are not allowed to use 'break' for this homework as it was not taught in the lessons on loops. Please make sure to include five test runs at the end of the program using Thank you

Note: Please use the following format for the output and have the output of 5 test runs be exactly in the same format as shown above. Use the data provided above for test case run 1. Provide your own data for the rest of the 4 test runs using different numbers. One of your test runs should enter the salary of -1 as first value, your program should exit. thank you.

Important: Please use the same information as in the following program image provided below. No need to answer the program set 1 question for the image below just use the same data for program set 1 as mentioned in program set 2 Thank you.

USE ONLY THE TOOLS YOU HAVE BEEN TAUGHT IN CLASS ONLY, IF YOU USE ANYTHING WE HAVE NOT COVERED YET YOU WILL RECEIVE A ZERO FO

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//Thos is a C language code with the above mentioned Conditions with Screenshot attached at the end of the program


#include <stdio.h>

int main()
{
int i=0,s;
float sum_salary=0,sum_raise=0,sum_newsalary=0;
printf("How many number of salaries you want to enter?\n");
scanf("%d",&s);
while(i<s)
{
float salary,rate,raise,newsalary;
printf("Enter Salary :");
scanf("%f",&salary);
if(salary==-1)
{
if(sum_salary==0)
return 0;
else
{
printf("Total Salary :%f Total raise :%f Total New Salary: %f",sum_salary,sum_raise,sum_newsalary);
return 0;
}

}
else
{
if(salary>=0 &&salary<30000)
rate=7;
else if(salary>=30000 &&salary<=40000)
rate=5.5;
else if(salary>40000)
rate=4;
raise=rate*salary/100;
newsalary=salary+raise;
  
sum_salary=salary+sum_salary;
sum_raise=raise+sum_raise;
sum_newsalary=newsalary+sum_newsalary;
printf("Salary :%f rate :%f Raise :%f New Salary: %f\n",salary,rate,raise,newsalary);

}
i++;
if(i==s)
{
printf("Total Salary :%f Total raise :%f Total New Salary: %f",sum_salary,sum_raise,sum_newsalary);
return 0;
}
}
}

F Coding Blocks IDE Online C++ Compiler - online ed X C Chegg X Online C Compiler - online editor X + C onlinegdb.com/online_F Coding Blocks IDE Online C++ Compiler - online ed X C Chegg X Online C Compiler - online editor X + C onlinegdb.com/online_

Add a comment
Know the answer?
Add Answer to:
Hi, this is an intro to C Programming Class. Please do not use arrays, functions, math.h,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PLEASE READ AND CODE IN BASIC C++ CODE. ALSO, PLEASE CODE USING THIS DO WHILE LOOP...

    PLEASE READ AND CODE IN BASIC C++ CODE. ALSO, PLEASE CODE USING THIS DO WHILE LOOP AND FORMAT: #include <iostream> using namespace std; int main() { //variables here    do { // program here             }while (true);    } Objectives To learn to code, compile and run a program containing SELECTION structures Assignment Write an interactive C++.program to have a user input the length of three sides of a triangle. Allow the user to enter the sides...

  • Need help completing these three programs using Raptor. Any help is appreciated. What to Submit: Complete...

    Need help completing these three programs using Raptor. Any help is appreciated. What to Submit: Complete the following three programs in Raptor and submit the three .rap files Program 1 Budget Analysis (50 points): Design a program that asks user enter the amount he/she has budgeted for a month. And then use a loop to prompt the user enter each of his/her expenses for the month, and keep a running total. When the loop ends, the program should display budgeted...

  • Using C++ programming. This exercise will test your knowledge of passing structures to functions. Create a...

    Using C++ programming. This exercise will test your knowledge of passing structures to functions. Create a structure that stores information about various plumbers that you are getting repair estimates from. As you can see from the output, the structure must store the name, phone number, and estimate. Since you are only getting estimates from two companies, only two structure variables are needed. Functions: 1) Get data from the user. This function must be called TWICE. 2) Print the summary you...

  • I need help please... Intro to Programming in C – small program 8 Project objective: To...

    I need help please... Intro to Programming in C – small program 8 Project objective: To compile, build, and execute an interactive program using character arrays and string.h functions **Submit source code (prog8.c) through Canvas • One source code file (unformatted text) will be submitted • The file name must match the assignment • The code should be tested and run on a Microsoft compiler before it is uploaded onto Canvas • The code must be submitted on time in...

  • C++ Programming Programming Project Outcomes:  Understand and use C++ functions for procedural abstraction and Functional...

    C++ Programming Programming Project Outcomes:  Understand and use C++ functions for procedural abstraction and Functional Decomposition  Develop some functions for generating numerical data from numerical inputs  Understand and utilize file input and file output to perform computing tasks Requirements: 1. You should do a functional decomposition to identify the functions that you will use in the program. These should include reading and writing the files, tallying and showing statistics, etc. 2. The program should prompt the user...

  • In this program, you will be using C++ programming constructs, such as overloaded functions. Write a...

    In this program, you will be using C++ programming constructs, such as overloaded functions. Write a program that requests 3 integers from the user and displays the largest one entered. Your program will then request 3 characters from the user and display the largest character entered. If the user enters a non-alphabetic character, your program will display an error message. You must fill in the body of main() to prompt the user for input, and call the overloaded function showBiggest()...

  • Intro to Programming in C – Large Program 1 – Character/ Number converter Assignment Purpose: To...

    Intro to Programming in C – Large Program 1 – Character/ Number converter Assignment Purpose: To compile, build, and execute an interactive program with a simple loop, conditions, user defined functions and library functions from stdio.h and ctype.h. You will write a program that will convert characters to integers and integers to characters General Requirements • In your program you will change each letter entered by the user to both uppercase AND lowercase– o Use the function toupper in #include...

  • this is for java programming Please use comments Use the Account class created in homework 8_2...

    this is for java programming Please use comments Use the Account class created in homework 8_2 to simulate an ATM machine. Create ten checking accounts in an array with id 0, 1, …, 9, initial balance of $100, and annualInterestRate of 0. The system prompts the user to enter an id between 0 and 9, or 999 to exit the program. If the id is invalid (not an integer between 0 and 9), ask the user to enter a valid...

  • using C geany. Please Dr. exercise # 1 and 2 During the lab: PART I: PROGRAMMING...

    using C geany. Please Dr. exercise # 1 and 2 During the lab: PART I: PROGRAMMING EXERCISES a. Using Geany, write a C program that prompts and asks the user for two assignment marks (al and a2) and two test marks (ti and t2). All four variables are integer variables and are in % (out of 100). You program should display the four marks properly lalebed to check if the input has been successful. b. Next, calculate and display the...

  • Python Simple Programming Write a program in Python that calculates the tip and total for a...

    Python Simple Programming Write a program in Python that calculates the tip and total for a meal at a restaurant. When your program is run it should ... Calculate the tip and total for a meal for a restaurant Print the name of the application "Tip Calculator" Get input from the user for cost of meal and tip percent Print the tip and total amounts. The formula for calculating the tip amount is: tip = cost of meal * (tip...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT