Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Every time you run your program it should display a window displaying with the words Heads or Tails 1) Create a Class called Coin Declare
Every time you run your program it should display a window displaying with the words Heads or Tails 1) Create a Class called Coin Declare Class Instance Data. See UML on the next page for the instance variables (shown in bold and italics below) Constructor Method a. b. Set value to a random integer between 0 and 1 ii. If value 1, set sideUp equal to "Heads", else set sidelp equal to "Tails i. c. flipCoin Method i. Set value to a random integer between 0 and 1 ii. If value 1, set sideUp equal to "Heads", else set sidelp equal to "Tails i. return the value for sideUp i. Create as described in class d. getFace method e. toString method 2) main code a. Create an object from Circle Class b. Create an object from the Text class with the word "Heads c. Create an object from the Text class with the word Tails" d. Create an object from Group class e. Create an object from Coin class. f. Call the flipCoin method g. Output the result the toString method to the console CSI 2300-WINTER 2019- HWK 2 h. Call getFace) method. If it returns "Heads" then build a group with the Circle object and the Text object with Heads on it so that the text shows inside the circle object i. Else if getFace0method returns "Tails" then build a group with the Circle object and the Text object with Tails on it so that the text shows inside the circle object j. Add the Group to the Scene k. Add the Scene to the primaryStage . Display the primaryStage -Coin myPenny o yoid start Stage primaryStage) Caino String getf ace String tostringo Figure 1 UML for Homework 2 Homework Tals Figure 2 Example Screen for the Tails State Figure 3Example Screen for the Heads State Problem Points 50 50 For all problems-points will be awarded if all instructions are followed and the code runs without errors. Coin Class Client (main) Code Add comments to the code to explain the tasks. Your window should look different than other students. Two students turning in the exact same window face the possibility of being turned in for cheating
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started