Bus392-Practice Examples code_notes

Bus392-Practice Examples code_notes - #33-pg98 Dim...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#33-pg98 Dim dblRevenue As Double ‘declare variables Dim dblExpenses As Double Dim NetIncome As Double ‘input from the user dblRevenue = InputBox("Please enter the company's annual revenue.") dblExpenses = InputBox("Please enter the company's annual expenses.") ‘calculation NetIncome = dblRevenue - dblExpenses ‘outcome Sheet1.Cells(1, 1).Value = "Net Income" Sheet1.Cells(2, 1).Value = Format(NetIncome, "$##00.00") #34 Dim dblPrice As Double Dim intOunce As Integer Dim dblCanPrice As Double dblCanPrice = 0.68 intOunce = 17 dblPrice = dblCanPrice / intOunce Sheet1.Cells(1, 1).Value = "If the price of a " & intOunce & "-ounce can of corn is " & dblCanPrice & " cents, the price per ounce is " & dblPrice & "." #35 Dim dblPrice As Double 'the price of one share of stock Dim dblEarnings As Double 'the company's earnings-per-share for the year Dim dblRatio As Double 'Company's price to earnings ratio 'input from the user dblPrice = InputBox("Please enter the price of one share of stock.") dblEarnings = InputBox("Please enter the company's earnings-per-share for the year.") 'calculation dblRatio = dblPrice / dblEarnings 'Output using Msg box 'MsgBox "The company's price-to-earnings ratio is " & Format(dblRatio, "##00.00") 'output to show on worksheet Sheet1.Cells(1, 1).Value = "The company's price-to-earnings ratio is " & Format(dblRatio, "$##00.00") #36 Dim intRadius As Integer 'the radius of the earth Dim dblVolume As Double 'the volume of the earth
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
intRadius = 6170 dblVolume = (4 / 3) * (3.14159) * ((intRadius) ^ 3) 'output MsgBox "The volume of the earth is " & Format(dblVolume, "#,#00.00") 'Sheet1.Cells(1, 1).Value = "The volume of the earth is " & Format(dblVolume, "#,#00.00") #37 Dim dblPoundsNeeded As Double Dim dblSizeOfLawn As Double dblSizeOfLawn = (40 * 75) / 50 'divided by 50 to get the total of ounces dblPoundsNeeded = dblSizeOfLawn / 16 'divided by 16 to turn ounces to pounds.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern