Unformatted text preview:

Exercises 4 5 06 1 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 the file outFile e Suppose that the file inData txt contains the following data 56 38 A 7 8 f Write statements so that after the program executes the contents of the file outData 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 100 50 25 5750 28000 35750 18750 Your program will create a report file called sales txt which contains a report in the format Weekly Ticket Sales Report Type Price Sold Box 250 00 5750 Sideline Premium General Total Number of Tickets Sold total sold Total Sales Sum of ticket Sales Amount Sold 1437500 00


View Full Document

WVU CS 110 - Exercises 4/5/06

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