Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 6a-Functions (Compatibility Mode] ferences Mailings Review View 1Heading 2 Non Lab 6- Functions I Objectives Make use of multiple Functions . Use menus to

image text in transcribed
image text in transcribed
image text in transcribed
Lab 6a-Functions (Compatibility Mode] ferences Mailings Review View 1Heading 2 Non Lab 6- Functions I Objectives Make use of multiple Functions . Use menus to select different Functions Instructions: Main Program Design your main program so that it has a while loop that will run until the user chooses to exit Inside this loop, you will also need to prompt the user to ask the user which function he/she would like to run. Use a switch statement to call the functions. This will be very similar to the menu and code that was created inmLab 4 (calculator) or it is repeated at the end of this lab. Nu For the prime number function, have the method print out all primes up to a value n, which will be input from the keyboard by the user. You should ask for n inside of the main function and then pass it into the prime number method function. Ex: n-12 would print 2, 3, 5, 7, 11 You will receive EXTRA CREDIT (-5) if the prime number method prints n number of prime numbers rather than prime numbers up to a value n. Ex:n - 12 would print 2, 3,5,7, 11, 13, 17, 19, 23, 29, 31, 37 For this function, you will be simulating a coin toss. However, you will not be doing just any coin toss. The coin you will be 'simulating' will be weighted such that it will land on heads 60 percent of the time. Thus meaning the coin will land on tails only 40 percent of the time. In main, you need to have the user input the number of coin tosses he/she wishes to sure the method prints out ) The total number of times the coin landed on heads. 2) The total mumber of times the coin perform. Make landed on tails. 3) The percentage of the time the coin landed on heads. Even or Odd: in this fanction, you have one parameter, an integer. You need to be able to determine if the number is even or odd. Print out the appeopriate message. Hint: what operator (+-. %) would be helpful here? 0 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

More Books

Students also viewed these Databases questions

Question

Define marketing.

Answered: 1 week ago

Question

What are the traditional marketing concepts? Explain.

Answered: 1 week ago

Question

Define Conventional Marketing.

Answered: 1 week ago

Question

Define Synchro Marketing.

Answered: 1 week ago

Question

Define marketing concepts.

Answered: 1 week ago