Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

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. 

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9904665
  • Price:- $60

Priced at Now at $60, Verified Solution

Have any Question?


Related Questions in Programming Language

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As