Advertisement
veronikaaa86

01. Student Information

Sep 14th, 2022
719
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 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 studentName = scanner.nextLine();
  10.         int age = Integer.parseInt(scanner.nextLine());
  11.         double avgGrade = Double.parseDouble(scanner.nextLine());
  12.  
  13.         String resultText = String.format("Name: %s, Age: %d, Grade: %.2f",
  14.                 studentName, age, avgGrade);
  15.  
  16.         System.out.println(resultText);
  17.  
  18.         //System.out.printf("Name: %s, Age: %d, Grade: %.2f",studentName, age, avgGrade);
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement