Question

In: Computer Science

Objectives: Learn to analyze a computational problem and construct an algorithm to solve it Learn to...

Objectives:

  • Learn to analyze a computational problem and construct an algorithm to solve it

  • Learn to use sequential statements to build a basic program to implement the algorithm, using correct programming format

  • Learn to use the scanf function to read and store values entered on the keyboard by the user, and the printf function used to display output results on the computer monitor

  • Learn to convert math formulas into correct arithmetic expressions using variables, constants, and library math functions

  • Learn to construct a test plan and provide appropriate documentation

Description: This programming assignment requires you to compute the number of helium-filled balloons of a specified diameter required to lift a person with a specified weight off the ground.

Instructions:

  • Inputs: The required input values to be provided by the user are the weight of the person in pounds (a double), and the diameter of each balloon (an integer). Assume the balloon material is foil/mylar. Other values needed (a value for pi, for example) should be defined as constants.

  • Output: Display all input and computed values, including “explanatory text”. The final output value to be displayed is the number of balloons required (an integer).

  • Formulas: Show all formulas used for this problem, with explanations, units, and any helpful sketches. You will need the formula for computing the volume of each balloon (assume a perfectly spherical shape, ignoring the air valve), and some basic facts about helium:

o Volume of a sphere: v = 4/3πr3

o Facts about helium: Less dense than regular air, helium weighs 0.0114 lb/ft3 due to the force of gravity pulling down. The air pushes up with a force equal to the weight of the air the helium displaced, or 0.0807 pounds. The difference between the up and down forces is 0.069 pounds, and as a result, each cubic foot of helium can lift 0.069 pounds.

Identify values that would be valid vs. invalid for computing the number of balloons

(although you will not include testing of invalid values in this lab). Identify any known factors disregarded.

  • Algorithm: Document your algorithm, numbering the steps.

  • Example solution: Compute the solution by hand using your algorithm and example values. You may use the following example values for testing:

o 100 lbs for the weight of the person

o ? in. balloon (class suggests)

  • Testing: Document your test plan. After you construct your program, test it using the same example values as used in the example solution and include screenshots of the output in your report.

Scoring: Your grade for this assignment will be determined by five criteria:

  1. Do your programs compile and run, producing the correct results according to the instructions?

  2. Do your programs demonstrate good programming practices, such as well-documented code with comments, effective use of white space, proper indentation, appropriate variable names, etc.?

  3. Have you tested your programs as instructed and included screenshots of output results?

  4. Have you submitted a completed Lab Report?

  5. Are you submitting your assignment on time?

Solutions

Expert Solution

Algorithm

Step 1: Start

Step 2 : Input the Values Weight and Diameter.

Step 3 : r= diameter/2

Step 4 : V= 4/3*3.14* (r ^ 3)

Step 5 : A= 0.069

Step 6 : total = V+A

Step 7 : NumberOfBellons= Weight/total

Step 8 : Output NumberOfBellons

Step 9 : Stop.

Programe :

# include <Stdio.h>
# include <math.h>
int main()
{
        double w,v,tot;
        int d,n,r;
        printf("\n Enter The Persion Wight : ");
        scanf("%lf",&w);
        printf("\n Enter Diameter of each baloon : ");
        scanf("%d",&d);
        r= d/2 ;
        v=4/3*3.14*(pow(r,3));          //Volume of a sphere//
        tot= v + 0.069;                         
        n= w/tot ;
        printf("\n %0.2lf Weight of a persion ",w);
        printf("\n %d diameter of baloon",d);
        printf("\n No of beloon is : %d",n);
        return 0;
}

Output:

Case 1

Enter The Persion Wight : 100

Enter Diameter of each baloon : 3

100.00 Weight of a persion
3 diameter of baloon
No of beloon is : 31

Case 2

Enter The Persion Wight : 112.36

Enter Diameter of each baloon : 3

112.36 Weight of a persion
3 diameter of baloon
No of beloon is : 35

Case 3

Enter The Persion Wight : 134.35

Enter Diameter of each baloon : 4

134.35 Weight of a persion
4 diameter of baloon
No of beloon is : 5


Related Solutions

Using Java implement a searching algorithm to solve the following problem (please specify the searching algorithm...
Using Java implement a searching algorithm to solve the following problem (please specify the searching algorithm being used) Requirements Choose one problem with an algorithm and implement it. You should show and explain the result whatever you got. I recommend using N-Queen problem (at least N=8 or more) or any simple perfect games. For example, - N-Queen problem with hill climbing - N-Queen problem with simulated annealing - N-Queen problem with genetic algorithm - Tic-Tac-Toe with Minimax
Part1: 1.An algorithm is . a) a series of actions that solve a particular problem. b)...
Part1: 1.An algorithm is . a) a series of actions that solve a particular problem. b) an english description of a problem to be solved. c) the process of converting between data types. d) None of the above. 2. Program control is best defined as . a) the degree of control a program has over the computer on which it is executed. b) the line of code that is executing at a given time. c) the order in which a...
Description Construct a personal retirement problem and solve it. The purpose of this exercise is to...
Description Construct a personal retirement problem and solve it. The purpose of this exercise is to use the chapter’s concepts of future values, annuities, and compounding to your personal financial planning. Instructions ◦Determine the amount of investment funds you currently have available in all personal investments and self-directed and vested retirement accounts ◦Then, determine how much you will be adding to your investments a year in the future ◦Next, decide at what age you plan to retire. Determine what annual...
Explain: Analysis of algorithms with the example. Explain with example: How computational time of an algorithm...
Explain: Analysis of algorithms with the example. Explain with example: How computational time of an algorithm depends on input size? Write an algorithm (using whatever method you prefer) that takes an input of 10 integers, sorts the integers in ascending order and out puts the sorted list. In relation to computational time of your algorithm for part 4, what arrangement of the input numbers will cause the best case computational time? What arrangement will cause the worst case time?
Objectives: use Scite Use recursion to solve a problem Create classes to model objects Problem :...
Objectives: use Scite Use recursion to solve a problem Create classes to model objects Problem : The Rectangle class (Filename: TestRectangle.java) Design a class named Rectangle to represent a rectangle. The class contains: Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height. A no-arg constructor that creates a default rectangle. A constructor that creates a rectangle with the specified width and height....
Because I'm trying to learn how to solve this kind of problem in the future please...
Because I'm trying to learn how to solve this kind of problem in the future please show all intermediate steps so I can follow Suppose F= <xy+y, x-y^2> Let R be the triangular regiorn bounded by the curves y=x, y=4-x, and y=0, Let C be the boundary of this region, oriented counterclock wise. a) Can you use Fundamental theorem for Line integrals to find ∮ F•dr? explain why or why not? What are the other two possible methods of finding...
How much time does an algorithm take to solve a problem of size n if this...
How much time does an algorithm take to solve a problem of size n if this algorithm uses 2n2 + 2n operations, each requiring 10-8 seconds, with these values of n? a) 10: b) 20: c) 50: d) 100
a) According to Hayek, what is the problem we try to solve “to construct a rational...
a) According to Hayek, what is the problem we try to solve “to construct a rational economic order”? b) What does Hayek mean by the knowledge problem? c) What is the role prices in the market process?
Solve this problem The engineering calculation on the telecommunication project is needed to analyze the feasibility...
Solve this problem The engineering calculation on the telecommunication project is needed to analyze the feasibility of the project and the total value of investments. As the Project Manager, you have to do the financial analysis of your telecommunication project to get the conclusion of whether this feasible to run the project or not. You have to prove your analysis by giving the project calculation in terms of Net Present Value (NPV), Present Worth Analysis, and Break-Even Point (BEP) based...
5. Design a dynamic programming algorithm to solve the following problem. Input: An array A[1, ....
5. Design a dynamic programming algorithm to solve the following problem. Input: An array A[1, . . . , n] of positive integers, an integer K. Decide: Are there integers in A such that their sum is K. (Return T RUE or F ALSE) Example: The answer is TRUE for the array A = [1, 2, 3] and 5, since 2 + 3 = 5. The answer is FALSE for A = [2, 3, 4] and 8. Note that you...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT