State the purpose of the function

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

You may be asked to create a function to solve each of the tasks given below. For each task state the purpose of the function, what the function needs complete the task (input), what the function will send back to the function call (output), and the process (algorithm) needed to complete the task. Do not write any C++ code, but clearly specify what needs to be passed to the function, output will be sent back to the function call, and algorithm. Also state which parameters should be passed by value and which should be passed by reference.

1. Design a function that will calculate both the volume and surface area of a sphere given a radius (validated elsewhere in the program). Your function should not contain any input statements or any output statements. Both the volume and surface area should be sent back to the function call.

2. Design a function for the scenario given below. The function should not have any input statements in it.

You are working for a bottling company. Bottles are placed into different types of packaging. Six (6) bottles are put into a six-pack. Four (4) six-packs are combined to form a case. Thirty (30) cases are wrapped together to form a pallet for shipping. You are to create a function that will determine the number of pallets, cases, six-packs and single bottles are created from the total number of produced during a shift. The function should be designed to minimize the number of each packaging type and number of bottles not in a package. The algorithm should contain no more than 7 arithmetic operators. The number of each type of packaging should be sent back to the function call.

For example if 1559 bottles were produced during a shift that would correspond to 2 pallets, 4 cases, 3 six-packs, and 5 single bottles.

3. Design a function that will solve the quadratic formula for determining roots

-b±√(b2-4ac) /(2a)

The function should send back to the function call the two roots and if they are real or imaginary. If the quantity (b^2 - 4ac) is less than zero, the roots will be imaginary and you should use the absolute value of (b^2 - 4ac) to determine the root values.

4. Design function that will read a series of numbers from a file and send back to the function call the largest 3 values in the file.

Reference no: EM13859359

Questions Cloud

Define the systematic process of scientific inquiry : Define the systematic process of scientific inquiry and social research.
Fill up the tables : Fill up the tables and show ALL the steps required to solve each problem below. You must convert the entire IP address to binary.
Prepare an income tax return for the frosts for 2013 : Prepare an income tax return for the Frosts for 2013 - examine the bullets on requirements to add that may pertain to these paragraphs.
Assembly language program to find all prime numbers between : Write a 68000 assembly language program to find all prime numbers between 1 and a specified upper value, inclusive, using the Sieve of Erathosthenes. The specified upper value may be as low as 3 or as high as 1023. Proceed as follows
State the purpose of the function : You may be asked to create a function to solve each of the tasks given below. For each task state the purpose of the function, what the function needs complete the task (input), what the function will send back to the function call (output), and t..
What have you learned about taking exams in college from : What observations can you share about your performance on our midterm?
Function that evaluates a polynomial : 1. Given the following function that evaluates a polynomial whose coefficients are stored in an array: double evaluate(double[] coefficients, int n, double x) double result = coefficients[0]; double power = 1; for (inti = 1; i
Generic binary tree using java generics : In this project you will create a generic binary tree using Java Generics.
How you found the people and food phenomenon : Describe the themes you found in your field notes and give examples that demonstrate each theme

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a c function to find the norm of a matrix

Write a C function to find the norm of a matrix. The norm is defined as the square root of the sum of squares of all elements in the matrix. Write your own code please.

  Load in the household configuration file

The first thing the program is required to do is load in the household configuration file, with the following  filename: housecfg.dat

  Write a program to create 100 real random numbers

Write a program to create 100 real random numbers and store it into a 1-D array. Find the value 1413 from the stored data and print out the value 1413 and the index of the array to the screen

  Function that returns the height of a binary tree

Write a function called getHeight() that returns the height of a given binary tree - CptS 122 Write a function called countSmallerThan() that returns the number of nodes whose values are smaller than the supplied input paramter

  Write a for loop that adds the integers

Assume the int variables i , lo , hi , and result have been declared and that lo and hi have been initialized. Write a for loop that adds the integers between lo and hi (inclusive), and stores the result in result .

  Destroy sauron''s ring by throwing it into the volcano

In order to destroy Sauron's ring by throwing it into the volcano Mt. Doom in the heart of Mordor, the hobbits have traveled a long way from their home in the Shire.

  Describes the application of the s4 symmetry operation

(a) Using its x, y, and z coordinates, construct a 15 × 15 matrix that describes the application of the S4 symmetry operation to [PtCl4]^2-.(b) What is the character of this matrix?

  Write a program which has a base process which communicates

write a program which has a base process which communicates with child processes acting as bombers that it

  Add the correct code to fill the matrix array with the value

Use the file below code and add the correct code to fill the matr2 array with the values that make it the matrix transpose of matr1. There are many examples on the Internet that show how to do this in C++ and what it should look like when it is corre..

  Prepare an application that creates a quiz

Prepare an application that creates a quiz, which contains at least five questions about a hobby, popular music, astronomy, or any other personal interest.

  Write a statement to call the function

Write an if statement that will assign 7 to p if the variable q is outside the range 100 through 1000. (Use single spaces between operators, operands and statements)

  Two types of constructors

Explain what constructors do and when they are executed. Explain the two types of constructors. Provide an example class that includes both types of constructor functions and demonstrate how an object would be instantiated using both types of constru..

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