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!

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 15PE
icon
Related questions
icon
Concept explainers
Question

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.

  1. Put your code in a module. (VBA EXCEL)
  2. Use four variables to hold the four instruction bullets above (one variable per instruction.)
  3. 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.
  4. 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!
Expert Solution
Step 1

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

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 7 images

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,