Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
My instructor has requested a change to my Coin Tossing program that I have written but I need to know what to change, need help. This is what the instructor requested: As written in the textbook, the user is able to choose to toss the coin repeatedly, and the program will report the result of tossing the coin each additional time (i.e., the results of the tosses should be cumulative). Instead, write the CoinTossing class so that rather than just doing one toss at a time, the user may input a integral value saying how many additional tosses are to be performed each time. The program will terminate if the user enters "0", indicating that the user wishes no more tosses of the coin. After each entry from the user, output the total count (from the start of the execution of the program) of each of the possible outcomes, so that it may be determined whether the simulated coin is "fair". and here is my code so far: package tosscoin; import java.util.Random; import java.io.DataInputStream; import java.io.IOException; /** * * @author David Reeves */ public class tossCoin { public int num_heads =0,num_tails =0; public enum coin {Head,Tail}; private final Random rm = new Random(); public coin flip() { coin c; int i = rm.nextInt(2); if(i==0) { c = coin.Head; num_heads++; } else { c = coin.Tail; num_tails++; } return c; } public static void main(String[] args) { // TODO code application logic here DataInputStream din = new DataInputStream(System.in); tossCoin ts = new tossCoin(); int choice =0, i=0; System.out.println("Make a choicenPress 1 to tossnPress 2 to exit "); while(true) { System.out.print("Choice:"); try{ choice = Integer.parseInt(din.readLine()); } catch(IOException | NumberFormatException E) { System.out.println("Invalid choice"); } switch(choice) { case 1: ts.flip(); System.out.println("Heads: "+ts.num_heads +" Tails: "+ ts.num_tails ); break; case 2: return; default: System.out.println("Invalid choice. Try again"); } } }
A. (True | False) In the MSP430's active mode, the MCLK and SMCLK clocks are up and running and ACLK is not running (it is turned off).
The function return the value of the ticket price time the discount percentage.
Your company wants to implement a strategy for backing up network data. It wants a strategy that allows it to back up changed files on a daily basis and recover lost files quickly in the event of disk failure. What would you recommend to meet your..
A message stating the purpose of the organization.
When all the information is valid, a confirmation screen is displayed. The operator visually confirms that the data are correct and either accepts the transaction or cancels it.
Determine a smallest-last vertex ordering and plot degree when deleted diagram for given random geometric graphs.
Matrices so as to maximize, rather than minimize, number of scalar multiplications. Does this problem show optimal substructure?
this assignment consists of two 2 sections a business requirements document and a gantt chart or project plan. you must
Create following directories in your home directory cp_even, cp_mid,cp_iso,cp,thousand,cp_even. Examine files in the /usr/share/tcl8.3/encoding directory copy all files which begin with mac into mac directory.
Also print a report of the each student's test grades, average and final grade as a table, and then print the averages of each Test and overall Test Average, as well as highest Test Grade of all Tests and the student with the highest class grade.
What are some main attributes of product and how may it help operations of organization? How do third-party plug-ins change process of diagnosing and troubleshooting errors in application?
Write down a 2-3 page paper explaining the hardware and software utilized to support personal, workgroup, and enterprise computing in the present organization.
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd