Assignment Submission Document Chapter 3B.rtf - CIS 116 Chapter 3 Assignment B Submission Document Paste your program code for problem 1 Asg3bEx1.rb

Assignment Submission Document Chapter 3B.rtf - CIS 116...

This preview shows page 1 - 3 out of 8 pages.

CIS 116 Chapter 3 Assignment B Submission Document Paste your program code for problem 1, Asg3bEx1.rb below: # Author: Christian Okonye # Program: Mathematical calculator # Description: This program calculates how long it takes a rock to hit the ground when droped off a cliff of a particular height # Date: 2/12/2019 # Course: CIS116 # Instructor: Kenneth smith # Assgmt no: 3 # Problem no: 1 # Algorithm: - Request user to enter required variable values (time[t], height[y] ) # -Convert height in feet to meters # -Place the values into the calculation formula # -Display the answer to the user #Get height from user puts " Enter the particular height whereby the rock hit the ground:" height = gets.to_i #convert height to meter y = height / 3.28 a = 9.81 #Calculate the time it took for the rock to hit the ground t = Math .sqrt(( 2 * y )/ a ) puts " The time it takes a rock to hit the ground when droped off a cliff off the given height is " + t .to_s + " seconds" Paste a session of your code running:
Use the following input for the session you paste:Height of the cliff in feet: 1000 /usr/local/Cellar/ruby/2.6.1/bin/ruby /Users/toju/RubymineProjects/Asg3b/Asg3bEx1.rb Enter the particular height whereby the rock hit the ground:

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture