/* * InClass.java * * Author: Dr Michael Redmond * Created on February 7, 2002, 2:39 PM * Last Modified: 2/7/02 * * Purpose: * Accept ticket sales for Olympic downhill ski race, reporting on total * cost including service fees. * Tickets for the Olympic Downhill Ski race are $100 each. If you buy 10 * or more, then there is a service charge of $100. If you buy fewer, the * service charge is $15 per ticket. This program handles the I/O and * calculations – displaying total cost. * * Assumptions: * There is no limit to the number of tickets that may be purchased * */ import SavitchIn; /* * * @author Dr Michael Redmond * @version */ public class InClass extends Object { public static final double TICKPRICE = 100; // price per ticket before service charge /** Creates new InClass */ public InClass() { } /** * @param args the command line arguments */ public static void main (String args[]) { // // find out how many tickets are to be purchased // System.out.println("How many tickets do you want?"); int numTix = 0; double fee; numTix = SavitchIn.readLineInt(); // // calculate service fee // if (numTix >= 10) { // qualified for cheaper fee fee = 100; } else { fee = 15 * numTix; } // // Calculate costs - for tickets and service fee combined // double tickCost = numTix * TICKPRICE; double total = tickCost + fee; System.out.println ("The tickets plus fees cost " + total); } }