Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Coin Toss Simulator Write a class named Coin. The Coin class should have the following member variable: A string named sideUp. The sideUp member variable

Coin Toss Simulator

Write a class named Coin. The Coin class should have the following member variable:

A string named sideUp. The sideUp member variable will hold either heads or tails indicating the side of the coin that is facing up.

The Coin class should have the following member functions:

A default constructor that randomly determines the side of the coin that is facing up (heads or tails) and initializes the sideUpmember variable accordingly.

A void member function named toss that simulates the tossing of the coin. When the tossmember function is called, it randomly determines the side of the coin that is facing up (heads or tails) and sets the sideUp member variable accordingly.

A member function named getSideUp that returns the value of the sideUp member variable.

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago