CalculateSales - / / / / / / File:

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// File: // Author: Amber Settle // Course: CSC 211 // Purpose: Calculate movie ticket sales in order to demonstrate // how to do file I/O / import*; import java.util.*; i public class CalculateSales { public static void main(String[] args) throws FileNotFoundException { final double ADULT_PRICE = 9.50; final double CHILD_PRICE = 5.00; f int adultTickets, childTickets; double adultSales, childSales, totalSales; String code = new String(); String nameOfFile; S // Use standard input Scanner inScan = new Scanner(; S // Open the input and output files System.out.print("Enter the name of the input file: "); nameOfFile =; n // Create files for input and output Scanner fileScan = new Scanner( new FileReader(nameOfFile)); PrintWriter outFile = new PrintWriter("ticketSales.txt"); P // Input from the keyboard /* while (!code.equals("quit")) { System.out.print("Enter the sale code or \"quit\" to quit: "); code =; code = code.toLowerCase();
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/05/2011 for the course CSC 211 taught by Professor Chan during the Spring '11 term at CA Health Sciences.

Page1 / 2

CalculateSales - / / / / / / File:

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online