Advertisement
veronikaaa86

04. Town Info

May 25th, 2022
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. package dataTypesAndVariables;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P04TownInfo {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. String town = scanner.nextLine();
  10. int population = Integer.parseInt(scanner.nextLine());
  11. int area = Integer.parseInt(scanner.nextLine());
  12.  
  13. String result = String.format("Town %s has population of %d and area %d square km.", town, population, area);
  14.  
  15. System.out.println(result);
  16. }
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement