Write a program that simulates an airplane race

Assignment Help C/C++ Programming
Reference no: EM13186518

Write a program that simulates an airplane race. The program will display a table showing the speed in km/hour and distance in km traveled by two airplanes every second until one of them has gone 10 kilometers.

These are the requirements for the program:

  • The program will use a function that has the following parameters: time and acceleration.
  • The function will pass back two data items: speed and distance.
  • Us this formula to calculate speed: speed = time * acceleration;
    (Where speed is in kilometers per second, time is in seconds, and acceleration is in meters per second2.)
  • Use this formula for distance: distance = 0.5 * time * time * acceleration;
    (Where distance is in kilometers)
  • You don't need to ask for user input. You can just use constants for acceleration.(Use random values if you want to make the race more interesting.) The acceleration values should be between 5 and 25 meters per second2
  • Do not use any global variables.
  • Include a driver for testing the speed and distance function.

Hints:

  • Think about pass by value vs. pass by reference when deciding how to pass a data item back in a function parameter.
  • The speed calculated above is in km per second. In your table you need to display km per hour. The formula for conversion is: 1 km/h = 3600 * km/s.
  • The distance calculated above is in meters. You need to display kilometers. 1 km =1000 * m.

Example Output
Here is an example where airplane A's acceleration is 5 m/s2,and airplane B's acceleration is 10 m/s2:

Time Airplane A Airplane A Airplane B Airplane B
(seconds) Speed (km/h) Distance (km) Speed (km/h) Distance (km)
1 18 0.0025 36 0.005
2 36 0.01 72 0.02
3 54 0.0225 108 0.045
4 72 0.04 144 0.08
5 90 0.0625 180 0.125
6 108 0.09 216 0.18
7 126 0.1225 252 0.245
8 144 0.16 288 0.32
9 162 0.2025 324 0.405
10 180 0.25 360 0.5
11 198 0.3025 396 0.605
12 216 0.36 432 0.72
13 234 0.4225 468 0.845
14 252 0.49 504 0.98
15 270 0.5625 540 1.125
16 288 0.64 576 1.28
17 306 0.7225 612 1.445
18 324 0.81 648 1.62
19 342 0.9025 684 1.805
20 360 1 720 2

 

Reference no: EM13186518

Questions Cloud

Define an electron is confined to a linear region : An electron is confined to a linear region with a length of the same orderas the diameter of an atom (about 100 pm).
Implement your algorithm in python : Write an algorithm in structured English (pseudocode) that describes the steps required to perform the task specified and reinforce topic material related to the programming work cycle, and the input, processing, output program structure.
Explain a sample obtained from that mixture : A sample obtained from that mixture containing 443900 particles weighs 10.0g. Determine the number and percent relative standard deviation of NaCN particels from a sample of the mixture weighing 7.16g.
Explain calories of heat in the process : A piece of metal weighing 10.0g is raised in tempreture from 25 C to 76.5C. it is found that it absorbed 47.6 calories of heat in the process.
Write a program that simulates an airplane race : Program will use a function that has the following parameters: time and acceleration and function will pass back two data items: speed and distance.
State sodium hydroxyde in the purification of a solid : adding sodium hydroxyde in the purification of a solid by recrystallization experiment?
Why would drop in foreign confidence in us ability to repay : A Wall Street Journal article, "As Fear of Deficits Falls, Some See a Larger Threat," describes the following threat of a high U.S. budget deficit: [T]he investors who finance our deficits by buying Treasury bonds and bills, especially the foreign..
Compute the molarity of the solution : The [Br] of the resulting solution if 0.672 M. Assuming the volume is additive, calculate the molarity of the first solution?
How many tickets will be sold : N(x)=-0.4x^2+8.8x+14 where x is the number of days since a concert was announced; when will sales peak and how many tickets will be sold.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd