1answer.
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]
3 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]3 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
What is the condition for setting an alarm clock
stich3 [128]

Answer:

The time in which the alarm clock will sound

Explanation: Hope this helped please give me brainliest

6 0
3 years ago
These operating systems were referred to as command-based.
alexira [117]

Command-Line Interface (CLI)


3 0
3 years ago
can you guys plz answeer this i need help rrly bad and plz no viruses or links or answers that have nun to do with this
leva [86]

Answer:

You literally posted a download it’s too risky.

Explanation:

5 0
2 years ago
A person who uses computers to gain unauthorized access to data.
Anastaziya [24]

Answer:

Hacker

Explanation:

They break password codes to get access to unauthorized data.

6 0
3 years ago
Read 2 more answers
After establishing a long term goal and understanding what it entails, the best next step is to
Brums [2.3K]
Take notes and make a list of steps
8 0
3 years ago
Other questions:
  • The default primary key for an access database is the id field true or falser
    7·1 answer
  • Maya enjoys connectedWith her friends and social media apps but one of her friends post a lot of stuff that my thinks it’s annoy
    14·1 answer
  • Lean production systems are sometimes referred to as pull systems because demand from customers activates the production actions
    5·1 answer
  • Can some one help me on 4&amp;5
    6·1 answer
  • Create and configure databases in oracle database management system operation administration
    6·1 answer
  • How ssd is better than normal sata and pata HDD​
    11·1 answer
  • If an electric circuit has 30ohms and 10amps. How many volts the battery voltmeter should read?
    10·1 answer
  • In a mobile phone network, how many times as strong would
    6·1 answer
  • Practising some questions for board exams for class 12 python,pls help with detailed answer
    14·1 answer
  • What electronic devices do you use more frequently? And how much time do you use them?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!