Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Download below the macro - enabled Excel workbook file: Lastname.VBA.Conditionals.HW . xlsm . Save it using your last name. For example, Jones.VBA.Conditionals.HW . xlsm (

Download below the macro-enabled Excel workbook file: Lastname.VBA.Conditionals.HW.xlsm. Save it using your last name. For example, Jones.VBA.Conditionals.HW.xlsm (using your last name rather than Jones). Write your code in Module1.
Complete the two problems below on the same worksheet (both buttons should be on Sheet1), and then save and submit your workbook.
Assign your code to the appropriate button on Sheet1 for each macro. Each macro should also receive its inputs through an inputbox prompt and display its outputs through a msgbox.
Create a Sub called DonutDiscount that implements the flowchart below. Then, make it run by clicking a button.multiple of thirteen, then the program should output, "That number is NOT a lucky number!"
Hint: Use the Mod operator to determine if a number is a multiple of thirteen:
The Mod operator will return the remainder of one number divided by another, for instance
25 Mod 13=12(25/13=1 with a remainder of 12); 26 Mod 13=0(26/13=2 with a remainder of 0)
If the remainder =0, then the number is a multiple of 13. If the remainder is any other number, then the number is not a multiple of 13.
You can also apply the Mod operator on variables (i.e., myVariable Mod 13 would return the remainder of myVariable divided by 13).
Be sure to write your code in Module1 in the workbook.
Once completed, answer the following multiple choice questions:
Which of the following best reflects your submission?
-I assigned my code to the buttons and they work (i.e., they run the correct macro/sub when I click them).
-I assigned my code to the buttons but they do not work properly (maybe they run the wrong macro or no macro).
-I forgot to assign my code to the buttons
Run the LuckyNumber macro. Enter 4 as a value. What do you get in return?
-Something like: "That number is a LUCKY number!"
-Something like: "That number is NOT a lucky number."
-Bad output or no output
Run the LuckyNumber macro. Enter 39 as a value. What do you get in return?
-Something like: "That number is a LUCKY number!"
-Something like: "That number is NOT a lucky number."
-Bad output or no output
Run the DonutDiscount macro. Enter 13 as a value. What do you get in return?
-Something like: "Congratulations! That number of donuts qualifies for the discounted price!"
-Something like: "Unfortunately, that number of donuts does not qualify for the discounted price!"
-Bad output or no output
Run the DonutDiscount macro. Enter 12 as a value. What do you get in return?
-Something like: "Congratulations! That number of donuts qualifies for -the discounted price!"
-Something like: "Unfortunately, that number of donuts does not qualify for the discounted price!"
-Bad output or no output
image text in transcribed

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

More Books

Students also viewed these Databases questions