[solved] – Question 99401

Compute the acceleration of gravity for a given distance from the earth’s center, distCenter, assigning the result to accelGravity. The expression for the acceleration of gravity is: (G * M) / (d2), where G is the gravitational constant 6.673 x 10-11, M is the mass of the earth 5.98 x 1024 (in kg) and d is the distance in meters from the earth’s center (stored in variable distCenter).

Expert Answer


[solved] – Question 99402

The cost to ship a package is a flat fee of 75 cents plus 25 cents per pound.
1. Declare a const named CENTS_PER_POUND and initialize with 25.
2. Get the shipping weight from user input storing the weight into shipWeightPounds.
3. Using FLAT_FEE_CENTS and CENTS_PER_POUND constants, assign shipCostCents with the cost of shipping a package weighing shipWeightPounds.

Expert Answer


[solved] – Question 99403

Determine the distance between point (x1, y1) and point (x2, y2), and assign the result to pointsDistance. The calculation is using the distance formula.

Ex: For points (1.0, 2.0) and (1.0, 5.0), pointsDistance is 3.0.

Expert Answer


[solved] – Question 99404

Simple geometry can compute the height of an object from the object’s shadow length and shadow angle using the formula: tan(angleElevation) = treeHeight / shadowLength.
1. Using simple algebra, rearrange that equation to solve for treeHeight. (Note: Don’t forget tangent).
2. Complete the below code to compute treeHeight. For tangent, use the tan() function, described in the “math functions” link above.

Expert Answer


[solved] – Question 99405

A cashier distributes change using the maximum number of five dollar bills, followed by one dollar bills. For example, 19 yields 3 fives and 4 ones. Write a single statement that assigns the number of 1 dollar bills to variable numOnes, given amountToChange. Hint: Use the % operator.

Expert Answer


[solved] – Question 99406

#include <iostream>
using namespace std;

int main() {
int numKidsA;
int numKidsB;
int numKidsC;
int numFamilies;
double avgKids;

cin >> numKidsA;
cin >> numKidsB;
cin >> numKidsC;
cin >> numFamilies;

/* Your solution goes here */

cout << avgKids << endl;

return 0;
}

Compute the average kids per family. Note that the integers should be type cast to doubles.

Expert Answer


[solved] – Question 99407

Print a message telling a user to press the letterToQuit key numPresses times to quit. End with newline. Ex: If letterToQuit = ‘q’ and numPresses = 2, print:
Press the q key 2 times to quit.

Expert Answer


[solved] – Question 99408

Output all combinations of character variables a, b, and c. If a = ‘x’, b = ‘y’, and c = ‘z’, then the output is:
xyz xzy yxz yzx zxy zyx
Your code will be tested in three different programs, with a, b, c assigned with ‘x’, ‘y’, ‘z’, then with ‘#’, ‘$’, ‘%’, then with ‘1’, ‘2’, ‘3’.

Expert Answer


[solved] – Question 99409

Write a program that reads a person’s first and last names, separated by a space. Then the program outputs last name, comma, first name. End with newline.

Example output if the input is: Maya Jones
Jones, Maya

Expert Answer


[solved] – Question 9941

write a program,Suppose we are given an ordered list of titles. to add information about the new book, keeping an ordered list

Expert Answer