Please write this C# code-
Your main program will use a class named Coin, which has the following field:
• A private String named SideUp. The SideUp field will hold either “heads” or “tails” indicating
the side of the coin that is facing up.
The Coin class has the following methods:
• A no-arg constructor that randomly determines the side of the coin that is facing up
(“heads” or “tails”) and initializes the SideUp field accordingly.
• A void method named toss that simulates the tossing of the coin. When the toss
method is called, it randomly determines the side of the coin that is facing up (“heads”
or “tails”) and sets the SideUp field accordingly.
• A method named GetSideUp that returns the value of the SideUp field.
Code for the Coin class follows:
class Coin
{
private String SideUp;
private Random rnd;
public Coin() {
rnd = new Random();
Toss(); }
public void Toss()
{
// Pick a random number: either 1 or 2
int i = rnd.Next(1, 3);
if (i == 1)
SideUp = "Heads";
else
SideUp = "Tails";
}
public String GetSideUp()
{
return SideUp;
}
}
Here I am providing the answer for the above question:
Code:
using System;
class Coin
{
private string SideUp;
private Random rnd;
public Coin()
{
rnd=new Random();
Toss();
}
public void Toss()
{
int i=rnd.Next(1,3);
if(i==1)
SideUp="Heads";
else
SideUp="Tails";
}
public string GetSideUp()
{
return SideUp;
}
//main method which uses Coin calss
static void Main()
{
Coin c=new Coin();
Console.WriteLine("The coin is in:"+c.GetSideUp());
c.Toss();
Console.WriteLine("Now the coin is in:"+c.GetSideUp());
}
}
Screenshot:

Output:

Hoping that the above answer will help you...Thank
you...
Please write this C# code- Your main program will use a class named Coin, which has...
# JAVA Problem Toss Simulator Create a coin toss simulation program. The simulation program should toss coin randomly and track the count of heads or tails. You need to write a program that can perform following operations: a. Toss a coin randomly. b. Track the count of heads or tails. c. Display the results. Design and Test Let's decide what classes, methods and variables will be required in this task and their significance: Write a class called Coin. The Coin...
c++ Program 2: Coin Toss Simulator For this program, please implement Problems 12 and 13 in a single program (Gaddis, p812, 9E). Scans of these problems are included below. Your program should have two sections that correspond to Problems 12 and 13: 1) As described in Problem 12, implement a Coin class with the specified characteristics. Run a simulation with 20 coin tosses as described and report the information requested in the problem. 2) For the second part of your...
12. Coin Toss Simulator Write a class named Coin. The Coin class should have the following field .A String named sideUp. The sideUp field will hold either "heads" or "tails" indicating the side of the coin that is facing up The Coin class should have the following methods .A no-arg constructor that randomly determines the side of the coin that is facing up (heads" or "tails") and initializes the aideUp field accordingly .A void method named toss that simulates the...
implement coinclass and driver program within one source file,
i.e. do not separate class specifications with implementation
Its a c++ problem
12. 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...
import java.util.Scanner; public class Client{ public static void main(String args[]){ Coin quarter = new Coin(25); Coin dime = new Coin(10); Coin nickel = new Coin(5); Scanner keyboard = new Scanner(System.in); int i = 0; int total = 0; while(true){ i++; System.out.println("Round " + i + ": "); quarter.toss(); System.out.println("Quarter is " + quarter.getSideUp()); if(quarter.getSideUp() == "HEADS") total = total + quarter.getValue(); dime.toss(); System.out.println("Dime is " + dime.getSideUp()); if(dime.getSideUp() == "HEADS") total = total +...
Write a C++ program that simulates coin tossing. For each toss of the coin the program should print Heads or Tails. The program should toss a coin 100 times. Count the number of times each side of the coin appears and print the results at the end of the 100 tosses. The program should have the following functions as a minimum: void toss() - called from main() and will randomly toss the coin and set a variable equal to the...
Comment your code. At the top of the program include your name, a brief description of the program and what it does and the due date. The program must be written in Java and submitted via D2L. The code matches the class diagram given above. The code uses Inheritance. In the following, you are given code for two classes: Coin and TestCoin. You study these classes first and try to understand the meaning of every line. You can cut and...
C# assistance please help Write the source code for a C# program (i.e., a separate class) named “BookDemo” that uses the Book class below and does the following in the Main method of BookDemo: 1) Declare local variables for book title and author, and initialize the variables to “C# Programming” and “Farrell” 2) Instantiate a Book object using the information from Step 1 3) Print the summary of the book object using the displaySummary() method in the Book class class...
***IN PYTHON 2.7****Augment the following code with a new class named 'Coin'. Coin should inherit from Die, with the following modifications; The constructor should not take any arguments; a coin always has two sides add a flip() method that uses the roll() method from the parent class. If roll returns 1; flip should return "HEADS". If roll returns a 2, flip should return "TAILS" Do not override the roll or rollMultiple methods from the parent class #!/usr/bin/python # your class...
Write a program called CountFlips whose main method flips a coin 100 times and counts how many times each side comes up. Make sure to include comments of what is being done in the code. Verify whether the head comes up or not by calling isHeads method of Coin class. Increment the heads count if head comes up. Increment the tails count if tail comes up. Display the head and tails counts. Print the results SEND AS A TEXT FILE...