Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

will upvote For this exercise you will design and implement a function (and not just a program) that takes a single integer as an argument

will upvote
image text in transcribed
For this exercise you will design and implement a function (and not just a program) that takes a single integer as an argument and has a Boolean return value. This function should only return True if and only if the integer passed as an argument is a prime number. Prime numbers are integers strictly greater than one that can only be evenly divided (i.e., long divided without producing a remainder) by themselves and the value 1 . After you have written this function, write a program with a loop that allows the user to repeatedly input a number and receive feedback about whether or not that number is a prime number, ensuring the user always has the option to end the program. In order to complete this task, you will need to: - devise a test for "primeness" that will use a looping control structure and modulation Your submission for this exercise: - must be a source code file with filename 1 - must use a counter-controlled loop to determine if a number is prime or not - must include a prime number function with one integer argument and one Boolean return - must use the correct loop for an interface that allows the user use the function repeatedly Exercise B: "Simple Games" For this exercise you will design and implement a program (again using functions that you write yourself) that allows the user to play either "Rock-Paper-Scissors" or "Tic-Tac-Toe" (but not both) with a computer player. Both of these games can be played randomly by a computer player, but if your are feeling particularly ambitious, it isn't difficult to get an artificial Tic-Tac-Toe player to play slightly better than randomly... In order to complete this task, you will need to: - ensure you know how "Rock-Paper-Scissors" and/or "Tic-Tac-Toe" are played Your submission for this exercise: - must be a source code file with filename - must include a "main" function that is called at the end of your program - must have the remaining functionality organized into separate functions - must ensure that the user input is always a valid option for your game

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

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions

Question

What is Aufbau's rule explain with example?

Answered: 1 week ago