CoinProject

Download Category:

CoinProject.zip - (556.79 KB)
[
CoinProject/.objs/
CoinProject/.objs/Coin.o
CoinProject/.objs/CoinMain.o
CoinProject/Coin.cpp
CoinProject/Coin.h
CoinProject/CoinMain.cpp
CoinProject/CoinProject.sln
CoinProject/CoinProject.suo
CoinProject/CoinProject.vcxproj
CoinProject/CoinProject.vcxproj.filters
CoinProject/CoinProject.vcxproj.user
CoinProject/console.cbp
CoinProject/console.depend
CoinProject/console.exe
CoinProject/console.layout
CoinProject/Debug/
CoinProject/Debug/cl.command.1.tlog
CoinProject/Debug/CL.read.1.tlog
CoinProject/Debug/CL.write.1.tlog
CoinProject/Debug/Coin.obj
CoinProject/Debug/CoinMain.obj
CoinProject/Debug/CoinProject.exe
CoinProject/Debug/CoinProject.exe.embed.manifest
CoinProject/Debug/CoinProject.exe.embed.manifest.res
CoinProject/Debug/CoinProject.exe.intermediate.manifest
CoinProject/Debug/CoinProject.ilk
CoinProject/Debug/CoinProject.lastbuildstate
CoinProject/Debug/CoinProject.log
CoinProject/Debug/CoinProject.pdb
CoinProject/Debug/CoinProject.write.1.tlog
CoinProject/Debug/CoinProject_manifest.rc
CoinProject/Debug/link.5312.read.1.tlog
CoinProject/Debug/link.5312.write.1.tlog
CoinProject/Debug/link.5312-cvtres.read.1.tlog
CoinProject/Debug/link.5312-cvtres.write.1.tlog
CoinProject/Debug/link.command.1.tlog
CoinProject/Debug/link.read.1.tlog
CoinProject/Debug/link.write.1.tlog
CoinProject/Debug/link-cvtres.read.1.tlog
CoinProject/Debug/link-cvtres.write.1.tlog
CoinProject/Debug/mt.command.1.tlog
CoinProject/Debug/mt.read.1.tlog
CoinProject/Debug/mt.write.1.tlog
CoinProject/Debug/rc.command.1.tlog
CoinProject/Debug/rc.read.1.tlog
CoinProject/Debug/rc.write.1.tlog
CoinProject/Debug/vc100.idb
CoinProject/Debug/vc100.pdb
CoinProject/Question.txt
CoinProject/Screenshot_1.png
]

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 sideUp member variable accordingly.
A void member function named toss that simulates the tossing of the coin. When thetoss member 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.
Write a program that demonstrates the coin class. The program should create an instance of the class and display the side that is initially facing up. Then, use a loop to toss the coin 20 times. Each time the coin is tossed, display the side that is facing up. The program should kepp count of the number of times heads is facing up, and display those when the loop is finished.

Write a Review

Get a fresh solution of this question. Ask it now to our experts.
doubt

Ask Your Question

We have verified professionals who are ready to answer your question.

time

Save Time and Money

We choose experts who can quickly answer your question and that suit your budget.

download

Get Your Answer

Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.