Write a program that simulates an airplane race

Assignment Help Programming Languages
Reference no: EM13325365

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


Grading Criteria
This how you will be graded:
1. Write the prototype for the function.
2. Write the definition for the function.
3. Write a simple driver that tests the function with a time of 5 seconds.
4. Formatting and correct values in the table. 

Reference no: EM13325365

Questions Cloud

Explain why electric field must be zero at center of ring : A ring of radius R has uniform charge per unit lenght ? C/m (?>0), and z is the dince along its axis. Explain why the electric field must be zero at the center of the ring
What is the major difference between a tariff and a quota : What is the major difference between a tariff and a quota? If you were the government, which one would you do when looking at imports?
What is the cost of investing in a human capital : What is the opportunity cost of investing in capital? Do you think a country can "over invest" in capital?
What is the probability that the student gets exactly : And the rest of the people were from River City. Out of the sample, 19 people had some form of cancer. Thirteen of these people were from Laketown
Write a program that simulates an airplane race : 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.
Analyze the broad range of talent management efforts : Describe and analyze the broad range of talent management efforts that use software applications to help you Director to make an educated decision.
What is the average acceleration of the elephant : an elephant can runat a steady speed of 10m/sec and can stop in 2.5 sec what is the average acceleration of the elephant while stopping
What is the magnitude of the coins displacement : A small coin, initially at rest, begins falling. If the clock starts when the coin begins to fall, what is the magnitude of the coin\'s displacement
Find direction of the boats velocity relative to the ground : A 110-m-wide river flows due east at a uniform speed of 1.5 m/s. A boat with a speed of 8.5 m/s relative to the water leaves the south bank pointed in a direction 39o west of north. find the direction of the boat's velocity relative to the ground

Reviews

Write a Review

Programming Languages Questions & Answers

  Reservations system to be horizontal or vertical application

Top Sail Realty Situation: Top Sail Realty is one of the largest time-sharing and rental brokers for vacation cottages. Do you consider the reservations system to be a horizontal or a vertical application? Give reasons for your answer.

  Assembly language instructions into machine code

The assembly instructions are stored in a file. Each line of the file stores exactly oneinstruction. The name of the file should be provided to the program as a command line argument.

  Create class for hardware store to represent invoice

Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four pieces of information as instance variables a part number.

  Program to accept each worker-s first and last names

A program which continuouly accepts each worker's first and last names, this year's number of units produced, and last year's number of units produced. Show each employee with a message.

  Create a model using the entities movie

Create a model to represent this report using the entities MOVIE, THEATER, and SHOW_TIME. Assume that theaters may show multiple movies.

  Program a robot to run mile-long steeplechase

Program a robot to run mile-long steeplechase where steeples are made from beepers instead of wall segmesnts. the robot must jumb the steeples in this race by picking the beepers that make up the steeples.

  Write program to calculate student-s quiz average

Write a program that will calculate a student's quiz average. The program should prompt the user for the number of quizzes and then ask the user for each quiz grade.

  Program to multiply two integers

What occurs when you multiply two integers whose product is larger than largest int value? Try out example and report your findings.

  Program to compute percentage and final grade for students

Write a program which will permit teacher to compute percentage and final grade for students in a class.

  Explain programming is designed to demonstrate the areas

This programming lab is designed to demonstrate the following areas of knowledge within C++, The difficult part is intended to be the decision-making required to both parse the file input and to correctly draw the resulting vector.

  Use one-dimensional array to read in twenty numbers

Use the one-dimensional array to solve problem: Read in 20 numbers, each of which is between 10 and 100. As each number is read, print it only if it is not duplicate of number which has already been read.

  Write specifications for method of pre- and post-conditions

Write down specifications for method which advances any given date by one day. Write down statement of purpose, pre- and post-conditions, and description of parameters.

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