/home/wpollock1/public_html/restricted/Java1/CostPerHour.java
// CostPerHour.java - A simple program to calculate the cost per hour
// of this Java class. In this model solution we calculate in pennies.
//
// Written 2/2007 by Wayne Pollock, Tampa Florida USA.
class CostPerHour
{
public static void main ( String [] args )
{
final int COST_PER_CREDIT = 6611;
final int NUM_CREDITS = 3;
final int HCC_FEE = 2000;
final int TEXTBOOK_PRICE = 8695;
final double SALES_TAX_RATE = 0.075; // 7.5%
final int NUM_CLASSES = 31;
final int MINUTES_PER_CLASS = 60 + 45;
double totalCost = COST_PER_CREDIT * NUM_CREDITS + HCC_FEE
+ TEXTBOOK_PRICE * (1+SALES_TAX_RATE);
double totalHours = ( NUM_CLASSES * MINUTES_PER_CLASS ) / 60.0;
int costPerHour = (int) Math.round( totalCost / totalHours );
System.out.println( "Cost per Hour for this class is: $"
+ ( costPerHour / 100 ) + "."
+ ( costPerHour % 100 ) + "." );
}
}