Ie 212 homework using variables and capturing user input


Homework: Using variables and capturing user input

Requirements for BOTH problems:

Include brief instructions to inform the user that the input values required for each problem must be entered into the corresponding spreadsheet. You are at liberty to decide where to display and how to organize and format the input values. Minimal work will get minimal grading.

Clearly show the results produced by each solution. You are at liberty to decide where to display and how to format the results. Minimal work will get minimal grading.

Assign the input values entered by the user into the spreadsheet to variables of the appropriate type.

Make sure your program does not experience any flickering when processing the input data or producing results.

Make sure to follow good programming practices. In particular, pay close attention to the following:

  • Explicitly declaring all variables;
  • Properly indenting code so that it is more readable; and
  • Adding comments to your code
  • Using the With construct where/if appropriate.

Upload your two homework files, the .xlsm file and the .pdf file.

PROBLEMS -

Open a blank Excel workbook and save it as a MACRO-ENABLED file. Your workbook must contain only two worksheets named "Prob1" and "Prob2", respectively.

1. Problem 1.

a) Add a module (i.e., Module1) in the Project Explorer and write (do NOT record) all the code for this problem inside this module. Show your results in the worksheet labeled "Prob1."

b) Write code in Excel VBA to implement an algorithm to calculate the area and volume of the curved surface of a right circular cone. The description and flowchart for this algorithm are included in page 3 of this document. Your program must implement the exact algorithm depicted by the flowchart. Note: The dimensions of the right circular cone h and r must be entered by the user into the spreadsheet "Prob1" and then assigned to variables. These variables must then be used to produce the required result(s). DO NOT USE AN INPUT BOX TO REQUEST INPUT FROM THE USER.

c) Assign the sub procedure to a shape button.

d) The results must be displayed to the user when the button is pressed

2. Problem 2.

a) Add a module (i.e., Module2) in the Project Explorer and write (do NOT record) all the code for this problem inside this module. Show your results in a worksheet labeled "Prob2."

b) Write code in Excel VBA to implement an algorithm to determine the real roots of a quadratic equation. The description and flowchart for this algorithm are included in page 4 of this document. Your program must implement the exact algorithm depicted by the flowchart. A note to the user regarding errors may be included in the instructions for when there are no x-intercepts. Note: The coefficients a, b and c must be entered by the user into the spreadsheet "Prob2" and then assigned to variables. These variables must then be used to produce the required result(s). DO NOT USE AN INPUT BOX TO REQUEST INPUT FROM THE USER.

c) Assign the sub procedure to a shape button.

d) The results must be displayed to the user when the button is pressed.

Problem 1: The area and volume of a right circular cone can be calculated with the following formulas:

Area = π * r * [r + √(r2+h2)] (in m2)

Volume = 1/3 * π * r2 * h (in m3)

1853_figure.png

Determine the area and volume based on given values for h and r.

2027_figure1.png

Problem 2: The general form of a quadratic function is f(x) = ax2 + bx + c. The real roots of a quadratic function can be determined with the quadratic formula:

x = -b±√(b2-4ac)/(2a)

Determine the roots of a quadratic function based on given values for the coefficients a, b and c.

2365_figure2.png

Solution Preview :

Prepared by a verified Expert
Engineering Mathematics: Ie 212 homework using variables and capturing user input
Reference No:- TGS02664071

Now Priced at $35 (50% Discount)

Recommended (99%)

Rated (4.3/5)