Advertisement
ciacho152

Penises

Jul 24th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.43 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Student
  4. {
  5.     //student's details
  6.     private String firstName;
  7.     private String lastName;
  8.     private int age;
  9.     private String gender;
  10.     private String school;
  11.     Scanner input= new Scanner(System.in);
  12.    
  13.     /*public enum Gender
  14.     {
  15.         male,
  16.         female
  17.     }*/
  18.    
  19.     public Student()
  20.     {
  21.         // initialise instance variables
  22.         /*this.firstName=firstName;
  23.         this.lastName=lastName;
  24.         this.age=age;
  25.         this.gender=gender;
  26.         this.school=school;*/
  27.     }
  28.     public void addDetails()
  29.     {
  30.         System.out.print("Enter student's first name: ");
  31.         this.firstName=input.next();
  32.         System.out.print("Enter student's last name: ");
  33.         this.lastName=input.next();
  34.         System.out.print("Enter student's age: ");
  35.         this.age=input.nextInt();
  36.         System.out.print("Enter student's gender('male' or 'female'): ");
  37.         this.gender=input.next();
  38.         System.out.print("Enter student's school: ");
  39.         this.school=input.next();
  40.     }
  41.     public void printDetails()
  42.     {
  43.         System.out.println("Student's name: "+this.firstName);
  44.         System.out.println("Student's last name: "+this.lastName);
  45.         System.out.println("Student's age: "+this.age);
  46.         System.out.println("Student's gender: "+this.gender);
  47.         System.out.println("Student's school: "+this.school);
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement