/* This is the solution for the first In- Class- Exercise on 02/04/2016 * You were required to calculate the amount for a speeding ticket based on the following specifications * Speed Ticket amount * [0,35) 0 * [35,50) (speed-35)*5 * >50 (speed-35)*11 */ import java.util.Scanner; class TicketAmount { public static void main(String [] args) { int speed; double amount=0; Scanner input = new Scanner(System.in); System.out.println("Enter the speed : "); speed = input.nextInt(); if(speed >=35 && speed <50) amount = (speed-35)*5; else if(speed >50) amount = (speed-35)*11; System.out.printf("The ticket amount is : %.2f\n",amount); } }