Didart

Town Info

Apr 6th, 2021
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TownInfo {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String townName = scanner.nextLine();
  8.         int population = Integer.parseInt(scanner.nextLine());
  9.         double area = Double.parseDouble(scanner.nextLine());
  10.  
  11.         System.out.printf("Town %s has population of %d and area %.0f square km.",
  12.                 townName, population, area);
  13.     }
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment