This is java problem: Write a program that simulates tossing a coin. Prompt the user for how many times to toss the coin. Code a method with no parameters that randomly returns either the String "heads"or the string "tails". Call this method in main as many times as requested and report the results. See Example outputs below. Example Outputs How many times should I toss the coin? 1000 Results of 1000 tosses. Heads: 483, tails: 517 How many times should I toss the coin? 1000000 Results of 1000000 tosses. Heads: 500074, tails: 499926   Required Textbook: Introduction to Java Programming and Data Structures, Comprehensive Version, Edition: 11th Author: Y. Daniel Liang Publisher: Pearson ISBN: 9780134670942

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 15PE
icon
Related questions
Question
100%

This is java problem:

Write a program that simulates tossing a coin. Prompt the user for how many times to toss the coin. Code a method with no parameters that randomly returns either the String "heads"or the string "tails". Call this method in main as many times as requested and report the results. See Example outputs below.

Example Outputs

How many times should I toss the coin? 1000
Results of 1000 tosses.
Heads: 483, tails: 517

How many times should I toss the coin? 1000000
Results of 1000000 tosses.
Heads: 500074, tails: 499926
 

Required Textbook: Introduction to Java Programming and Data Structures, Comprehensive Version, Edition: 11th

Author: Y. Daniel Liang

Publisher: Pearson

ISBN: 9780134670942

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning