ticketprice numberOfTicketsSold
250 5750
100 28000
50 35750
25 18750
import java.io.FileReader; import java.io.IOException; import java.util.Scanner; import java.text.NumberFormat; class TotalTicketSales { public static void main(String [] args) throws IOException{ int ticketPrice, ticketsSold, ticketTotal; double totalSale; Scanner inFile = new Scanner(new FileReader("tickets.dat")); ticketPrice = inFile.nextInt(250); ticketsSold = inFile.nextInt(5750); ticketTotal = ticketsSold; totalSale = ticketPrice * ticketsSold; ticketPrice = inFile.nextInt(100); ticketsSold = inFile.nextInt(28000); ticketTotal += ticketsSold; totalSale += ticketPrice * ticketsSold; ticketPrice = inFile.nextInt(50); ticketsSold = inFile.nextInt(35750); ticketTotal += ticketsSold; totalSale += ticketPrice * ticketsSold; ticketPrice = inFile.nextInt(25); ticketsSold = inFile.nextInt(18750); ticketTotal += ticketsSold; totalSale += ticketPrice * ticketsSold; NumberFormat nf = NumberFormat.getCurrencyInstance(); System.out.println("Total Sales " + nf.format(totalSale)); System.out.println("Total Tickets Sold " + ticketTotal); inFile.close(); } }