Write a function named coinToss that simulates the tossing of a coin. When you call the function, it should generate a random number in the range of 1 through 2. If the random number is 1, the function should display "heads". If the random number is 2, the function should display "tails". Demonstrate the function in a program that sks the user how many times the coin should be tossed and the coin then simulates the tossing of the coin that number of times.
Q: Q.5 Explain need for regularization techniques in Generalized Linear Models (GLM).
A: To comprehend the need for regularization techniques in Generalized Linear Models (GLM), one must…
Q: What is the value of result when the following code executes? int result = 0; for(int i=1; i <= 5;…
A: Here is the value of the result when we execute the following code. See below steps.
Q: a) If A E B and B E C, then A E C. b) If (ANC)= (Bn C), then A= B.
A:
Q: Ruby on Rails Describe each of the three major relationships in a relational database management…
A: Ruby on rails:- A framework for server-side web applications, known as Ruby on Rails, was written in…
Q: Convert the given code fragment to assembly code fragment, using only instructions of the…
A: Answer: The given code is if((X + Y ) > 0) X = X + X; L: The assembly code is given below:…
Q: Explain the role of machine learning algorithms in Natural Language processing.
A: Natural Language Processing (NLP) is a subfield of Artificial Intelligence (AI). It helps machines…
Q: 0.21 Explain Initial permutation steps in DES.
A:
Q: If these bytes hold a 16-bit two's complement integer, what is its actual decimal value if: 1. a)…
A: The answer is
Q: Select all of statements that are logically equivalent to the statment: if Xavier xylographed then…
A: Logical equivalence: The conditional statement is logically equivalent to its contrapositive…
Q: Implement an algorithm to delete a node in the middle (i.e., any node but the first and last node,…
A: Solution: Given, Implement an algorithm to delete a node in the middle (i.e., any node butthe…
Q: Given a sorted array of strings that is interspersed with empty strings, write a method to find the…
A: Considering this example: Input: searching ball in : {"at", "", "", "", "ball", "", "", "car", "",…
Q: In each iteration of a loop, generate a random number, and use it to determine some attribute of…
A: In this question, it is asked to generate a random number and use it as an attribute for drawing a…
Q: What is block cipher? Explain counter mode block cipher.
A: Block ciphers encrypt data in blocks using an algorithm and cryptographic key to produce ciphertext.…
Q: Use Play fair cipher to encrypt the followin message "This is a columnar transposition." Us key…
A: Use Play fair cipher to encrypt the following message "This is a columnar transposition." Use key…
Q: Can you make it more efficient and paraphrase it in Java import java.lang.Math; import…
A: In this question, it is asked to improve a given java code. For improvements, better comments are…
Q: Implement program to adds methods to search a linked list for a data item with a specified key…
A: Pointers to the following and preceding nodes in the linked list are included in each node. The…
Q: x86 Assembly Language Programming What will be the final value in EDX after this code executes? mov…
A: In computer programming, assembly language, often referred to simply as Assembly and commonly…
Q: ? countdown ♡ Java for loops Language/Type: Author: Brenden West Complete a for loop to produce the…
A: Java program to solve the given problem is below.
Q: Write a C program to read two floating point numbers T and F from the console and find the value of…
A: Here is the c program of the above problem. See below steps.
Q: The program below reads two integers x and y from the user. Assume the user enters valid integers…
A: Required language is C:
Q: Part 3: Random class • Use the Random class to generate and print three random integers between 1…
A:
Q: Question 1 Draw FSM for a Moore machine with one input and one output, having the property…
A: Moore machine is a finite state machine in which the next state of the FSM is decided by the current…
Q: What are the potential benefits of conducting a project postmortem? What behaviors or conditions do…
A: Answer:- Potential benefits of conducting a project post-mortem- It gives the project team a chance…
Q: 6. Please use the "shared folder" option within VirtualBox and successfully transfer a file. Please…
A: VirtualBox:- An open-source virtualization programme is Oracle VM VirtualBox. It enables users to…
Q: Write a static method called removeMatches that removes extra copies of a value that are adjacent to…
A: Here, the JAVA code is as follows: CODE: import java.util.ArrayList;import java.util.List;import…
Q: Given the following adjacency list representation of an undirected graph, give the visited node…
A: Solution- Above is the code that helps to print the traversal DFS of adjacent vertex starting from…
Q: Think of a classification problem from your own experience and interest (e.g., distinguishing…
A: The program is written in Python. Check the program screenshot for the correct indentation. Please…
Q: I have one more thing about this what about Pseudocode?
A: Pseudocode is a representation of code that even a layperson with basic programming knowledge can…
Q: a) Write a FORTRAN subroutine named "count" which receives an integer array, where the values are…
A: ANSWER:-
Q: QUESTION 2 According to James Rachels, we hide or do not reveal certain aspects of our lives to…
A: Given: According to James Rachels, we hide or do not reveal certain aspects of our lives to…
Q: Part 4: Enumerated Types • Declare a variable of the enumerated type DayOfWeek and assign the value…
A: The given below program is in java.
Q: Create a java program to compute the area and perimeter of a rectangle given the length and width…
A: Introduction: A two-dimensional shape's perimeter is the path that encircles it. Greek words peri…
Q: Write a Python program to solve the following problem: use built in function to calculate the square…
A: Here is the python program of the problem. See below steps for code and output.
Q: Explain Event-based Modeling and Analysis of Multimedia Streams - A General Framework
A: Event-based Modeling and Analysis of Multimedia Streams - A General Framework:-
Q: Complete the following Windows PowerShell cmdlet to test TCP connectivity with secure HTTP
A: This is very simple. The solution provided previously is Incomplete. Here I have provided the…
Q: he Hack assembler is a two-pass assembler. Explain why there is a need for going twice over the…
A: Assemblers translate programmes written in low-level languages into machine code. It detects errors…
Q: You are working on problem set: HW2-loops (Pause) variableScope ♡ Language/Type: Java expressions…
A: The variable count is declared inside the method performTest. So this can be accessible in…
Q: Explain in detail the DHCP and the NAT?
A: Computer Networking: Interconnected computing devices that may share resources and exchange data are…
Q: Background The Collatz conjecture (also known as the "3n+1 conjecture") is a conjecture in…
A: Required language is python:
Q: Fix this program so it compiles and produces the expected output. Note: the fix required is not…
A: The working code has been provided in step 2.
Q: What problems are faced by SVM when used with real datasets?
A:
Q: What is the decimal value of register S0 after executing the following code? Consider that the value…
A: and is used to find the bitwise and Convert 5 to binary - Divide 5 by 2 ,Quotient 2 ,Remainder 1…
Q: Exercise 6. A binary tree T has height 8. (Recall that the height of a tree is the number of edges…
A: (a) The minimum number of nodes in a binary tree of height h is h + 1. Here, the binary tree T has a…
Q: The exercise is to input a string from the user, and then output the following information: • Length…
A: F# which refers to the functional-first, general purpose, strongly typed, multi-paradigm programming…
Q: Q.9 Explain in detail Content Based Systems.
A: We have to explain Content-Based Systems.
Q: Consider the hypothesis space defined over instances shown below, we characterize eac hypothesis…
A: Answers:- 1st step:- the formulas - Entropy (class) =-P/P+Nlog2(P/P+N)-N/P+N log2(N/P+N) for each…
Q: Required screen Layout/output: This program will convert inputted integer number into its equivalent…
A: Create a Java program to input integer from 1 to 9,999 (Range) and to output the inputtednumber in…
Q: Your friend asks you what you ate for breakfast yesterday morning. Describe how you might search and…
A: Answer: There are various methods by which we might recall, acknowledge, and relearn our priceless…
Q: binary exponentiation calculate, manually 1551 01 mod 311
A: Here in this question we have given a equation and we have asked to calculate manually using binary…
Q: this loop using a single line of vectorized code.
A: Given :- In the above given question, a code fragment is mention in the above given question Need…
Coin Toss
Write a function named coinToss that simulates the tossing of a coin. When you call the function, it should generate a random number in the range of 1 through 2. If the random number is 1, the function should display "heads". If the random number is 2, the function should display "tails". Demonstrate the function in a program that sks the user how many times the coin should be tossed and the coin then simulates the tossing of the coin that number of times.
Step by step
Solved in 4 steps with 2 images
- (Simulation) Write a program to simulate the roll of two dice. If the total of the two dice is 7 or 11, you win; otherwise, you lose. Embellish this program as much as you like, with betting, different odds, different combinations for win or lose, stopping play when you have no money left or reach the house limit, displaying the dice, and so forth. (Hint: Calculate the dots showing on each die with the expression dots=(int)(6.0randomnumber+1), where the random number is between 0 and 1.)Domino's Time Function Name: dominosTime() Parameters: N/A Returns: None Description: During the summer, you ordered a lot of food from Domino's. Pizzas are $12, an order of pasta is $6, and chicken wings are $8. Write a function that asks the user how many of each food item they would like, and then print a response telling them what their order to- tal will be. The order total should be an integer. >>> dominosTime() How many pizzas do you want? 3 How many orders of pasta do you want? 2 How many orders of chicken wings do you want? 2 By ordering 3 pizzas, 2 orders of pasta, and 2 orders of chicken wings, your order total comes to $64.Problem: A small company needs an interactive program to compute an employee’s paycheck. The payroll clerk will initially input the data, and given the input data, an employee's wage for the week should be displayed on the screen for the payroll check. The data for the employee includes the employee's hourly pay rate and the number of hours worked that week. Wage is equal to the employee's pay rate times the number of hours worked (up to 40 hours). If the employee worked more than 40 hours, wage is equal to the employee's pay rate times 40 hours plus 1½ times the employee's pay rate times the number of hours worked above 40. Instructions: Match the action at the left-side with the correct step number at the right-side (the attached picture). Note that it may be possible to group more than one related actions in the same logical step / process without altering the essence of the algorithm. In the program flow, input and checking of hourly pay rate should come before that of the number…
- C++ Visual 2019 A particular talent competition has five judges, each of whom awards a score between 0 and 10 to each performer. Fractional scores, such as 8.3, are allowed. A performer's final score is determined by dropping the highest and lowest score received, then averaging the three remaining scores. Write a program that uses this method to calculate a contestant's score. It should include the following functions: void getJudgeData() should ask the user for a judge's score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of the five judges. void calcScore() should calculate and display the average of the three scores that remain after dropping the highest and lowest scores the performer received. This function should be called just once by main and should be passed the five scores. The last two functions, described below, should be called by calcScore, which uses the returned information to determine which of the…Use C Language Airline Reservation System A small airline has just purchased a computer for its new automated reservations system. The president has asked you to program the new system. You are to write a program to assign seats on each flight of the airline's only plane (capacity: 10 seats). Your program should display the following menu of alternatives: Please type 1 for "first class" Please type 2 for "economy" If the person types 1, then your program should assign a seat in the first class section (seats 1-5). If the person types 2, then your program should assign a seat in the economy section (seats 6-10). Your program should then print a boarding pass indicating the person's seat number and whether it is in the first class or economy section of the plane. Use a single-subscripted array to represent the seating chart of the plane. Initialize all the elements of the array to 0 to indicate that all seats are empty. As each seat is assigned, set the corresponding elements of…Microwaves / Radio Waves If a scientist knows the wavelength of an electromagnetic wave she can determine what type of radiation it is. Write a program that asks for the wavelength in meters of an electromagnetic wave and then displays what that wave is according to the following chart. (For example, a wave with a wavelength of 1E-10 meters would be an X-ray.) 1x 10-11 1 x 10-8 4 x 10-7 7x 10-7 1x 10-3 1 x 10-2 Gamma Rays. X Rays Ultraviolet Visible Light Infrared
- 1. Write a program that lets the user guess whether a randomly generated integer would be even or odd. The program randomly generates an integer and divides it by 2. The integer is even if the remainder is 0, otherwise odd. The program prompts the user to enter a guess and reports whether the guess is correct or incorrect.Lowest Score Drop Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: void getScore() should ask the user for a test score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of the five scores to be entered. void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores. int findLowest() should find and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop. Input Validation: Do not accept test scores lower than 0 or higher than 100.Using C# in Microsoft Visual Studio create an application that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows:1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Do not display the computer’s choice yet.)2. The user selects his or her choice of rock, paper, or scissors. To get this input you can use Button controls, or clickable PictureBox controls displaying some of the artwork that you will find in the student sample files.3. The computer’s choice is displayed.4. A winner is selected according to the following rules:• If one player chooses rock and the other player chooses scissors, then rock wins. (Rock smashes scissors.)• If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors…
- LISP Function help please LISP Programming only A function that generates a random day of the week, then displays a message saying that "Today is ... and tomorrow will be ...". Then use the built-in function random first to generate a number between 0 and 6 (including). The expression (random) by itself generates a random integer. You can call it with one parameter to return a value within the range from 0 to the value of the parameter-1. For example, (random 10) will return a value between 0 and 9. Next, use the number generated at the previous step to retrieve the symbol for the day of the week from the list. Use the built-in elt. Extract the symbol-name of the day first, then apply the built-in function capitalize to it. Use the result in the princ function call, and do the same thing for the next day. Make the function return true (t) instead of the last thing it evaluates, to avoid seeing the message printed more than once.printTodaysDate is a function that accepts no parameters and returns no value. Write a statement that calls printTodaysDate.Computer Fundamentals and Programming 2 Write a program that determines a student’s grade. The program will accept 3 scores and computes the average score. Determine the grade based on the following rules: - If the average score is equal or greater than 90, the grade is A. - If the average score is greater than or equal to 70 and less than 90, the grade is B. - If the average score is greater than or equal to 50 and less than 70, the grade is C. - If the average score is less than 50, the grade is F. Source Codes and Print Screen of the Output