Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

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.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91877172
  • Price:- $45

Priced at Now at $45, Verified Solution

Have any Question?


Related Questions in Programming Language

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

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 ...

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 ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to 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 ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

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 ...

  • 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