Essay Samples

HOME F.A.Q. REGISTER LOGIN SEARCH  
Essay Topics
Acceptance
Art
Business
Custom Written
Direct Essays
English
Example Essays
Foreign
History
Medical
Mega Essays
Miscellaneous
Movies
Music
Novels
People
Politics
Pre-Written
Religion
Science
Search
Speeches
Sports
Technology
Over 101,000 Essays and Term Papers!!
This is only a preview of the paper
Click here to register and get the full text.
Existing members click here to login

3qwee

Writing To a File // The "DiceData" class. // Simulate the throw of two dice 300 times // and store the generated data in file "dice". import java.io.*; public class DiceData { static public void main (String args []) throws IOException { int die1, die2, roll; PrintWriter output; output = new PrintWriter (new FileWriter ("c:/junk/dice.txt")); for (int count = 1 ; count <= 300 ; count++) { die1 = (int) (Math.random () * 6) + 1; die2 = (int) (Math.random () * 6) + 1; roll = die1 + die2; output.println (roll); } output.close (); //Note:To avoid losing information, be sure to close your files. This //releases any data temporarily held by DOS in memory. System.out.println ("Simulated data of 300 throws now in file 'dice'"); } // main method } /* DiceData class */ File Exercises 1) Write a program will read in strings and store them to a file (c:junkstrings.txt) one per line until the word “stop” is entered. The program will then read the file, output the strings, and output the number of strings stored in the file. 2) Write a program that will accept 5 strings and write them to a file named c:junkfile1.txt. The program will then accept another 5 strings and write them to a file called c:junkfile2.txt. files. A comparison between the strings contained within the two files will be preformed to see if any of the strings are the same.


Approximate Word count = 907
Approximate Pages = 3.6
(250 words per page double spaced)
Over 101,000 Essays and Term Papers!!
Links
3qwee

Support
F.A.Q.
Custom Essays
Payment
Essay Samples
Forgot Password?
Activation Email
More Links
All Papers Are For Research And Reference Purposes Only! You may not turn these papers in as your own! You must cite our web site as your source!
Copyright 2003-2008 essaysamples.net. All rights reserved.