desislava_topuzakova

01. Student Information

Sep 16th, 2021
821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. package BasicSyntaxCon;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class StudentInformation_01 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         //1. прочитам данните
  9.             //student name -> String
  10.             //age -> int
  11.             //average grade -> double
  12.         //2. отпечатвам текста: "Name: {student name}, Age: {student age}, Grade: {student grade}"
  13.         String studentName = scanner.nextLine();
  14.         int age = Integer.parseInt(scanner.nextLine());
  15.         double averageGrade = Double.parseDouble(scanner.nextLine());
  16.  
  17.         System.out.printf("Name: %s, Age: %d, Grade: %.2f", studentName, age, averageGrade);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment