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.:- M92544394
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Searching algorithm - which to use for this problemthe

Searching Algorithm - Which to use for this problem? The original problem was: You get a job with a small e-commerce company. b) The customer base has grown to 8,000,000 customers. Jorge now insists that the sorting algo ...

Question suppose you are stranded on a desert island on

Question : Suppose you are stranded on a desert island on which queues are plentiful, but you need a stack. How can you implement a stack using two queues? What is the big-Oh running time of the stack operations?

Whats the difference between a bigfile tablespace and a

What's the difference between a Bigfile tablespace and a Smallfile tablespace? Explain which you would use for your database and why.

Calculate the probability of selecting a random sample of

Calculate the probability of selecting a random sample of 225 observations with a sample proportion of 0.54 or greater, if the sample population has a population proportion of 0.50.

You run a small pizza shop named pizza hat initially you

You run a small pizza shop named Pizza Hat. Initially you sold pizzas for $8 and every week you sold around 3000 pizzas. Each pizza costs you $3 to make. One day you decided to o¤er discounts to customers to see if you c ...

Think about a good or service for which you believe there

Think about a good or service for which you believe there has been a shift in demand or supply. Explain the reasons behind the shift and how that has influenced the equilibrium price.

What are some ways malware can effect a mac computer can

What are some ways malware can effect a mac computer? Can they be prevented?

Discuss why a financial services organization would benefit

Discuss why a financial services organization would benefit from using one framework over another (COSO, COBIT,) -- choose a framework or frameworks that in your opinion would be most ideally suited for such an organizat ...

1population parametric mean 53501standard deviation

1) Population (parametric) mean= 53.501 Standard deviation = 1.79208 Imagine that 5 individuals are sampled at random from this population. Calculate the probability that the average calculated will be less than the valu ...

String cyclic leftshift string s int k that creates and

String cyclic LeftShift (String s, int k) that creates and returns a string in which character of s has been moved left k steps, so that the characters that would "fall off' the left end are appended to the right. For ex ...

  • 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