Provide details on what you need help with along with a budget and time limit. Questions are posted anonymously and can be made 100% private.
Match with a Tutor
Studypool matches you to the best tutor to help you with your question. Our tutors are highly qualified and vetted.
Get Quality Help
Your matched tutor provides personalized help according to your question details. Payment is made only after you have completed your 1-on-1 session and are satisfied with your session.
COSC 111 Assignment 6
1) Summation of Integers – using functions
In assignment 5, you were asked to verify the three formulae shown below:
a. summation from 1 to N inclusive (N > 1)
b. summation from N1 to N2 inclusive (N1, N2 > 1 and Ni < N2)
c. summation from N1 to N2 exclusive (N1, N2 > 1 and Ni < N2)
For this assignment, you will modify the work done in Assignment 5. Write ONE program that
does the following:
i.
ii.
iii.
Places each of the summation formula in its own function.. (You can choose one method,
- loops or formula - to define your function. You do not have to use both!)
Gives the user the option of selecting one of the three summation methods.
methods
Calls the appropriate function when the choice is made
made.
Don’t forget to include user validation! Also, be sure to give the user the option of repeating the
entire program, so that they can select another method if needed.
Extra Credit
1) For your final extra credit, you will create a magic 8 ball. A magic 8 ball is a novelty toy that is
designed to answer a simple ‘yes’ or ‘no’ question - i.e. a question for which a typical response
would be ‘yes’ or ‘no’.
Examples of such questions could be:
Will I win the lottery?
Am I going to pass this class?
Will the Oakland Raiders make it to the playoffs?
Your magic 8 ball will consist of 20 (yes, twenty) possible responses. (10 are positive, 5 are
neutral and 5 are negative.) Here are the responses:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
It is certain
It is decidedly so
Without a doubt
Yes, definitely
You may rely on it
As I see it, yes
Most likely
Outlook good
Yes
Signs point to yes
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
Reply hazy, try again
Ask again later
Better not tell you now
Cannot predict now
Concentrate and ask again
Don’t count on it
My reply is no
My sources say no
Outlook not so good
Very doubtful
Write a program that prompts the user to ask a simple yes/no question. Assign the responses
above to a number between 1 and 20 (you can adjust the order if you want) and use a random
number generator to select a number. Then, output the response corresponding to that number
– NOT the number itself.
e.g. if the user asks “Will I pass this class” the number generated is 8, output the response
“Outlook good.”
Your code should have at least one function that performs the tasks of the 8 ball – i.e. selecting
the number and outputting a response. You may use void or value returning functions as you
wish. As always, give the user the option to ask the magic 8 ball another question. Have fun!
Purchase answer to see full
attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Would you like to help your fellow students? Are you in need of an additional source of income? Apply to become a tutor on Studypool! Our best tutors earn over $7,500 each month!