Question: Solve the following programming problems using object-oriented programming in Java. Provide the problem code and screenshot of the test run. COIN TOSSING: Write a program
Solve the following programming problems using object-oriented programming in Java. Provide the problem code and screenshot of the test run.
COIN TOSSING: Write a program that simulates the toss of a coin. Provide a menu of two options: toss and quit. Count the number of times each side of the coin appears and display the results after each toss. The program should have a method called flip() that is called, takes no arguments and returns a Coin enum value (HEADS or TAILS).
GUESS THE NUMBER: Write a program that plays a game of guess the number. Generate a random integer between 1 and 500. When the player inputs a number, evaluate if the number is too low or too high and let the user know. When the user guesses the number correctly, display how many tries it took for the user to correctly guess the number.
Create a method that receives the guess number as a parameter and returns true if the user guessed the number correctly and false if the user hasnt guessed the number. The evaluation of high or low should occur in the method.
You can pass the value of the randomly generated number to the method or declare it as static before the main method.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
