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

  Program to compute total price of items before tax

Program is to compute total price of items before tax and then tax payable on those items. Tax payable is computed by applying tax rate percentage to total price.

  Write pseudocode for determining grade of student

Write a pseudocode for determining the grade of a student given his/her total score. The program should display a grade of A if the score is above 85.

  Function to count number of times the given number occured

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 numbers 2 and 5 occur. The function should declare static variables count2 and count5.

  Unix systems administration

Unix Systems Administration

  Write an assembly program to output a list of number

Write an Assembly program to output a list of number.

  Write program in vb dot net for mortgage payment amount

Write down the program in VB.Net (not Web based) by using the loan amount of $200,000 with the interest rate of 5.75% and 30 year term.

  Prepare menu driven program for arithmetic operations

Create algorithms, flowchart and write programs in c language for following: Prepare a menu driven program for different arithmetic operations.

  Front end applications

How does a compiled binary executable store on the client computer?

  Comment on the performance of your system

E91: Humanoid Robotics - Spring 2013 - Assignment 2. Produce a webpage demonstrating your program. Provide images of your humanoid model in a neutral pose, several (at least 2) random unstable poses, several random stable poses. Comment on the per..

  Write a program to operate the barriers

The entrance to the car park is on the left hand side. When a car drives into the car park there is a sensor that detects the car and this should cause the barrier to be opened to allow the car in.

  Write a report on t linux kernel programming

Write a report on  t Linux Kernel programming.  Giving a brief introduction about Linux in general, then give in details information about Linux Kernel Programming.

  Design program to list total points scored for classroom

Student ID, classroom number, and score on the achievement test. Design a program that lists the total points scored for each of the 30 classrooms.

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