CalculateSales - / / / / / / File: CalculateSales.java...

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

View Full Document Right Arrow Icon
// File: CalculateSales.java // Author: Amber Settle // Course: CSC 211 // Purpose: Calculate movie ticket sales in order to demonstrate // how to do file I/O / import java.io.*; 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(System.in); S // Open the input and output files System.out.print("Enter the name of the input file: "); nameOfFile = inScan.next(); 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 = inScan.next(); 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: CalculateSales.java...

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