Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

RandomChars Program DESCRIPTION: Write a program that asks the user for an int and uses it as a seed for the random number generator. Then

image text in transcribedimage text in transcribed

RandomChars Program DESCRIPTION: Write a program that asks the user for an int and uses it as a seed for the random number generator. Then the program should randomly generate: an uppercase letter . a lowercase letter . a digit between D and S SPECIFICATIONS: File name: RandomChars.java The code to complete the task should be in a separate method that is called by the main method Use the ASCII table to determine numeric ranges Hint- the general format for generating a random number in a range is: rand.nextInt() + where cnumberorOptions> is the range of values (max - min + 1) and is the lowest possible number STARTER CODE: // 10/10/19 // This program asks the user for a seed for the Random number generator. It then generates a random uppercase letter, lowercase letter, and digit. import java.util.Scanner; import java.util.Random; public class RandomChars public static void main(String[] args) { makeRandoms(); // ask the user for a seed and make all the random things // this method asks the user for a seed for the random number generator and // then generates a random uppercase char, lowercase char, digit char public static void makeRandoms() INSERT YOUR CODE BELOW THIS LINE > SAMPLE OUTPUT: ======================= Enter a send toy the random number generator: RANDOM: Uppercase - S Lowercase- Coin Toss Program DESCRIPTION: In this program the computer simulates flipping a coin (O is heads and 1 is tails). The user guesses what the computer got, and the computer reports if they guessed correctly or not. SPECIFICATIONS: Name your file Coin Toss.java The starter code contains the code to randomly generate a 0 or 1 for the coin toss. You should now be able to understand this formula. Refer back to the course text if you need a refresher. Complete the given method by prompting the user for a guess. Then display what the computer got and print a message specifying if the user guessed correctly or not. You will have create a Scanner object to read input from the keyboard. Add a comment with your name, date, and program description at the top! Note: because everyone's output will differ depending on the "coin flip" generated and the number guessed, there are no test cases for this lab. Create the output as you see it below. Check it carefully to see that it's working properly. This is a good program to add some output statements as you test to see what values are randomly generated. Delete your test output before submittig. STARTER CODE: public class Coin Toss public static void main(String[] args) { headsOrTails(); // the computer simulates flipping a coin // and the user guesses the result } // In this method, the computer simulates flipping a coin. // The user guesses the result, and the computer reports if they are correct. // The computer will use 0 to represent "heads" and 1 to represent "tails" // on the coin toss public static void headsOrTails() { // computer randomly picks a number 0 or 1 int flip = (int)(Math.random()*2); INSERT YOUR CODE BELOW THIS LINE SAMPLE OUTPUT: O is heads and 1 is tails. What is your guess (O OF 1)? The computer got D

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_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Question What are the advantages of a written bonus plan?

Answered: 1 week ago