(General math)
a. A balance has the following weights: 100 lb, 50 lb, 10 lb, 5 lb, and 1 lb. The number of 100 lb and 50 lb weights required to weigh an object weighing WEIGHT pounds can be calculated by using the following C++ statements:
// Determine the number of 100 lb weightsw100 = int(WEIGHT/100)// Determine the number of 50 lb weightsw50 = int((WEIGHT - w100 * 100)/50)Using these statements as a starting point, write a C++ program that calculates the number of each type of weight needed to weigh a 789 lb object.
b. Without compiling or running your program, manually check the effect of each statement in the program and determine what’s stored in each variable as each statement is encountered.
c. After verifying that your algorithm works correctly, compile and run your program. Verify that the results your program produces are correct. After verifying that your program is working correctly, use it to determine the weights required to weigh a 626 lb object.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.