Alpha Geek

(8)

$10/per page/Negotiable

About Alpha Geek

Levels Tought:
University

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Environmental science,Essay writing,Programming,Social Science,Statistics Hide all
Teaching Since: Apr 2017
Last Sign in: 347 Weeks Ago, 4 Days Ago
Questions Answered: 9562
Tutorials Posted: 9559

Education

  • bachelor in business administration
    Polytechnic State University Sanluis
    Jan-2006 - Nov-2010

  • CPA
    Polytechnic State University
    Jan-2012 - Nov-2016

Experience

  • Professor
    Harvard Square Academy (HS2)
    Mar-2012 - Present

Category > Accounting Posted 27 Apr 2017 My Price 5.00

Write a class named Coin

Write a class named Coin. A Coin class should have the following fields:

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 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

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 keep count of the number of times heads is facing up and the number of times tails is facing up, and display those values after the loop finishes.

 



Answers

(8)
Status NEW Posted 27 Apr 2017 02:04 PM My Price 5.00

-----------

Attachments

file 1493304362-Answer.docx preview (436 words )
W-----------rit-----------e a----------- cl-----------ass----------- na-----------med----------- Co-----------in.----------- A -----------Coi-----------n c-----------las-----------s s-----------hou-----------ld -----------hav-----------e t-----------he -----------fol-----------low-----------ing----------- fi-----------eld-----------s: ----------- A -----------Str-----------ing----------- na-----------med----------- si-----------deU-----------p. -----------The----------- si-----------deU-----------p f-----------iel-----------d w-----------ill----------- ho-----------ld -----------eit-----------her----------- &q-----------uot-----------;he-----------ads-----------&qu-----------ot;----------- or----------- &q-----------uot-----------;ta-----------ils-----------&qu-----------ot;----------- in-----------dic-----------ati-----------ng -----------the----------- si-----------de -----------of -----------the----------- co-----------in -----------tha-----------t i-----------s f-----------aci-----------ng -----------up ----------- Th-----------e C-----------oin----------- cl-----------ass----------- sh-----------oul-----------d h-----------ave----------- th-----------e f-----------oll-----------owi-----------ng -----------met-----------hod-----------s: ----------- A -----------no------------arg----------- co-----------nst-----------ruc-----------tor----------- th-----------at -----------ran-----------dom-----------ly -----------det-----------erm-----------ine-----------s t-----------he -----------sid-----------e o-----------f t-----------he -----------coi-----------n t-----------hat----------- is----------- fa-----------cin-----------g u-----------p (-----------&qu-----------ot;-----------hea-----------ds&-----------quo-----------t; -----------or -----------&qu-----------ot;-----------tai-----------ls&-----------quo-----------t;)----------- an-----------d i-----------nit-----------ial-----------ize-----------s t-----------he -----------sid-----------eUp----------- fi-----------eld-----------
Not Rated(0)