Create a program that reads position and velocity data

Assignment Help Programming Languages
Reference no: EM131119608

For this project, you will create a program that reads position, velocity, and acceleration data from a file, and determines if two objects will collide.

Requirements:

1. Your solution must include a function that will:

a. take four doubles as arguments: initial position, initial velocity, acceleration, and current time.

b. return a double: the current position, given by the formula: x = x0 + v0 t + ½ a t2

2. Your solution must include a function that performs a unit test of that function. It should include 5 test cases, that include at least one zero, and at least one negative value for x0, v0, or a.

3. The program will: a) Prompt the user to enter the filename. b) Open the file, or if the file does not exist, print an error message and quit. c) Process each line of the file. The file format is given on the next page. If the program encounters an error, it should print an error message and quit. d) Close the file. e). Starting at a time of 0 seconds, until the maximum requested time is reached, in steps of 1.0 seconds: i)calculate the positions of the two objects. ii) print the time and positions of the objects. iii) if they collide within the tolerance, print a collision message, reporting the time of collision, and exit the program. f) If the objects do not collide withing the specified time frame, report that there was no collision. 4) As always, use good programming style. (commenting)

File format:

-Each line of the file contains one item, in a specific order.

-The lines are formatted so that the number is first, followed by comment (which can be ignored by the program).

-Sample file (situation1.txt): 100 // max time 0.5 // tolearance 10.0 // x0 for first object 0.0 // vx0 0.0 // ax 0.0 // x0 for second object 1.0 // vx0 0.0 // ax // second object should catch first in 10 seconds! -Another sample file (situation2.txt): 50 // max time 0.5 // tolearance 10.0 // x0 for first object 2.0 // vx0 0.0 // ax 0.0 // x0 for second object 1.0 // vx0 0.0 // ax // will never catch it

-Sample files are available on Canvas. You can also create your own test files.

-Hints: Be sure to place the input files in the same directory as your cpp file. Remember to tell CLion where to look for input files. To do this: Run → Edit Configurations → Click on the ... next to the Working Directory label, and select the directory where the input files are located (and where your cpp is located).

You can add the capability to use both x and y coordinates to determine collisions. Up to 4% extra credit can be earned.

Reference no: EM131119608

Questions Cloud

What is the potential impact on the bariatric program : What is the potential impact on the Bariatric Program and the organization? (Discuss at least three) What are some potential solutions? Which one is the best considering all the facts that have been presented
Importance of security metrics and performance management : 1. Broadly discuss the concept of security and traditional security approaches. 2. Fully explain the importance of security metrics and performance management?
Percentage of completion method : Recognition of Profit and Balance Sheet Amounts for Long-Term Contracts Yanmei Construction Company began operations January 1, 2010. During the year, Yanmei Construction entered into a contract with Lundquist Corp. to construct a manufacturing facil..
Describe the concept of market efficiency : Describe the concept of market efficiency. In what sense is this concept an important part of the shareholder wealth maximization objective?
Create a program that reads position and velocity data : For this project, you will create a program that reads position, velocity, and acceleration data from a file, and determines if two objects will collide.
Match the appropriate case to its description : Arrestees may be strip searched for minor offenses to ensure safety and security of the facility - Neither inconvenience nor cost is an acceptable excuse for treating female inmates differently than male inmates.
Outlined clear performance expectations : Assuming you worked for a company that had outlined clear performance expectations. What would you do as a manager to provide feedback to employees throughout the year on their performance. Try to identify 3-4 specific feedback options.
What is the primary distinction between the trading process : What is the primary distinction between the trading process on the New York Stock Exchange and the over-the-counter markets?
What kind of world is voltaire describing : What kind of world is Voltaire describing? What type of character is Candide and what point of view does Pangloss represent?

Reviews

Write a Review

Programming Languages Questions & Answers

  Determine branch folding for unconditional branches

Determine the improvement from branch folding for unconditional branches. Assume a 90% hit rate, a base CPI without unconditional branch stalls of 1.

  Create a program for a ledger''s furniture store

Create a program for a Ledger's Furniture Store. Create a pseudocode program using Notepad++ to solve this problem. Third, create the program with RAPTOR.

  Create xml document to mark nutrition facts for cookies

Create an XML document that marks up the nutrition facts for a package of Grandma White's cookies. A package of cookies has a serving size of 1 package and the following nutritional value per serving.

  Prepare a assignment in sql

Prepare a assignment in SQL. To create two table names (not in use employee ,product ,order )- Separate queries of all function,screen shots and queries.

  Program to display aggregate information for state

For each state, display aggregate information for that state, including: the total number of counties in the state, the total number of tax returns.

  Create method to calculate value of product purchase

In addition, the receipt should display the value of the entire purchases. Create a method to calculate the value of the product purchases.

  Program-calculate power loss-transmitted-power generating

Write a program to calculate power loss in transmission line with resistance of 0.05 ohms/mile. Calculate power loss if 500 kW of power is transmitted from power generating station.

  Determine proper lower bound and upper bound on ?nal value

Determine the proper lower bound and upper bound on the ?nal value of the shared variable tally output by this concurrent program.

  Develop the flow diagram

Develop the flow diagram of the information and any control elements needed to ensure proper access for the information.Submit a draft PowerPoint presentation with the following elements

  Program to compute risk of weight-related health problems

A quantity known as the body mass (BMI) is used to calculate the risk of weight-related health problems. Write a program that accepts weight and height and then displays the BMI value and Status.

  Which of the following is not true about html5

Which of the following is not true about HTML5? o Better error handling o Reduce the need for external plug-in (like Flash)

  Write program which prompts user to input integer

Write a C++ program which prompts user to input the integer and then ouputs both individual digits of number and the sum of the digits.

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