This problem is solved by providing the code in VBA excel it is not complicated and it is well in reach of any computer science or engineering major. Please read the entire problem. Problem: You are going to tell the user’s fortune! Ask the user to think of a number between 1 and 9. Then use a series of message boxes to give the user the following instructions: Multiply their number by three. Add three to the result. Multiply the whole thing by three. Add the digits of their final number together. You will read their minds as they look at their fortune on the spreadsheet and highlight the message corresponding to their final number even though you do not know what number they originally picked! Here are some specific instructions about how I want you to do the above problem. Read all these instructions carefully. Do not waste time doing things that I am not asking you to do. Put your code in a module. (VBA EXCEL) Use four variables to hold the four instruction bullets above (one variable per instruction.) Use five message boxes. One to give the user the original instruction about thinking of a number, and one using each of the four message variables. Note, you do not need to ask the user for the number they are choosing or do any calculations. Only do the things you are being asked to do in these instructions. If you ask them for their number, you are not reading their mind!
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
This problem is solved by providing the code in VBA excel it is not complicated and it is well in reach of any computer science or engineering major. Please read the entire problem.
Problem:
You are going to tell the user’s fortune! Ask the user to think of a number between 1 and 9. Then use a series of message boxes to give the user the following instructions:
- Multiply their number by three.
- Add three to the result.
- Multiply the whole thing by three.
- Add the digits of their final number together.
You will read their minds as they look at their fortune on the spreadsheet and highlight the message corresponding to their final number even though you do not know what number they originally picked! Here are some specific instructions about how I want you to do the above problem. Read all these instructions carefully. Do not waste time doing things that I am not asking you to do.
- Put your code in a module. (VBA EXCEL)
- Use four variables to hold the four instruction bullets above (one variable per instruction.)
- Use five message boxes. One to give the user the original instruction about thinking of a number, and one using each of the four message variables.
- Note, you do not need to ask the user for the number they are choosing or do any calculations. Only do the things you are being asked to do in these instructions. If you ask them for their number, you are not reading their mind!
The VBA EXCEL code for above problem is
Private Sub Start_Click()
Dim message1, mesage2, message3, message4 As String
MsgBox "Think of a number between 1 and 9", Title:="Read Mind"
message1 = "Multiply number by 3"
message2 = "Add 3 to result"
message3 = "Multiply result by 3"
message4 = "Add the digits"
MsgBox message1, Title:="Read Mind"
MsgBox message2, Title:="Read Mind"
MsgBox message3, Title:="Read Mind"
MsgBox message4, Title:="Read Mind"
Dim K As Integer
K = CInt(1 + Rnd * 9)
MsgBox "Is this number you thought" & vbNewLine & K, Title:="Read Mind", Buttons:=vbYesNo
End Sub
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 7 images