Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

With Visual Basic Program Please. Assignment #1: (15 points): (Required: For this assignment, use pretest and posttest forms of the Do loop constructs.) Problem Statement

With Visual Basic Program Please.image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Assignment #1: (15 points): (Required: For this assignment, use pretest and posttest forms of the Do loop constructs.) Problem Statement (Projectile Motion): Design and develop a Visual Basic application, for Projectile Motion to provide information on the height of a ball thrown straight up into the air. As initial input, the program should request the initial height, designated by lowercase letter h , in number of feet, and the initial velocity, designated by lowercase letter v , in number of feet per second. (let us refer to initial height as ho, meaning h with subscript zero and, and refer to initial velocity as vo, meaning v with subscript zero). When the application is loaded on Visual Studio IDE, the initial screen should resemble, as shown below: Projectile Motion Initial Height hiti Velocity feet) feet/second) Display Table Determine Maximum Height Determine Approximate Time until Bal Hits the Ground Qut 1st Output Thelayout of the form in the Designer window, consists of two label controls, each associated with two textboxes, for the user to enter the intial height, and intial velocity at the time, the ball is thrown in the air, folowed by four button controls, eaach assigned for a particuar task to be performed, as shown on the above screen capture. Finally, a listbox control for the output! Input Validation: The user should not leave the textboxes for the entry of the Initial Height and Initial Velocity, empty, or enter invalid input. The input in these textboxes must be numeric (preferably of Decimal data type. See pp 60-1 in text). In case of invalid entry by the user you may then use a Message Dialog Box to inform and warn the user to enter valid numeric entry. How it works! Required: Use a Sub-procedure InputData()to check for valid entry by the user for the Initial Height and Initial Velocity. This sub-procedure should be placed in your programming code and be accessible by other procedures in the code, when initial values by the user are requested. The formula: The height of the ball (in feet) after t seconds is given by the formula: h+vt-16t?. It should be coded in the program as: height = ho + vo * t - 16 * t *t For each of the following tasks, use an appropriate event handler. (a) Determine Maximum Height of the ball while in the air: Required: Use a Function to compute the maximum height of the ball- The trajectory or the movement of the ball while in the air, which will resemble a parabolic curve that opens downward as an inverted U pattern, like n with the maximum height at its vertex (The heights point the ball reaches). The ball will reach its maximum height after vo/32 seconds. *Important*: We cannot measure the maximum height the ball reaches in negative sense. In such a case you are required to reexamine your code, and construct it in such a way to ensure the maximum height of the ball has a positive numeric magnitude in feet. (b) Determine Approximate Time until Ball Hits the Ground: Note: There are two possibilities (occasions), when the height of the ball will be zero (0) foot. i. First, at time zero (0 second), before the ball is thrown into the air. ii. Second, at the time, the ball hits the ground, after following its parabolic pattern. Required: Use another Function to compute the height of the ball for every one-tenth (0.1) of a second, while the ball is in the air. When the ball hits the ground, its height should be zero (0) foot. This will determine the approximate time (t) in seconds, when the ball hits the ground, by using the formula: height = ho + VO * t - 16 * t*t to compute the height of the ball for every one-tenth (0.1) of a second. *Important*: The internal computation of Visual Basic Compiler may not produce the desired precision of accuracy. Try to experience with using increments other than (0.1) seconds, for instance, you may use increments of (0.01) or (0.001) second. *Important*: We cannot measure the approximate time, when the ball hits the ground in negative sense. In such a case you are required to reexamine your code, and construct it in such a way to ensure the approximate time of the ball to hit the ground is zero (0). (c) Display Table: This task measures the movement of the ball, using a table of values. Required: Use a Sub-procedure to show the height of the ball for every quarter of second (0.25), until the time the ball hits the ground at the height of zero (0) feet by using a ListBox Control to display a table of values with two column headings "Time", and "Height. *Important*: Remember when the ListBox displays the Time of the ball for every quarter of second, associated the Height, or the movement of the ball, the last entry (row) in the ListBox should not display the height of the ball with a negative value at the time the ball hits the ground. In such a case you are required to reexamine your code, and construct it in such a way to ensure the height of the ball is zero (0), when it hits the ground. (d) Quit: Exit the application by triggering the Quit button Required: (Best Practices) For effective visual display, please use "Courier New font, for correctly aligning the text in the list box. This will provide clarity and readability. Additionally, make sure that you will clear all the entries that are currently are displayed in the ListBox. Running the application! Step 1: Once the application loads, and runs, the following display depicts the Form and its controls. Projectile Motion Ins Hegnt feet) feet/second) Display Tsh Date Macrtum eget Determine Aparate Time und Bal Hits the Ground Q. latOutput Step 2: Determine Maximum Height of the ball while in the air: At the runtime, you will need to provide, the initial height of the ball in feet ho, and the initial velocity vo, in feet per second Assume that the initial height of the ball, ho, is zero (0) feet, and the initial velocity of the ball, vo, is 36 feet/second, the following screen capture should display the maximum height of the ball while in the air! Projectile Motion Vital Height feet) Incl Velocity feet/second 25 Display Madin.m Height Dalaara Appreurs di Bal Mis the Ground Cut The maximum heighs 13 20.25 feet Please note: The application should also provide possibilities for various entry values of initial height and velocity, in case the user entries for these initial height and velocity values are different. Step3: Determine Approximate Time until Ball Hits the Ground: Assume that the initial height of the ball, ho, is zero (0) feet, and the initial velocity of the ball, vo, is 36 feet/second, the following screen capture should display the approximate time until the ball hits the ground! .: Projectile Motion Height feet/second hool Velocity 36 Display Table Determine Massimum Height Detemine proximate Time untl Ball is the Ground O The ball 11 hit the ground after approximately 2.31 seconds Step 4: Display Table: Assume that the initial height of the ball, ho, is zero (0) feet, and the initial velocity of the ball, vo, is 36 feet/second, the following screen capture should display the table of values, showing the height of the ball every quarter (0.25) second, until it hits the ground! Projectile Motion Intial Height: 0 feet) Initial Velocity feet/scond 36 Display Table Determine Maximum Height Determine Approximate Time until Bal Hts the Ground Qut | Eeight 0.0 Time 0.00 0.25 0.50 14.0 18.0 1.00 1.25 1.50 1.75 2.00 20.0 18.0 14.0 0.0 Recommended naming convention: For control objects appearing in the Code Editor. Name Property Text Property Control Type Description frmBall Projectile Motion Form txtInitialHeight Text Box txtInitialVelocity Text Box btnMaxHeight Determine Maximum Height Button btnApproxTime Determine Approximate Button Time until Ball Hits the Ground btnTable Display Table Button "Height" btnQuit Quit Button IstOutput List Box Holds application's controls Captures user's input for initial height ho Captures user's input for initial velocity VO Triggers the event to compute maximum height Triggers the event to compute the approximate time the ball hits the ground Triggers the event to display Time, and Triggers the event to exit the program Columnar display of Time, and Height" Remember that in addition of the above, you are required to apply suitable naming convention to all variables that are declared and used (accessed in the application) in the program code. Assignment #1: (15 points): (Required: For this assignment, use pretest and posttest forms of the Do loop constructs.) Problem Statement (Projectile Motion): Design and develop a Visual Basic application, for Projectile Motion to provide information on the height of a ball thrown straight up into the air. As initial input, the program should request the initial height, designated by lowercase letter h , in number of feet, and the initial velocity, designated by lowercase letter v , in number of feet per second. (let us refer to initial height as ho, meaning h with subscript zero and, and refer to initial velocity as vo, meaning v with subscript zero). When the application is loaded on Visual Studio IDE, the initial screen should resemble, as shown below: Projectile Motion Initial Height hiti Velocity feet) feet/second) Display Table Determine Maximum Height Determine Approximate Time until Bal Hits the Ground Qut 1st Output Thelayout of the form in the Designer window, consists of two label controls, each associated with two textboxes, for the user to enter the intial height, and intial velocity at the time, the ball is thrown in the air, folowed by four button controls, eaach assigned for a particuar task to be performed, as shown on the above screen capture. Finally, a listbox control for the output! Input Validation: The user should not leave the textboxes for the entry of the Initial Height and Initial Velocity, empty, or enter invalid input. The input in these textboxes must be numeric (preferably of Decimal data type. See pp 60-1 in text). In case of invalid entry by the user you may then use a Message Dialog Box to inform and warn the user to enter valid numeric entry. How it works! Required: Use a Sub-procedure InputData()to check for valid entry by the user for the Initial Height and Initial Velocity. This sub-procedure should be placed in your programming code and be accessible by other procedures in the code, when initial values by the user are requested. The formula: The height of the ball (in feet) after t seconds is given by the formula: h+vt-16t?. It should be coded in the program as: height = ho + vo * t - 16 * t *t For each of the following tasks, use an appropriate event handler. (a) Determine Maximum Height of the ball while in the air: Required: Use a Function to compute the maximum height of the ball- The trajectory or the movement of the ball while in the air, which will resemble a parabolic curve that opens downward as an inverted U pattern, like n with the maximum height at its vertex (The heights point the ball reaches). The ball will reach its maximum height after vo/32 seconds. *Important*: We cannot measure the maximum height the ball reaches in negative sense. In such a case you are required to reexamine your code, and construct it in such a way to ensure the maximum height of the ball has a positive numeric magnitude in feet. (b) Determine Approximate Time until Ball Hits the Ground: Note: There are two possibilities (occasions), when the height of the ball will be zero (0) foot. i. First, at time zero (0 second), before the ball is thrown into the air. ii. Second, at the time, the ball hits the ground, after following its parabolic pattern. Required: Use another Function to compute the height of the ball for every one-tenth (0.1) of a second, while the ball is in the air. When the ball hits the ground, its height should be zero (0) foot. This will determine the approximate time (t) in seconds, when the ball hits the ground, by using the formula: height = ho + VO * t - 16 * t*t to compute the height of the ball for every one-tenth (0.1) of a second. *Important*: The internal computation of Visual Basic Compiler may not produce the desired precision of accuracy. Try to experience with using increments other than (0.1) seconds, for instance, you may use increments of (0.01) or (0.001) second. *Important*: We cannot measure the approximate time, when the ball hits the ground in negative sense. In such a case you are required to reexamine your code, and construct it in such a way to ensure the approximate time of the ball to hit the ground is zero (0). (c) Display Table: This task measures the movement of the ball, using a table of values. Required: Use a Sub-procedure to show the height of the ball for every quarter of second (0.25), until the time the ball hits the ground at the height of zero (0) feet by using a ListBox Control to display a table of values with two column headings "Time", and "Height. *Important*: Remember when the ListBox displays the Time of the ball for every quarter of second, associated the Height, or the movement of the ball, the last entry (row) in the ListBox should not display the height of the ball with a negative value at the time the ball hits the ground. In such a case you are required to reexamine your code, and construct it in such a way to ensure the height of the ball is zero (0), when it hits the ground. (d) Quit: Exit the application by triggering the Quit button Required: (Best Practices) For effective visual display, please use "Courier New font, for correctly aligning the text in the list box. This will provide clarity and readability. Additionally, make sure that you will clear all the entries that are currently are displayed in the ListBox. Running the application! Step 1: Once the application loads, and runs, the following display depicts the Form and its controls. Projectile Motion Ins Hegnt feet) feet/second) Display Tsh Date Macrtum eget Determine Aparate Time und Bal Hits the Ground Q. latOutput Step 2: Determine Maximum Height of the ball while in the air: At the runtime, you will need to provide, the initial height of the ball in feet ho, and the initial velocity vo, in feet per second Assume that the initial height of the ball, ho, is zero (0) feet, and the initial velocity of the ball, vo, is 36 feet/second, the following screen capture should display the maximum height of the ball while in the air! Projectile Motion Vital Height feet) Incl Velocity feet/second 25 Display Madin.m Height Dalaara Appreurs di Bal Mis the Ground Cut The maximum heighs 13 20.25 feet Please note: The application should also provide possibilities for various entry values of initial height and velocity, in case the user entries for these initial height and velocity values are different. Step3: Determine Approximate Time until Ball Hits the Ground: Assume that the initial height of the ball, ho, is zero (0) feet, and the initial velocity of the ball, vo, is 36 feet/second, the following screen capture should display the approximate time until the ball hits the ground! .: Projectile Motion Height feet/second hool Velocity 36 Display Table Determine Massimum Height Detemine proximate Time untl Ball is the Ground O The ball 11 hit the ground after approximately 2.31 seconds Step 4: Display Table: Assume that the initial height of the ball, ho, is zero (0) feet, and the initial velocity of the ball, vo, is 36 feet/second, the following screen capture should display the table of values, showing the height of the ball every quarter (0.25) second, until it hits the ground! Projectile Motion Intial Height: 0 feet) Initial Velocity feet/scond 36 Display Table Determine Maximum Height Determine Approximate Time until Bal Hts the Ground Qut | Eeight 0.0 Time 0.00 0.25 0.50 14.0 18.0 1.00 1.25 1.50 1.75 2.00 20.0 18.0 14.0 0.0 Recommended naming convention: For control objects appearing in the Code Editor. Name Property Text Property Control Type Description frmBall Projectile Motion Form txtInitialHeight Text Box txtInitialVelocity Text Box btnMaxHeight Determine Maximum Height Button btnApproxTime Determine Approximate Button Time until Ball Hits the Ground btnTable Display Table Button "Height" btnQuit Quit Button IstOutput List Box Holds application's controls Captures user's input for initial height ho Captures user's input for initial velocity VO Triggers the event to compute maximum height Triggers the event to compute the approximate time the ball hits the ground Triggers the event to display Time, and Triggers the event to exit the program Columnar display of Time, and Height" Remember that in addition of the above, you are required to apply suitable naming convention to all variables that are declared and used (accessed in the application) in the program code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions