Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dataTypes;
- import java.util.Scanner;
- public class P04TownInfo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- //Town {town name} has population of {population} and area {area} square km.
- String townName = scanner.nextLine();
- int population = Integer.parseInt(scanner.nextLine());
- short area = Short.parseShort(scanner.nextLine());
- String result = String.format
- ("Town %s has population of %d and area %d square km.",
- townName, population, area);
- System.out.println(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment