subject

Flip a coin write a program that simulates flipping a coin to make decisions. the input is how many decisions are needed, and the output is either heads or tails. assume the input is a value greater than 0. ex: if the input is: 3 the output is: tails heads tails for reproducibility needed for auto-grading, seed the program with a value of 2. in a real program, you would seed with the current time. in that case, every program's output would be different, which is what is desired but can't be auto-graded. note: a common student mistake is to create an instance of random before each call to rand. but seeding should only be done once, at the start of the program, after which rand. nextint() can be called any number of times. your program must define and call the following method that returns "heads" or "tails". public static string headsortails(random rand).

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:40
Program using c++ only on visual studio pig is a simple two player dice game, played with one die. the first player to reach or surpass 50 is the winner. each player takes a turn rolling the dice. they add to the pot with each roll, having to decide to roll again and increase the pot, or cash out. the risk being they could lose the amount they’ve accumulated into the pot. the rules for each player’s die roll. 1. roll the dice. a. if user rolled a 1, i. the pot gets set to zero ii. the other player goes to step 1. b. a roll of 2-6 is added to the pot. 2. user can choose to hold or roll again. a. choice roll. return to step 1. b. choice hold. i. increment player score by the pot amount. ii. pot gets set to 0. iii. second player gets to roll and goes to step 1. program requirements: ● before each opponent begins ○ output the score for the person and the computer. ○ output the opponents whose turn is beginning and ask the user to hit enter to continue. ● with each dice roll. ○ output the die value, and amount of the round pot. ○ if it’s the users roll ask if they want to roll again ( r ) or hold ( h ). your program should allow r, r, h or h as valid input. if input is anything else, ask the user again until valid input is obtained. ○ the ai will continue playing until the round pot is 20 or more. ● once a player’s score is greater or equal to 50 then they have won, it will no longer ask if they want to keep rolling the die or not. ● once there is a winner ○ score totals are output along with who the winner was. user or computer ○ player is asked if they want to play again y or n. valid input should be y, y, or n, n. ● when a new game starts the starting roll goes to the player that did not roll last. if the user rolled last in the previous game, then the computer rolls first and vice versa. when the program first begins, the player will make the first roll of the first game. development notes : ● you will need a way to roll dice in your program. the rand() function works well, but returns an integer. if we want numbers 0 – 9 we can get the value modulus 10. ● call srand() with a value to seed it. it’s common to seed it with the current computer clock, include ctime, and then call srand(time(
Answers: 1
question
Computers and Technology, 22.06.2019 14:40
For this assignment you have to write a c program that will take an infix expression as input and display the postfix expression of the input. after converting to the postfix expression, the program should evaluate the expression from the postfix and display the result. what should you submit? write all the code in a single file and upload the .c file. compliance with rules: ucf golden rules apply towards this assignment and submission. assignment rules mentioned in syllabus, are also applied in this submission. the ta and instructor can call any students for explaining any part of the code in order to better assess your authorship and for further clarification if needed. problem: we as humans write math expression in infix notation, e.g. 5 + 2 (the operators are written in-between the operands). in computer's language, however, it is preferred to have the operators on the right side of the operands, ie. 5 2 +. for more complex expressions that include parenthesis and multiple operators, a compiler has to convert the expression into postfix first and then evaluate the resulting postfix write a program that takes an "infix" expression as input, uses stacks to convert it into postfix expression, and finally evaluates it. it must support the following operations: + - / * ^ % ( example infix expression: (7-3)/(2+2) postfix expression: 7 3 2 2 result: rubric: 1) if code does not compile in eustis server: 0. 2) checking the balance of the parenthesis: 2 points 3) incorrect postfix expression per test case: -2 points 4) correct postfix but incorrect evaluation per test case: -i points 5) handling single digit inputs: maximum 11 points 6) handling two-digit inputs: 100 percent (if pass all test cases)
Answers: 3
question
Computers and Technology, 22.06.2019 20:50
What is the difference between windows 7 and windows 10?
Answers: 1
question
Computers and Technology, 23.06.2019 04:40
The narrative structure of the popular movies can be broken down into
Answers: 3
You know the right answer?
Flip a coin write a program that simulates flipping a coin to make decisions. the input is how many...
Questions
question
Mathematics, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
History, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
Geography, 10.09.2020 21:01
question
English, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
World Languages, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
French, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
question
Mathematics, 10.09.2020 21:01
Questions on the website: 13722360