Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

MAGIC 8 BALL: This program will ask the user to enter a yes/no question and it will then print out an appropriate yes or no response. Hint: You will have to read in the question into a string variable, but you don't really need it. Your program will generate a random number from 0 to 7 (depends on how many responses you want to have in your program) and it will print out a response based on the random number.( in c++ programming)

1. promptuser()

a. Does not return a value

b. Does not have arguments

c. This function will prompt the user (print out a message asking for a yes or no question). The function will read in the question into a string variable (even though we don't need it later).

2. getrandom()

a. Returns an integer which is the random number to be used

b. Does not have arguments

c. This function will generate a random number from 0 to 7 (depends on how many responses you have - see below). The function will return the random number back to the main body.

3. Printresponse()

a. Does not return a value

b. It does have 1 argument, the random number. Based on this number the function will print out an appropriate response.

c. Use a switch statement and depending on what the random number is, print out a message. For example, if the random number

i. is 0, print out "No way!".

ii. is 1, print out "Unfortunately ... yes!"

iii. is 2, print out "YASSSS!"

vi. is 3, print out "I wish I could say yes..."

v. is 4, print out "Of course not!"

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92550511
  • Price:- $15

Priced at Now at $15, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Strategies when resources are constraineda project manager

Strategies When Resources Are Constrained A project manager has fewer options for accelerating project completion when additional resources are either not available or the budget is severely constrained. This is especial ...

Assignmenta in the slides and textbook one of the examples

Assignment (a) In the slides and textbook, one of the examples features a class for counting up. An interface which defines this functionality is given below: public interface IncrementCounter { //Increments the counter ...

Can someone please show me how to do this step by step

Can someone please show me how to do this step by step please. I dont understand any of it 1.) Add a new virtual disk a) Edit VMware player settings to add a new virtual hard disk. b) Start or reboot the virtual machine ...

The task is to implement closest pair algorithm along with

The task is to implement closest pair algorithm. Along with the implementation in c++, I want two additional things. Thing 1. Test the correctness of your algorithm in the following way: Generate 100 random points in the ...

Take a tour of your building on campus or at work what is

Take a tour of your building on campus or at work. What is secured at night when workers are absent? Record the location and type of physical access control devices. How do these access controls change at night when work ...

The economic dynamism which is the index of productive

The economic dynamism, which is the index of productive growth in dollars for countries that are designated by the World Bank as middle-income are in table #8.3.9 ("SOCR data 2008," 2013). Compute a 95% confidence interv ...

Objectivesthis assessment item relates to the unit learning

Objective(s) This assessment item relates to the unit learning outcomes as in the unit descriptors. This checks your understanding about basic constructs of C# programming. Details & Problems In this assignment, you are ...

1 what is the boolean expression for an and gate2 what is

1. What is the Boolean expression for an AND gate? 2. What is the Boolean expression for an OR gate? 3. What is the Boolean expression for a NOT gate?

Assignmentbullselect two systems in the lab or at home on

Assignment • Select two systems in the lab (or at home on the same LAN) make sure that they you are able to pass messages between them • Establish Wireshark on one of the systems and be sure that you can see all the mess ...

Question suppose you are constructing a 3-bit counter using

Question : Suppose you are constructing a 3-bit counter using three D flip-flops and some selection of gates. The inputs to the system are Reset (sets every output to zero) and Inc (a signal to increment the counter). Th ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As