answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Delicious77 [7]
2 years ago
12

Suppose Dave drops a watermelon off a high bridge and lets it fall until it hits the water. If we neglect air resistance, then t

he distance d in meters fallen by the watermelon after t seconds is d = 0.5 * g * t 2 , where the acceleration of gravity g = 9.8 meters/second2 . Write a program that asks the user to input the number of seconds that the watermelon falls and the height h of the bridge above the water. The program should then calculate the distance fallen for each second from t = 0 until the value of t input by the user. If the total distance fallen is greater than the height of the bridge, then the program should tell the user that the distance fallen is not valid.
Computers and Technology
1 answer:
MaRussiya [10]2 years ago
5 0

Answer:

#include <bits/stdc++.h>

using namespace std;

// driver function

int main()

{

   // variables

  const double g = 9.8;

int sec;

double height;

int    t  = 0;    

double d = 0;    

bool   flag = false;  

// ask to enter time

cout << "Please enter the time of fall(in seconds):";

// read time

cin >> sec;

//ask to enter height

cout << "Please enter the height (in meters):";

//read height

cin >> height;

cout << '\n'

     << "Time(seconds)   Distance(meters)\n"

        "********************************\n";

// calculate height after each seconds

while ( t <= sec) {

cout << setw(23) << left << t

      << setw(24) << left << d << '\n';

// if input height is less

 if ( d > height ) {

  flag = true;

 }

// increament the time

 t += 1;

// find distance

 d = 0.5 * g * (t) * (t);

}

cout << '\n';

// if input height is less then print the Warning

if ( flag ) {

 cout << "Warning - Bad Data: The distance fallen exceeds the height"

         " of the bridge.\n";

}

return 0;

}

Explanation:

Read the time in seconds from user and assign it to "sec" then read height and  assign it to "height".After this find the distance after each second.If the input height is less than the distance at any second, it will print a Warning message. otherwise it will print the distance after each second.

Output:

Please enter the time of fall(in seconds):11                                                                              

Please enter the height (in meters):1111                                                                                  

                                                                                                                         

Time(seconds)   Distance(meters)                                                                                          

********************************                                                                                          

0                      0                                                                                                  

1                      4.9                                                                                                

2                      19.6                                                                                                

3                      44.1                                                                                                

4                      78.4                                                                                                

5                      122.5                                                                                              

6                      176.4                                                                                              

7                      240.1                                                                                              

8                      313.6                                                                                              

9                      396.9                                                                                              

10                     490                                                                                                

11                     592.9  

You might be interested in
You have implemented a network where hosts are assigned specific roles, such as for file sharing and printing. Other hosts acces
yulyashka [42]

<u>Client-server</u> implemented a network where hosts are assigned specific roles, such as for file sharing and printing. Other hosts access those resources but do not host services of their own.

<u>Explanation:</u>

The client-server can be utilized on the web just as on a neighborhood (LAN). Instances of customer server frameworks on the web incorporate internet browsers and web servers, FTP customers and servers, and the DNS. Different hosts get to those assets yet don't have administrations of their own. Since it permits arrange permits numerous PCs/gadgets to interface with each other and offer assets.

5 0
2 years ago
The groups_per_user function receives a dictionary, which contains group names with the list of users. Users can belong to multi
Akimi4 [234]

The groups_per_user function receives a dictionary, which contains group names with the list of users.

Explanation:

The blanks to return a dictionary with the users as keys and a list of their groups as values is shown below :

def groups_per_user(group_dictionary):

   user_groups = {}

   # Go through group_dictionary

   for group,users in group_dictionary.items():

       # Now go through the users in the group

       for user in users:

       # Now add the group to the the list of

         # groups for this user, creating the entry

         # in the dictionary if necessary

         user_groups[user] = user_groups.get(user,[]) + [group]

   return(user_groups)

print(groups_per_user({"local": ["admin", "userA"],

       "public":  ["admin", "userB"],

       "administrator": ["admin"] }))

3 0
2 years ago
Another solution to minimize resonance is to ________ the bridge.
lakkis [162]
I believe the answer is d
7 0
2 years ago
The c++ operator _______________ is used to destroy dynamic variables.
UNO [17]
<span>The c++ operator delete is used to destroy dynamic variables.</span>
6 0
2 years ago
To keep from overwriting existing fields with your Lookup you can use the ____________ clause.
Radda [10]
I believe the answer is <span>outputnew
</span>The main difference between the output new and the output is that outputnew won't overrite the alredy existing description field.
If you don't put this clause, <span>Splunk would adds all the field names and values to your events by through the lookup.</span>
3 0
2 years ago
Read 2 more answers
Other questions:
  • Under what category of programs and apps do databases and enterprise computing fall?
    8·1 answer
  • Which are examples of copyrighted online materials? Check all that apply.
    14·2 answers
  • 8. In time series, which of the following cannot be predicted? A) large increases in demand B) technological trends C) seasonal
    11·1 answer
  • The process of __________ encourages members to accept responsibility for the outcomes of a group and for changing the style in
    8·1 answer
  • If, instead, charge 3 is located to the left of charge 1 at a point (on the x axis) that satisfies the conditions given in the p
    7·1 answer
  • A spreadsheet keeps track of student scores on all the exams in a course. Each row of the spreadsheet corresponds to one student
    14·1 answer
  • In cell M2, enter a formula using a nested IF function as follows to determine first if a student has already been elected to of
    12·1 answer
  • Stan’s assignment is to print a three-dimensional image on a piece of paper. Which printing technique should he use?
    14·2 answers
  • In this image, which feature did we most likely use to quickly change the background, fonts, and layout?
    6·1 answer
  • there is a structure called employee that holds information like employee code, name, date of joining. Write a program to create
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!