example 1
final double BEGIN = 10.20, KM = 1.30, BAG = 2;
Scanner s = new Scanner (System.in);
double clientKm, clientBags;
System.out.println("How many km?:");
clientKm = s.nextDouble();
System.out.println("How many bags?:");
clientBags = s.nextDouble();
System.out.println("Your bill is: " + (BEGIN + (clientKm * KM) + (clientBags * BAG)) + " shekels.");
Example 2:
int floorCome, floorCall, floorGo;
final int FLOORTIME = 3, STOPTIME = 5;
Scanner s = new Scanner(System.in);
System.out.println("Which floor is the elevator now? ");
floorCome = s.nextInt();
System.out.println("From which floor is the person calling? ");
floorCall = s.nextInt();
System.out.println("To which floor you like to go? ");
floorGo = s.nextInt();
System.out.print("Will take " + STOPTIME + FLOORTIME * (floorCome - floorCall) + FLOORTIME * (floorCall - floorGo) + " seconds.");