Switch statement and depending

Assignment Help Basic Computer Science
Reference no: EM131735708

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!"

Reference no: EM131735708

Questions Cloud

Protecting all of the organization information : Discuss the issues involved in protecting all of the organization's information. How might an organization notify its users that all communications
Identify its micro and macro environment : Identify its Micro and Macro Environment. Define SWOT analysis to Disney Land. Analyze the industry by applying Porters Five Forces.
Discuss edgar allan poe writes short story fiction of horror : Discuss Edgar Allan Poe writes short story fiction of horror and death and Story takes place in the 13th century between 1486-1492.
What is the current state of voip : What is the current state of VoIP and it's impact on PTSN and cellular systems?
Switch statement and depending : Use a switch statement and depending on what the random number is, print out a message. For example, if the random number
Write essay about something interesting pertaining to it : Pick your favorite cereal and write a short essay about something interesting pertaining to it. Dont just regurgitate information
Building a gui interface for a simple calculator : This assignment involves building a GUI interface for a simple calculator using Java FX. The calculator shall be designed to allow the user
Is it ever justifiable to influence a client''s set of values : How do you determine when a conflict between your values and those of your client necessitates a referral to another professional
How will you utilize the techniques to polish stance essay : How to revise, edit, and proofread, what would you tell him or her to do? How will you utilize these techniques to polish your Stance Essay before submitting?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identify the career goals for which you are preparing

Identify the career goals for which you are preparing. Describe the most likely ways in which technological developments will affect those career goals, in both the short- and long-term future.

  Determine the greatest load it can pull

The coefficient of static friction between the wheels and the ground is , and between the crate and the ground, it is μ's = 0.4.

  Development of applications in a clustered environment

What advantage does the aggregate data model offer for development of applications in a clustered environment? How does aggregate orientation (i.e., the aggregate data model compare to the relational model? How do NoSQL databases differ from the rela..

  Show the packet and enter a value for each field

An IPv6 packet consists of the base header and a TCP segment. The length of data is 320 bytes. Show the packet and enter a value for each field.

  Write a create table statement for the department table

Explain the meaning of the following expression: IDENTITY (4000, 5).

  Boundless resource of information

The World Wide Web is a boundless resource of information. It contains blogs, tutorials, demos, videos, text, references, and resources

  Describe a communication matrix and its function

Describe the differences between communications in an existing organization compared with a new project.

  What is player 1 maximin strategy

Does Player 1 have a dominant strategy, and if so what is it? Does Player 2 have a dominant strategy and if so what is it?

  Describes the ideal information security system

Write a 1500 to 1750 word paper that describes the ideal information security system plan for one of the following organization types: hospital, bank, manufacturer, online wholesale enterprise, department store, state revenue agency.

  Hedge for risk management purposes

What is a leveraged foreign exchange contract and why may it not be regarded as a hedge for risk management purposes?

  Company logo executive summary table of content

Group Portion Think of a business you would like to start. (I prefer Business name to be "World pre-owned Producers, Inc." Develop a business plan for your new business. The 4-6 page business plan must include the following: Company Logo Executive Su..

  Believe the benefits would be

Do you believe an organization should report time in this manner?If so, what do you believe the benefits would be? (Word count range 500)

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd