Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CMPSC121: Intro to Programming Techniques (Spring 2020) Homework 07 (20 points) Due Sunday, March 1 before 11:59pm Objectives After this homework assignment, students should be

image text in transcribed

CMPSC121: Intro to Programming Techniques (Spring 2020) Homework 07 (20 points) Due Sunday, March 1 before 11:59pm Objectives After this homework assignment, students should be able to Understand the usage and behavior of functions Design, define, and call functions Instructions Task 1 Write a program named prime.cpp that: Implements a function named isPrime() that returns a Boolean value to indicate whether or not an input number is prime (divides evenly into only itself and I) Return typerbool Parameters): int Calls the isPrime() function to generate a list of all prime numbers from 2 to 100 (inclusive) Task 2 The projectile motion of an object fired straight up into the air can be modeled using the equation below: d= a? +0,1 + de a is acceleration due to gravity (use 9.8 m/s^2) VO is initial speed in meters per second dis initial distance above ground in meters . tis time in seconds d is the height of the projectile above the ground in meters. Write a program named launcher.cpp that: Prompts the user for vand do Implements a function named computeDistance() that calculates the distance from ground Retum type: double (d) Parameter(s): double (v0), double (do), double(t) Calls the computeDistance () function to display the values for the motion of a projectile in 0.1 second intervals starting at lunch (t = 0) and until the projectile hits the ground Implements a function named maxDistance() that calculates the maximum height of the projectile Calls the maxDistance() function to determine and display the max height of the projectile Return type: double (d) Parameter(s): double (v0), double (d), double (t) Sample Output Task 1 Sample Output The prime numbers between 1 and 100 are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 Task 2 Sample Output Enter a starting speed in m/s: 10 Eater a starting height in meters: 0 Times Weight (m) 0.00 0.95 7/ADDITIONAL ROWS OMITTED FROM SAMPLE OUTPUT 1.31 0.4 PROJECTILE IMPACT APTER 2.0 SECONDS Max height was at 1.02 seconds with a height of 5.10 meters 0.1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Develop skills for building positive relationships.

Answered: 1 week ago

Question

Describe techniques for resolving conflicts.

Answered: 1 week ago

Question

Give feedback effectively and receive it appropriately.

Answered: 1 week ago