Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The surface area and volume of a cylinder of length L and diameter d are given by the following formulas: Surface Area = PI*Diameter*Length +

The surface area and volume of a cylinder of length L and diameter d are given by the following formulas:

Surface Area = PI*Diameter*Length + 2((PI/4)*Diameter^2

Volume = Length * ((PI/4)* Diameter ^ 2)

The value of is approximately 3.141592654.

In large programs it is common practice to use one Sub procedure to obtain input for the program from files or worksheets, one or more other Sub procedures to perform calculations, and one final Sub procedure to write the output to files or worksheets. The macro that contains all these Sub procedures is often named main.

Input the length of cylinder into cell A2 and the diameter of a cylinder into cell A3. Create a run button on Sheet2 that executes a macro named main. This macro performs the following tasks:

Call a Sub procedure named getvals that obtains the length and diameter from cells A2 and A3, and

stores them in variables.

Then call a Sub procedure named calcSAVol that calculates the surface area and volume of the cylinder

and stores them in variables. Inside calcSAVol create a constant named pi that stores the value

of .

Finally call a Sub procedure named writeout that outputs the values of the surface area and volume to

cells B6 and B7.

This problem will require you to create four different Sub procedures (main, getvals, calcSAVol, and writeout). You will call getvals, calcSAVol, and writeout from inside main. Write all four Sub procedures in one module.

Highlight and label the cells where the user must input data and the cells where data will be output to the worksheet. Assume the user will input all necessary values before clicking the run button.

Use the Option Explicit statement for this macro.

(please provide the written code and screenshots of code in VBA)

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

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions

Question

Identify several ways to make better decisions about retirement.

Answered: 1 week ago