Skip to main content
SciNet
  • Home
  • All Courses
  • Calendar
  • Certificates
  • SciNet
    Main Site Documentation my.SciNet
  • CCDB
  • More
Close
Toggle search input
English
English Français
You are currently using guest access
Log in
SciNet
Home All Courses Calendar Certificates SciNet Collapse Expand
Main Site Documentation my.SciNet
CCDB
Expand all Collapse all
  1. Dashboard
  2. PHY1610 - Winter 2023
  3. Assignment 1: C++

Assignment 1: C++

Completion requirements
Opened: Thursday, 12 January 2023, 12:00 AM
Due: Thursday, 19 January 2023, 11:59 PM

For a perfectly elastic bouncy ball dropped from a height of \(h\) will bounce on the floor, the time between bounces (the "bounce time") would be given by

\[ t = \sqrt{\frac{8h}{g}} \]

where \(g\) is the gravitational acceleration on earth.

Now consider a set of \(n\) bouncy balls dropped from successively higher points, such that the \(i\) -th ball is dropped from a height 

\[ h_{i} = h_{avg} \frac{i}{2n} \]

where \(h_{avg}\) is the average drop point of the set, and \(i\) should run from 0 to \(n-1\) (true to the C++ style to start counting at zero). 

Note: there is a typo in the above formula, the 2 should be in the numerator for \(h_{avg}\) to be the average, but since it's already posted we'll leave the formula as is so everyone's assignment computes the same thing. 

Your assignment is to write a C++ program that can compute and output the bounce times of this set of bouncy balls.  

Your program:

  • should take the input parameters \(n\) and \(h_{avg}\) from keyboard  (you can use the value 9.81 m/s2 for the gravitational accelleration \(g\));
  • should write out (to screen or to a file, your choice) a set of lines with each line containing the drop-height (in meters), a space, and then the bounce time (in seconds);
  • should be a single file;
  • should have explanatory comments;
  • should contain, apart from the main function, at least 2 other functions
  • should not use global variables.

You should submit two files to the course website by midnight (ET) January 19th, 2023:

  1.  the file with your code
  2. a file containg the output for the case \(h_{avg}=100\), \(n=100\).

Both files should be plain text files (so no .doc, .docx, .rtf, .pdf, .odt, .ods, ... files) 


Contact site support
You are currently using guest access (Log in)
Data retention summary


All content on this website is made available under the Creative Commons Attribution 4.0 International licence, with the exception of all videos which are released under the Creative Commons Attribution-NoDerivatives 4.0 International licence.
Powered by Moodle