Develop a C program to input each salesperson gross sales

Assignment Help C/C++ Programming
Reference no: EM131666831

Homework -

Q1. (Debugging) - No partial credit if you couldn't fix all errors.

Fix the errors in the attached C code. The indentation indicates the desired behavior for the if statement.

Q2. (Formatting)

Write, compile and run the following code in repl.it. You may see different values for (3/2) using different data types and different conversion specifier while we expect to see (3/2=1.5). Simply justify each output seen using a comment for each output in your code. For some cases different compiler, might show different values. You don't need to explain the exact values. Just explain the reason as best as you can.

Q3. (Sales-Commission Calculator)

One large chemical company pays its salespeople on a commission basis. The salespeople each receive $250 per week plus 10 percent of their gross sales for that week. For example, a salesperson who sells $5000 worth of chemicals in a week receives $250 plus 10 percent of $5000 (=$500), or a total of ($500+$250=$750).

Develop a C program to input each salesperson's gross sales for last week and calculates and displays that salesperson's earnings. Process one salesperson's figures at a time. The output should be similar the followings:

 Enter your sales in dollars: 5000.00

Your Salary is: 750.00

Q4. if...else and switch statements

In the attached link, you will see the example used in the class for explaining the switch statement. Instead of using switch, try to rewrite the program using if or if...else statements.

Q5. Converting a flowchart to a program

Write a program in c asking user to input two integers (n and m) and print a message according the following flowchart.

1687_figure.png

Q6. Average

Write a code in C to calculate the average (AVG) of the integers entered by a user.

  • ask the user to enter the values.
  • to show the end of data entry use -1.
  • Print the average like the following example: (suppose the user has entered 2, 3, 4) The average value is 3.00.
  • Use the following formula for calculating average of n integers x1, x2,...,xn. AVG = (x1 + x2+...+xn)/n
  • The default is the user enters just positive integer numbers. (-1 is sentinel value.)

Q7. Perfect square

In mathematics, a square number, sometimes also called a perfect square, is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, 9 is a square number, since it can be written as 3×3. (Text from Wikipedia)

Write a program to check if the input number (less than 1000) is the summation of two perfect square or not. For example 25 is 16+9 that both numbers 16 and 9 are perfect square. The output should be such as the following examples:

If input is 3 → the message should be: 3 is not a summation of two perfect square.

If input is 25: → the message should be: 25 is the summation of two perfect square, because 25 = SQ (3) + SQ (4).

Q8. Cruise ship cost

A cruise ship offers the following packages for 5 day / 4 night Cruise & Stay.

Package                         Rate

1. Room only                  $1000.00

2. Room plus Meals         $1000.00 + $200.00 for each person sharing the room (Maximum 3)

Discount Details (just for package 2):

-$50.00: if just one of the occupant is 17 or under

-$80.00: if at least two of the occupants are 17 or under

Write a program to ask the user the following information:

  • The package type (R: Room only and M: Room plus Meals)
  • Number of persons who share a room and their ages.

You may assume that the user input for all the numerical data is entered as integers and greater than zero. Based on this information the program should calculate and display the package cost as below:

Q9. Equivalent resistance for Series and Parallel Resistors

The following formulas are used for calculating the "equivalent resistance" in electric circuits.

In Series resistances: Req = R1 + R2 + R3 + ?

In Parallel resistances: Req = 1/(1/R1 + 1/R2 + 1/R3 + ? )

To calculate the total current (????????????) in a combinational circuit like the following figure, it is enough to use the following formula.

Itotal = V/Req, where V is source voltage.

Write a code in C programming

Asking two questions:

1. The type of resistors model (p for parallel and s for series)

2. The values of the resistors are in "ohm".

After the last resistor was entered, the user should enter "-1" to exit.

Note: there is no negative value resistor and a "0-ohm" resistor in parallel systems cause a short circuit; the equivalent resistor will be 0 and the total current will be infinity.(For series system if all of resistors are zero, a short circuit will be occurred.)

The voltage supply is a fixed value 24 volts.

Calculate the equivalent resistance and report it.

Calculate the total current and report it.

If user entered a negative value for a resistor, the program should show a message and ask the user to make it correct.

All of the elements are considered ideal.

Q10. Calculate the acceleration of a system

An Atwood Machine is a basic physics laboratory device often used to demonstrate basic principles of dynamics and acceleration. The machine typically involves a pulley, a string, and a system of masses. Keys to solving Atwood Machine problems are recognizing that the force transmitted by a string or rope, known as tension, is constant throughout the string, and choosing a consistent direction as positive. To calculate the acceleration of two masses the following formula is used.

2061_fiogure1.png

Write a code in C

Asking masses m1 and m2. (unit should be in kg)

g = 10 m/s2

Calculate the acceleration a (should be positive) and direction (m1: down or m1:up)

Show the results as below:

  • Mass m1 goes .............. down/up................ with acceleration ............ a ............... (Meter per second squared)
  • m1 and m2 are equal and they are balanced.

Attachment:- Assignment File.rar

Reference no: EM131666831

Questions Cloud

Some of the major concerns involving disciplinary issues : Discuss some of the major concerns involving disciplinary issues for special education teachers.
Compare theperformance with the huffman coding program : How large do the files have to be to make compression worthwhile? Compare their performance with the Huffman coding program (Hzip) provided in the online source
The disciplinary regulations came with the reauthorization : Major changes to the disciplinary regulations came with the reauthorization of IDEA in 2004. Discuss what the changes were.
What did company do in their efforts to gain your interest : What did the company do in their efforts to gain your interest? Was their recruitment tactic effective in your opinion or not?
Develop a C program to input each salesperson gross sales : COP3223C - Homework. Develop a C program to input each salesperson's gross sales for last week and calculates and displays that salesperson's earnings
Discuss a particular topic : Which type of research technique gathers 8 to 12 similar individuals (e.g., working mothers) brought together to discuss a particular topic?
Distribution of punctuation characters and digits : Show the Huffman tree that results from the following distribution of punctuation characters and digits: colon (100), space (605), newline (100), comma (705).
Can lsd result in drug dependence : Describe three major features of PCP intoxication that are significantly different from the effects of other hallucinogens.
The way a business structures its teams impact the amount : How can the way a business structures its teams impact the amount and type of conflict?

Reviews

len1666831

10/3/2017 1:13:55 AM

On the top of each C program add a comment that includes your name, homework number and Question number or any general explanation about the homework. Add enough comments in your program to make it easier to understand. (no comment: -2 points, not enough comment: -1 (for each question) ) Programs should be indented to clearly show the control structures. The codes should be written in https://repl.it and by pressing “share link” you will be able to copy the link and send back your solutions for grading. Submit one document including all of the links.

len1666831

10/3/2017 1:13:47 AM

Grading Policy: Compilation error: partial credit (maximum 25% of the credit) based on the number of errors and the code, NO error, but Partially-completed: partial credit, NO error, but incorrect answer: partial credit, Comments: no comment: -2 points, not enough comment: -1 (for each question). Indentation: no/ incorrect Indentation (-1 points). Total Grade: 85 points and Maximum grade: 95 points.

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd