Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Explanation of the program

[Explain (where applicable)

l  how the number of decimal point was set

 

l · function(s) that was taken from library & which library

 

l · the logical path of if/else, switch structure

 

l · choice of loop (why for loop or while loop)

Explanation of the program

[Explain (where applicable)

l · the declarations of the header file

 

l · choice of variable type

 

l · purpose of cout/cin statement in your program

 

l · how the alignment was done

Write and test the following computeTriangle() function that returns the area a and the

perimeter p of the triangle with given side lengths a, b, c:

void computeTriangle( float&, float&, float, float, float);


Implement a C++ function which, when given the length of a simple pendulum in meters,

returns the period of oscillation in seconds, i.e.


period of oscillation = 2 π (length / g)


where Standard Gravity, g = 9.80665 metres/sec2

Implement a main function which reads the pendulum length, calls the above function and

prints the result. A pendulum of length 1 meter has a period of 2.006409 seconds.


Implement a C++ function “reactance()” which evaluates the reactance of a series circuit

consisting of an inductor L and capacitor C at frequency f:


reactance = 2π fL - 1/2π fC


Implement a main function which reads the values of L, C and f, calls the above function

and prints the reactance, e.g. if L =0.2 henries, C =2 μ farads and f = 50 Hz the reactance

will be –1528.717 Ω.


Code a C++ function Min() that takes three double type arguments and that returns the

value of the smallest of the three arguments.


Code a C++ function Circle_Circum() that takes one double argument that represents the

radius of a circle. The function should return the circumference of the circle.


Construct function prototypes that match the following descriptions:

i) ab () takes no arguments and has no return value.

ii) start() takes an int argument and returns a float.

iii) mk() takes two type double arguments and returns a double.

iv) func6() returns an int and takes three arguments. The first and third arguments are of

type double. The second argument is of type int.

v) func4() returns a char and takes one argument that is also of type char.


Write a program that calculates GPA

Arrays in main function

1.  A two dimensional array Grades[Number_of_students][Number_of_subjects] that stores the grades (0 ~ 100) of 6 students for 4 subjects.

2.  A one dimensional array Credit_hours[Number_subjects]

3.  A two dimensional array Grade_points.

 Grade_points [Number_of_students][Number_of_subjects] that will stores the grade points of each subject for 6 students.

4.  A one dimensional array GPA[Number_of_students] that stores the GPA of each student

Write the following Functions

a.  A function Enter_Grades() that takes the two dimensional Grades array.

b.  A function Enter_credit_hours that takes the array Credit_hours.

c.  A function Display_grades

d.  A function Calculate_ Grade_points that takes two arrays Grades and Grade_points.

e.  A function Calculate_GPA that takes three arrays Credit_hours, GPA and

GPA=(GP1*CH1 + GP2*CH2 + GP3*CH3 + GP4*CH4)/(CH1 + CH2 + CH3 + CH4)


generate random integers in the range [ LOW = 1, HIGH = 10000 ] and to store them in a vector < int > of size VEC_SIZE = 250. Then, sort the contents of the vector (in ascending order) and display it on stdout. To sort the contents of a vector, use the sort ( ) function in the STL. In addition to the main ( ) routine, implement the following subroutines in your program: • void genRndNums ( vector < int >& v ) : This routine generates VEC_SIZE integers and puts them in vector v. Initializes the random number generator (RNG) by calling the function srand ( SEED ) with the seed value SEED = 1 and generates random integers by calling the function rand ( ). • void printVec ( const vector < int >& v ) : This routine displays the contents of vector v on stdout, printing exactly NO_ITEMS = 12 numbers on a single line, except perhaps the last line. The sorted numbers need to be properly aligned on the output. For each printed number, allocate ITEM_W = 5 spaces on stdout.


LATEST TUTORIALS
APPROVED BY CLIENTS