Advertisement
veronikaaa86

01. Student Information

May 18th, 2022
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. package basicSyntax;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P01StudentInformation {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. String name = scanner.nextLine();
  10. int age = Integer.parseInt(scanner.nextLine());
  11. double grade = Double.parseDouble(scanner.nextLine());
  12.  
  13. String result = String.format("Name: %s, Age: %d, Grade: %.2f", name, age, grade);
  14.  
  15. System.out.println(result);
  16. }
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement