Write a program that simulates an airplane race the program

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

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: EM13379953

Questions Cloud

Theaussie best car abcauthority now wants to create a : theaussie best car abcauthority now wants to create a database for the sales and bonus records of different years.the
Aussie best car abchas now decided to award an additional : aussie best car abchas now decided to award an additional bonus based on the bonus contributed by the sales of an
Aussie best car abcdeclares that based on its yearly sales : aussie best car abcdeclares that based on its yearly sales it will award a bonus as follows. the bonus will be equally
The managing director of aussie best car abc has invited : the managing director of aussie best car abc has invited you to build a new computer system for them in python. the abc
Write a program that simulates an airplane race the program : write a program that simulates an airplane race. the program will display a table showing the speed in kmhour and
Problem 1suppose you have a relation schema about teaching : problem 1suppose you have a relation schema about teaching classes that has the following attributes class instructor
Problemconsider the following schema of ra b c d with : problemconsider the following schema of ra b c d with functional dependenciesa -gt b b-gt c and b-gtd1- compute the
Imagine you are the project manager for a critical project : imagine you are the project manager for a critical project for an organization. the organization wants to implement an
Assessment taskwrite a java application that calculates : assessment taskwrite a java application that calculates and displays the property tax for n property owners. n

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Evaluates statements of an expression language

Completing and extending the C++ program that evaluates statements of an expression language.

  State private portion of class to model the item

In c++ state the private portion of a class to model the given item: a class Date for dates consisting of a month, day and year. a class PhoneNumber for a telephone numbers consisting of area code, local exchange, and number.

  Write a c function that converts a character to upper case.

Write a C function that converts a character to upper case. The function should have the prototype char to_upper(char ch); The characters given as input to the function are assumed to be in the sets {'a', ..., 'z'} and {'A', ... , 'Z' }. Do not use a..

  Accept positive and negative numbers in its input sequence

the program must accept positive and negative numbers in its input sequence, and ?nd the largest and smallestof the numbers entered whether they are all positive, all negative, or a combination of both positive and negative.

  Write a program using vectors and iterators

Create a program that uses at least two functions that will be called from your main. This program is a number game program that asks for parts of your phone and after manipulating it mathematically, eventually outputs your entire phone number. The d..

  Least number of comparisons needed

What is the least number of comparisons needed to sort an array of 6 numbers, in the worst case, using any sorting algorithm that sorts with binary comparisons? Explain

  Write a program that grades the written portion

The local driver's license office has asked you to write a program that grades the written portion of the driver's license exam. The exam has 20 multiple choice questions.

  Submap that accepts two maps from strings

Write a method called subMap that accepts two maps from strings to strings as its parameters and returns true if every key in the first map is also contained in the second map and maps to the same

  Card poker game develop a simple poker game complete with

card poker game develop a simple poker game complete with basic ai using the object oriented programming principles

  Write equivalent compound statements

What action must be taken before a variable can be used in a program?

  Techniques for information hiding and encapsulation

What techniques did you utilize for information hiding and encapsulation? Are there any improvements you would make? If so, what would they be?

  The bubble sort is also define as the ripple sort one

the bubble sort is also define as the ripple sort. one implementation of this sorting methods is to recurrently move

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