0% found this document useful (0 votes)
1 views3 pages

Assignment7 StudentsExtendingDetailsAttachment

Uploaded by

Devil Lucifer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views3 pages

Assignment7 StudentsExtendingDetailsAttachment

Uploaded by

Devil Lucifer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

==================================================

com.tca ==> MainStudentExtendingDetailsAttachment


==================================================

package com.tca;

import com.tca.entities.StudentsBasicDetails;
import com.tca.entities.StudentsExtendingSocialMediaDetails;

import java.time.LocalDate;
import java.util.Scanner;

public class MainStudentExtendingDetailsAttachment {

public static void main(String ...args){


Scanner sc = new Scanner(System.in);

System.out.print("Enter The Number Of Students : ");


int noOfStudents = sc.nextInt();
StudentsExtendingSocialMediaDetails[] arrayOfStudents = new
StudentsExtendingSocialMediaDetails[noOfStudents]; //Array Of Object Variable

/* Creating Array Of Object */


for(int index=0;index<noOfStudents;index++) {
System.out.print("Enter The Roll Number : ");
int rollNumber = sc.nextInt();
System.out.print("Enter The Student Name : ");
String studentName = sc.next();
System.out.print("Enter The Student Percentage : ");
double studentPercentage = sc.nextDouble();
System.out.print("Enter The Student Contact Number : ");
String studentContactNumber = sc.next();
System.out.print("Enter The Student Email Id : ");
String studentEmailId = sc.next();

arrayOfStudents[index] = new StudentsExtendingSocialMediaDetails();


arrayOfStudents[index].setRollNumber(rollNumber);
arrayOfStudents[index].setStudentName(studentName);
arrayOfStudents[index].setStudentPercentage(studentPercentage);
arrayOfStudents[index].setStudentContactNumber(studentContactNumber);
arrayOfStudents[index].setStudentEmailId(studentEmailId);
System.out.println("=================================================");
}

/* Calling Display To See Details Of Students */


for(int index=0;index<noOfStudents;index++){
arrayOfStudents[index].displayStudentData();
}
}
}

============================================
com.tca.entities ==> StudentBasicDetails
============================================

package com.tca.entities;

public class StudentsBasicDetails {


private int rollNumber;
private String studentName;
private double studentPercentage;

public StudentsBasicDetails(){}

public StudentsBasicDetails(int rollNumber, String studentName, double studentPercentage) {


this.rollNumber = rollNumber;
this.studentName = studentName;
this.studentPercentage = studentPercentage;
}

public int getRollNumber() {


return rollNumber;
}

public void setRollNumber(int rollNumber) {


this.rollNumber = rollNumber;
}

public String getStudentName() {


return studentName;
}

public void setStudentName(String studentName) {


this.studentName = studentName;
}

public double getStudentPercentage() {


return studentPercentage;
}

public void setStudentPercentage(double studentPercentage) {


this.studentPercentage = studentPercentage;
}

public void displayStudentData()


{
System.out.println("Student Roll Number : " + rollNumber);
System.out.println("Student Name : " + studentName);
System.out.println("Student Percentage : " + studentPercentage);
}
}

==========================================================
com.tca.entities ==> StudentsExtendingSocialMediaDetails
==========================================================

package com.tca.entities;

public class StudentsExtendingSocialMediaDetails extends StudentsBasicDetails{

private String studentContactNumber;


private String studentEmailId;

public StudentsExtendingSocialMediaDetails(){
super();
}

public StudentsExtendingSocialMediaDetails(int rollNumber, String studentName, double studentPercentage, String


studentEmailId, String studentContactNumber) {
super(rollNumber, studentName, studentPercentage);
this.studentEmailId = studentEmailId;
this.studentContactNumber = studentContactNumber;
}

public String getStudentContactNumber() {


return studentContactNumber;
}

public void setStudentContactNumber(String studentContactNumber) {


this.studentContactNumber = studentContactNumber;
}

public String getStudentEmailId() {


return studentEmailId;
}

public void setStudentEmailId(String studentEmailId) {


this.studentEmailId = studentEmailId;
}

public void displayStudentData(){


super.displayStudentData();
System.out.println("Student Contact Number : " + studentContactNumber);
System.out.println("Student Email Id : " + studentEmailId);
System.out.println("=================================================");
}
}

You might also like