View Code of Problem 118

import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int count = 1;
		while(scanner.hasNext()) {
			int dis = scanner.nextInt();
			int money = 0;
			if(dis<3) {
				money = 5;
			}else {
				money = (int) Math.ceil((dis - 3) * 1.5 +5);
			}
			System.out.println("Case #"+count++ +": "+money);
		}
	}
}

Double click to view unformatted code.


Back to problem 118