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

  Write application to calculate average of temperature

Write the application to calculate average of set of temperature readings. Application prompts user to enter the number of temperature readings to be entered, then prompts user to enter temperature.

  Design a benefits election system

Individual project for this course is in form of Service Request from Huffman Trucking. It is essential for student to access Service Request: SR-ht-001. Design a Benefits Election System.

  Find the error in the given pseudocode

If the following pseudocode were an actual program, why would it not display the output that the programmer expects? Declare String favoriteFood Display "What is the name of your favorite food?" Input favoriteFood Display "Your favorite food is " ..

  Write program to calculate distance and time hurricane take

Write C++ program that will calculate the distance and time it will take (days/hours) for hurricane to reach Ft. Lauderdale if: Hurricane is at coordinates 16 N, 64 W, just SE of South Fla. off in Atlantic, with a speed of 20 mph.

  Explain immediate addressing mode

Expand your program in Part 1 to allow the operand use the "immediate" addressing mode. That is, the value of an operand is stored in the instruction. It should be assumed that the value operand is given as a decimal number.

  Simmac language programs

Write three programs in the machine language of the SIMMAC that will total the numbers stored in 20 different locations and place the result in a single location.

  Different types of program documentation

List at least three different types of program documentation and the pros and cons of each. When should you use each and can you use only one of them?

  Create a utility procedure

Sum of Digits in a String. It is necessary to create a utility procedure that allows you to convert from a character to an integer value to allow you to sum the values of the digits in a string

  Write a function to count the number of times occur

Write a main function to input 20 integers in the range of 1 to 6. Write a function to count the number of times the number 2 and 5 occur. The function should declare static variables count2 and count5. Check the data validity in the main function..

  What is the output of the statement

Given the subsequent array declaration, if the array is stored starting at address 2500, what is the output of the following statement?

  Program to convert temperature in celcius from fahrenheit

Write the program which accepts the temperature in Fahrenheit from user and conversts it to Celsius by subtracting 32 from Fahrenheit value and multiplying result by 5/9. Show both values.

  Two stacks of positive integers are needed

Two stacks of positive integers are needed, both containing integers with values less than or equal to 1000. One stack contains even integers; the other contains odd integers. The total number of elements in the combined stacks is never more than ..

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