DOC PREVIEW
WVU CS 110 - Exercises 4/5/06

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Exercises 4/5/061. Consider the following incomplete Java program:public class Exercise1 { public static void main(String[] args) {}// end main}a. Write java statements that import the classes Scanner, FileReader, PrintWriter, and FileWriter from the packages java.util and java.io.b. Write statements that declare 2 file handles, one called inFile associated with the file “inData.txt”, and the other outFile associated with the file “outData.txt”.c. Write statements that declare an instance of Scanner to access the data stored in inFile.d. Write statements that declare an instance of PrintWriter to write data to thefile outFile.e. Suppose that the file inData.txt contains the following data:56 38A7 8f. Write statements so that after the program executes, the contents of the fileoutData.dat are as shown below. If necessary, declare additional variables.The sum of 56 and 38 = 94.The character that comes after A in the Unicode set is B.the product of 7 and 8 = 56.g. Write a statement that closes the output file.2. The manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are four types of tickets --- box, sideline, premium, and general admission. After each game the data is stored in a file called tickets.dat in the following format:250 5750100 2800050 3575025 18750Your program will create a report file called sales.txt, which contains a report in the format:Weekly Ticket Sales ReportType Price #Sold Amount SoldBox 250.00 5750 1437500.00Sideline…………………………………PremiumGeneralTotal Number of Tickets Sold: (total sold)Total Sales: $ ( Sum of ticket


View Full Document

WVU CS 110 - Exercises 4/5/06

Download Exercises 4/5/06
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Exercises 4/5/06 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Exercises 4/5/06 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?