6.23 C++ Define a function named CoinFlip that returns "Heads" or "Tails" according to a random value 1 or 0. Assume the value 1 represents "Heads" and 0 represents "Tails". Then, write a main program that reads the desired number of coin flips as an input, calls function CoinFlip() repeatedly according to the number of coin flips, and outputs the results. Assume the input is a value greater than 0. Hint: Use the modulo operator (%) to limit the random integers to 0 and 1. Ex: If the random seed value is 2 and the input is: 3 the output is: Tails Heads Tails
Q: The Horse table has the following columns: ID - integer, auto increment, primary key RegisteredName…
A: As per the given information, we need to write an SQL query to insert the provided data into the…
Q: Draw a complete flowchart handwirtten for the following problem. Do part a and part b. 1-…
A: 1. Start:2. Initializе Array A[ ]:A = {21, 32, 43, 54}3. Display Array A[ ]:Display A4. End
Q: Design a Read Only Memory (ROM) to implement the following, A097803, polynomial A=3(2x2 +1), with…
A: To show the final ROM layout using LogiSim, you can use a ROM component and input the binary…
Q: 4.19 C++ Write a program that takes in a line of text as input, and outputs that line of text in…
A: Algorithm:Initialize an empty string variable input to store user input.Enter an infinite…
Q: HTML/CSS: Below is the code and I need help in making sure the toggle switch along with the title at…
A: You can adjust the CSS a little bit to align the toggle switch and title at the top of the button in…
Q: ick a website of your choice to evaluate the website usability using Nielsen heuristics.
A: In this question we have to understand about any one webiste to evaluate the website usability using…
Q: I need help writing pseudcode and a flow chart for my python. # Define the quiz function def…
A: In this question we have to understand about the given code and wirte its pseudocode with…
Q: Given N cities represented as vertices V₁, V2,..., UN on an undirected graph (i.e., each edge can be…
A: In a weighted graph, where the cost of each path is determined by the sum of the edge weights, the…
Q: ok thank you, how would I use the code from the follow up to make a makfile, is it possible to do…
A: A Makefile is a configuration file used for building and managing projects. It contains rules and…
Q: Choosing The Right Security Framework For Your Organization The many challenges related to building…
A: Security Risk Analysis emerges as a pivotal process in ensuring the robustness of an information…
Q: local art online support system usecases and features
A: A Local Art Online Support System is designed to provide a digital platform for local artists, art…
Q: Write a program that initializes an array with ten numbers (given below). Then let the player enter…
A: Algorithm for each of the search methods.1### Linear Search Algorithm: 2 31. Input: Array `arr` of…
Q: SAMPLE OUTPUT: Enter no. of views for - YouTuber 1: 987 YouTuber 2: 1010 YouTuber 3: 3217 YouTuber…
A: Create an array to store views for each YouTuber.Prompt the user to input the number of views for…
Q: Let = {0, 1} and consider the following languages 1. LBOUNDED = {(M, x) : M is a TM, x € Σ*, M never…
A: The question revolves around two language classes defined for Turing machines, denoted as LBOUNDED…
Q: 7. Create timestamp decorator. Instructions: • Create a file named log.py and create decorator…
A: log.pyStep-1: Start Step-2: Import timeStep-3: Define function timestamp(func) Step-3.1: Define…
Q: using the code below write a query to display the movie title, movie genre, price description, and…
A: Select Columns: Choose the columns to be displayed: MOVIE_TITLE, MOVIE_GENRE, PRICE_DESCRIPTION, and…
Q: Watch the Think Media video “How a Car is built,” which details the production process for the…
A: Following are the snaps of the youtube videos:As a result, Ford Motor Company is known to be…
Q: How does rasterization differ from other rendering techniques such as ray tracing?
A: The objective of this question is to understand the differences between rasterization and ray…
Q: 4.2-1a. Packet scheduling (FCFS). Consider the pattern of red and green packet arrivals to a…
A: FCFS schedulingFCFS, or first come, first served, is an acronym. This means that packets will be…
Q: Problem 6: Describe how to augment a skip list that supports the operation Select(S, k), which finds…
A: Select operation contains two values that are S and k. It finds the other largest element in the…
Q: 1. Lexactly_one = {(M, x) : M is a TM, ï ¤ Σ*, L(M) = {x}} {{M,x): M is a TM, ¤ ¤ £†, |L(M)| ≤…
A: In the computer science, the study of languages recognized by Turing Machines provides a profound…
Q: where did you get 8.192*10^6??
A: The maximum transfer rate of a hard drive can be calculated using the following formula:
Q: (a) What is the process in steps of Email Server forensic examination (b) What are 6 challenges in…
A: In this question we have to understand about the process in steps of Email Server forensic…
Q: Using C Programming: Each student in the university may take a different number of courses, so the…
A: Start.Define structures for Course and Student.Initialize arrays of Student structures (students)…
Q: Using comments within the code itself, can you provide an line by line explanation of the below…
A: The JavaScript API known as WebGL, or Web Graphics Library, makes it possible to render 2D and 3D…
Q: The correct statements are: ADTM M must halt. A DTM M must halt for € € L(M). ANDTM M must halt.…
A: Alan Turing created a mathematical model of computation known as a Deterministic Turing Machine…
Q: The correct statements are: To encode the union operation into a language recognition problem, we…
A: The heart of theoretical computer science is the interaction of formal languages, decision problems,…
Q: 6.22 C++ Define a function named SwapValues that takes four integers as parameters and swaps the…
A: The task is to write a program in C++ that swaps the positions of two pairs of numbers. The program…
Q: a) Identify the two memory management defects in the code. Point out the line numbers where the…
A: In this question we have to understand about given code snippet in C++ and answer for the following…
Q: Instructions(C++) Write a program that reads a file consisting of students’ test scores in the range…
A: This code reads scores from "scores.txt".Categorizes them into ranges (0-24, 25-49, etc.), and…
Q: user story: place order as a new customer, i want to place a coffee order using the web application,…
A: Title: Coffee Ordering Algorithm1. Start2. User Login: - Display login page. - Take user…
Q: 2. Consider the following multi-step implementation level description of a Turing machine with input…
A: In this question we have to understand about Turing machine named Alice and its language…
Q: An ordinary ruler is a straight piece of wood where distances 0, 1, 2 . . . , N are marked, for some…
A: Algorithm:Return the last element of the input list (myruler), representing the reach of the…
Q: Consider the following network diagram: AS1 ja 1b 1c AS2 2b AS1, AS3,X 2a 152 201 263 112 AS3 3a…
A: BGP stands for Boarder Gateway Protocol and there are two types of BGP that are iBGP (internal BGP)…
Q: Give an example of the criteria you would use to determine whether a document management system…
A: A document management system is a software platform that organizations and institutions use to…
Q: Given the following FSM M, the correct statements are: aaabbbaba is in L(M). baaabaaa is in L(M).…
A: Finite State Machine(FSM) is a computation model with fixed number of states, transitions between…
Q: create an Enhanced Entity-Relationship (EER) diagram based on the provided information. Based on the…
A: The entities listed are:PersonVisitCare CentreLaboratoryBedItemTreatment
Q: Part 1a: Generate a random 4 by 4 matrix using https://onlinemathtools.com/generate-random-matrix.…
A: As per our guidelines, we are supposed to answer only 1st three parts. Kindly repost the remaining…
Q: 1. Making the arrangements. My garden features a number of flower beds. As a person of particular…
A: Alfie's Greedy Approach: Alfie's proposed greedy approach for the LOVELY-FLOWERBED problem involves…
Q: Problem 1. This problem is about the semantics and use of semaphores, as described in your textbook.…
A: The term "semantics" refers to the meaning and interpretation of semaphore operations within the…
Q: I need help with my MATLAB code. I have t =…
A: 1. % Define Time Vector: - Create a time vector (t) using the datetime function, ranging from the…
Q: Question 42 The correct statements are: If L₁ is reducible to L₂ and L₂ is not in D, then L₁ cannot…
A: In the intricate realm of theoretical computer science, the concept of reducibility unveils deep…
Q: Explain in a clear and concise manner, why a compressed file is bad for Steganography.
A: The objective of the question is to understand why compressed files are not ideal for steganography.…
Q: In the Barney-Jones investment model, we ran invest- ments across columns and years down rows. Many…
A: An investment model is a structure or series of principles used by investors to make decisions on…
Q: The correct statements are: Diagonalization can be used to prove a set is countable. Diagonalization…
A: Option A) Diagonalization can be used to prove a set is uncountable.
Q: 1. Convert the following Mealy machine into a corresponding Moore machine 90 1/0 0/0 1/1 q2 1/0 0/0…
A: Mealy machine and Moore machine, both are finite-state machines. In mealy machine, the output value…
Q: A Golomb ruler is a sparse ruler, where the pairs of marks all measure different distances. For…
A: Algorithm:Define a function ismyrulergolomb that takes a sparse ruler as input.Find the reach of the…
Q: Given a sorted list of integers, output the middle integer. A negative number indicates the end of…
A: The provided task requires writing a program to find and output the middle integer from a sorted…
Q: Inform if the following statement is TRUE or FALSE. The defender has control over the system, which…
A: An organization, person, or team in charge of guarding a system, network, or information assets from…
Q: In python I am suppse to Design the logic and write the rest of the program using a nested if…
A: The objective of the question is to correct the Python code that calculates the bonus of an employee…
6.23 C++
Define a function named CoinFlip that returns "Heads" or "Tails" according to a random value 1 or 0. Assume the value 1 represents "Heads" and 0 represents "Tails". Then, write a main program that reads the desired number of coin flips as an input, calls function CoinFlip() repeatedly according to the number of coin flips, and outputs the results. Assume the input is a value greater than 0.
Hint: Use the modulo operator (%) to limit the random integers to 0 and 1.
Ex: If the random seed value is 2 and the input is:
3
the output is:
Tails Heads Tails
Step by step
Solved in 4 steps with 4 images
- C++ code please (2) Implement a PrintMenu() function, which has a string as a parameter, outputs a menu of user options for analyzing/editing the string, and returns the user's entered menu option. Each option is represented by a single character. If an invalid character is entered, continue to prompt for a valid choice. Hint: Implement Quit before implementing other options. Call PrintMenu() in the main() function. Continue to call PrintMenu() until the user enters q to Quit. Ex: MENU c - Number of non-whitespace characters w - Number of words f - Find text r - Replace all !'s s - Shorten spaces q - Quit Choose an option:Python Programming- Computer-Assisted Instruction Part 1: Computer-Assisted Instruction (CAI) refers to the use of computers in education. Write a script to help an elementary school student learn multiplication. Create a function that randomly generates and returns a tuple of two positive one-digit integers. Use that function's result in your script to prompt the user with a question, such as: How much is 6 times 7? For a correct answer, display the message "Very good!" and ask another multiplication question. For an incorrect answer, display the message "No. Please try again." and let the student try the same question repeatedly until the student finally gets it right. Part 2: Varying the computer's responses can help hold the student's attention. Modify the program so that various comments are displayed for each answer. Possible responses to a correct answer should include 'Very good!' , 'Nice work!' and 'Keep up the good work!' Possible responses to an incorrect answer shojld…***in python only*** use turtle function Define the concentricCircles function such that: It draws a series of concentric circles, where the first parameter specifies the radius of the outermost circle, and the second parameter specifies the number of circles to draw. The third and fourth parameters specify an outer color and an other color, respectively. The outer color is used for the largest (i.e., outermost) circle, and then every other circle out to the edge alternates between that color and the 'other' color. The difference between the radii of subsequent circles is always the same, and this difference is also equal to the radius of the smallest circle. Put another way: the distance between the inside and outside of each ring is the same. Define concentricCircles with 4 parameters Use def to define concentricCircles with 4 parameters Use any kind of loop Within the definition of concentricCircles with 4 parameters, use any kind of loop in at least one place. Call…
- JAVA CODE PLEASE Functions With Parameters and Return Values Quiz by CodeChum Admin Create a function named oppCase that receives one character input that is an alphabet. Return the opposite case of that character. In the main function, write a program that asks for a character input and assign it to a character variable. Call the oppCase function by passing in the character variable and assign the returned value to a variable. On the next line, print the value assigned to the variable. Input 1. One line containing a character Output Enter·a·character:·A a# Write a function called ex4() which implements a "Guess the number" game# 1. Generate a random number between 1 and 100# See https://docs.python.org/3/library/random.html for random number# generation details # 1. Prompt the user with the rules of the game ('q' to quit)# 2. Iterively prompt a user for a guess# 3. Let the user know whether their last guess was high or low# 4. Count the number of guesses# 5. Congratulate them upon success. Print the number of guesses# 6. Prompt to play again or quit# 7. Proceed as directed by user.# 8. Invoke ex4() and play a game to print resultsAny help would be greatly appreciated!! If you could attached screenshots of the code that would be very helpful!! Write code for the following: Write Python code that uses a loop to prompt the user for five floating point numbers and reports the sum of the floats when the loop ends. Write Python code that defines a void function named divide that takes two numbers as parameters and then prints the quotient accurate to 1 decimal place when the first parameter is divided by the second one. A file named txt is shown on the right. Write Python code that opens this file, reads only the first two lines, and prints “Penny is 19” Penny 19 Kenny 20 Benny 21 Jenny 20
- JAVA CODE PLEASE Functions With Parameters and No Return Values Practice l by CodeChum Admin Create a function named palindrome that asks the user an integer input if called. If the number is a palindrome, print “{input} is a palindrome!”, otherwise print “{input} is not a palindrome!” In the main function, call the palindrome function. An initial code is provided for you. Just fill in the blanks. Input 1. One line containing an integer Output Enter·a·number:·121 121·is·a·palindrome!Python (this is not graded this is practice work that is not graded) write and test a function which takes two dates (month, day) list arguments.When the function is called with the two arguments, it returns the number of days betweenthose two dates. Print the returned value. It is assumed that the first date occurs first. Forinstance, if the users calls the function with FUNCTION([12, 10], [12, 20]) as arguments, thereturned value is 10 days. However, if FUNCTION([12, 20], [12, 10]) is called, the returnedvalue is -10 days.Assume February has 28 days.Test data: [10, 30], [5, 20] [1, 30], [5, 25] [5, 25], [1, 30] [1, 1], [12, 31]Exercise 5: Write a Python program that inputs five positive integer numbers, sorts them in descending order and finds the median (i.e. middle value). Each must be a distinct number (i.e. all numbers are different). Each number should be input and returned by a function named getValue(.) that receives a prompt message. A second function desSortNumbers(..) should sort numbers and display them on screen in descending order. A third function median(..) should receive five numbers as parameters and returns their median to function main(.) which then prints the median value as shown in figure 5. Please input 5 numbers: 40 20 40 5 97 Invalid input, try again Please input 5 numbers: -40 28 48 90 38 Invalid input, try again Please input 5 numbers: 19 25 7 87 54 Sorted: 7 19 25 54 87 The middle value is 25 Figure 5. Exercise 5 Sample Run Exercise 6: that converts speed miles/hour to kiľometers/hour (mph to km/h) and kilomcters/hour to miles/hour
- Write the functions with the following headers:# Return the reversal of an integer, e.g. reverse(456) returns# 654def reverse(number):# Return true if number is a palindromedef isPalindrome(number): Use the reverse function to implement isPalindrome. A number is a palindrome if its reversal is the same as itself. Write a test program that prompts the user to enter an integer and reports whether the integer is a palindrome.A triangular number is defined as m(m + 1)/2 for m = 1, 2, c , and so on. Therefore, the first few numbers are 1, 5, 12, 22, . . . . Write a function with the following header that returns a triangular number: int getTriangularNumber(int n) Write a test program that uses this function to display the first 75 triangular numbers with 5 numbers on each line.im having some trouble with this Requirements: Write a Python script that prompts the user for the length of a side of a polygon and prints a table of areas of several polygons. Sample output is shown below. Additional requirements: • Your program should use functions to organize the code. Implement these functions: - main The main function should call the function get_side_length and then send side_length to report. - get_side_length This function should prompt the user ("Input the length of a side: ") and return side_length to main as an int. - report This function should print a heading line ("side length...number of sides...area") and use a loop to print a table of values as shown in the sample output below. The report function should call polygon_area to calculate the areas needed for the table. The function report will have to call polygon_area once for each area that it needs to print. - polygon_area This function takes num_sides and side_length as parameters and returns the…