Docsity

2 Practice Problems on Engineering Digital Computations - Midterm 2 Examples | ME 232, Study notes of Mechanical Engineering

Toggle sidebar
bg1
Problem 1
Assume you are filling a steel-walled, right circular cylinder with material. Assume the cylinder is open on
top. Assume the wall thickness is 0.50 inch.
Write a program that allows the user to determine the total weight of the cylinder and the material in it
based on cylinder heights ranging from 4 to 8 feet, cylinder diameters ranging from 3 to 9 feet, and a
material height ranging from 0 to the height of the cylinder. Use textboxes that allow the user to make
inputs for cylinder height, cylinder diameter, material height, and material density.
Allow the user the option of specifying if the diameter is inside or outside diameter.
Find the density of steel and code that into the program (this should not be a user entry).
Activate the program by a button on the spreadsheet.
Return each of the above inputs to the spreadsheet with text in the spreadsheet identifying each item.
Start your entries in Sheet 1, Cell A1.
Return your final answer to the spreadsheet (i.e., the weight of the combined cylinder and the material it
contains) with text in the spreadsheet identifying total weight.
Include provisions to clear the program. Make the program automatically clear all entries when you close
the form. Include validation to assure appropriate data inputs. Make sure the program warns the user if
the material height exceeds the cylinder height, if the user enters negative numbers, or if the user enters
a string when a number is required.
Problem 2
Write a program for performing exponentiation as defined below:
• The user can enter (on a form) any number between 0 and 17.34.
• The user can enter (on the same form) any number between 0 and 13.87.
• When commanded to do so, the program will calculate the first number raised to the power of the
second number and display it on the form with at least one significant digit to the left of the decimal point,
and three significant digits to the right of the decimal point. The program will also display “The answer
is :” immediately to the left of the answer on the form when the program is commanded to display the
answer.
• The program will return the answer to Cell A2 on Sheet 1 with three decimal places when commanded
to do so with a separate command button (do not use the same command button as the one used for
displaying the answer on the form). In the cell above Cell A2, the program will display “The answer is”
when the program returns the answer to Cell A2.
• The program will advise the user if the user attempts to enter a number outside the allowed range, or if
the input contains a string instead of a number.
• The program will close and clear all entries when commanded to do so.

Partial preview of the text

Download 2 Practice Problems on Engineering Digital Computations - Midterm 2 Examples | ME 232 and more Study notes Mechanical Engineering in PDF only on Docsity!

Problem 1 Assume you are filling a steel-walled, right circular cylinder with material. Assume the cylinder is open on top. Assume the wall thickness is 0.50 inch. Write a program that allows the user to determine the total weight of the cylinder and the material in it based on cylinder heights ranging from 4 to 8 feet, cylinder diameters ranging from 3 to 9 feet, and a material height ranging from 0 to the height of the cylinder. Use textboxes that allow the user to make inputs for cylinder height, cylinder diameter, material height, and material density. Allow the user the option of specifying if the diameter is inside or outside diameter. Find the density of steel and code that into the program (this should not be a user entry). Activate the program by a button on the spreadsheet. Return each of the above inputs to the spreadsheet with text in the spreadsheet identifying each item. Start your entries in Sheet 1, Cell A1. Return your final answer to the spreadsheet (i.e., the weight of the combined cylinder and the material it contains) with text in the spreadsheet identifying total weight. Include provisions to clear the program. Make the program automatically clear all entries when you close the form. Include validation to assure appropriate data inputs. Make sure the program warns the user if the material height exceeds the cylinder height, if the user enters negative numbers, or if the user enters a string when a number is required. Problem 2 Write a program for performing exponentiation as defined below:

  • The user can enter (on a form) any number between 0 and 17.34.
  • The user can enter (on the same form) any number between 0 and 13.87.
  • When commanded to do so, the program will calculate the first number raised to the power of the second number and display it on the form with at least one significant digit to the left of the decimal point, and three significant digits to the right of the decimal point. The program will also display “The answer is :” immediately to the left of the answer on the form when the program is commanded to display the answer.
  • The program will return the answer to Cell A2 on Sheet 1 with three decimal places when commanded to do so with a separate command button (do not use the same command button as the one used for displaying the answer on the form). In the cell above Cell A2, the program will display “The answer is” when the program returns the answer to Cell A2.
  • The program will advise the user if the user attempts to enter a number outside the allowed range, or if the input contains a string instead of a number.
  • The program will close and clear all entries when commanded to do so.