In Java:
Develop a simple class for a Student. Include class variables;
StudentID (int), FirstName, LastName,
GPA (double), and Major. Extend your class for a Student to include
classes for Graduate and Undergraduate.
o Include a default constructor, a constructor that accepts the
above information, and a
method that prints out the contents FOR EACH LEVEL of the object,
and a method that
prints out the contents of the object.
o Write a program that uses an array of Students in a course. Input
the Student information,
create the object, and add each student to the list. Use a
StudentID of -1 as a sentinel value.
o Print out the Students in the list.
Answer :-
class StudentDetails
{
public static void main(String s[])
{
Student students[] = new Student[5];
students[0] = new Student();
students[0].StudentID = 1001;
students[0].FirstName = "Rajesh";
students[0].LastName = "K";
students[0].GPA = '3.2';
students[1] = new Student();
students[0].StudentID = 1002;
students[0].FirstName = "Suresh";
students[0].LastName = "S";
students[0].GPA = '4.5';
students[2] = new Student();
students[0].StudentID = 1003;
students[0].FirstName = "Ramesh";
students[0].LastName = "k";
students[0].GPA = '4';
students[3] = new Student();
students[0].StudentID = 1004;
students[0].FirstName = "Kamlesh";
students[0].LastName = "j";
students[0].GPA = '3.5';
students[4] = new Student();
students[0].StudentID = 1005;
students[0].FirstName = "Vignesh";
students[0].LastName = "A";
students[0].GPA = '3';
for(int i = 0; i < students.length; i++)
{
System.out.println("StudentID"+ students[i].StudentID + "Student
FirstName " + students[i].FirstName + "Student LastName " +
students[i].LastName + students[i].GPA+"out of 5");
}
}
}
class Student
{
int StudentID;
String FirstName;
String LastName;
String address;
double GPA;
}
In Java: Develop a simple class for a Student. Include class variables; StudentID (int), FirstName, LastName,...
PART I: Create an abstract Java class named “Student” in a package named “STUDENTS”. This class has 4 attributes: (1) student ID: protected, an integer of 10 digits (2) student name: protected (3) student group code: protected, an integer (1 for undergraduates, 2 for graduate students) (4) student major: protected (e.g.: Business, Computer Sciences, Engineering) Class Student declaration provides a default constructor, get-methods and set-methods for the attributes, a public abstract method (displayStudentData()). PART II: Create a Java class named...
Given a database with the following tables: Students FirstName CHAR(20) | LastName CHAR(20) | StudentID INT | Major CHAR(20) | Degree CHAR(5) | Scholarship BOOLEAN | GPA FLOAT(3,2) | CreditsEarned INT | CreditsAttempted INT Classes ClassID INT | Title VARCHAR(50) | Description VARCHAR(255) | Credits SMALLINT Enrollments ClassID INT | StudentID INT C) Retrieve the First Name, Last Name, Major and StudentID of all students with a Scholarship:
C++ program Create a Student class that contains three private data members of stududentID (int), lastName (string), firstName(string) and a static data member studentCount(int). Create a constructor that will take three parameters of studentID, lastName and firstName, and assign them to the private data member. Then, increase the studentCount in the constructor. Create a static function getStudentCount() that returns the value of studentCount. studentCount is used to track the number of student object has been instantiated. Initialize it to 0...
Design a class named Student. The Student class should have a Firstname, a Lastname, an Address, an email address, a major and a GPA. Determine the data types for each property, then create the class diagram and write the pseudo-code that defines the class. You can use java language for pseudo-code
Write a class called Course_xxx that represents a course taken at a school. Represent each student using the Student class from the Chapter 7 source files, Student.java. Use an ArrayList in the Course to store the students taking that course. The constructor of the Course class should accept only the name of the course. Provide a method called addStudent that accepts one Student parameter. Provide a method called roll that prints all students in the course. Create a driver class...
In Java programming language Please write code for the 6 methods below: Assume that Student class has name, age, gpa, and major, constructor to initialize all data, method toString() to return string reresentation of student objects, getter methods to get age, major, and gpa, setter method to set age to given input, and method isHonors that returns boolean value true for honors students and false otherwise. 1) Write a method that accepts an array of student objects, and n, the...
Question 1 (24 Marks] 1. (4 marks) Write an immutable Person class in Java which provides the following. • Two attributes: lastName and first Name of type String. • Appropriate initialization, accessors/mutator methods. 2. (6 marks) Write a Student class that is a subclass of Person class (in the previous question) which provides the following. • Two attributes: A unique student ID of type String and GPA of type float; the student ID is initialized when a Student object gets...
( Object array + input) Write a Java program to meet the following requirements: 1. Define a class called Student which contains: 1.1 data fields: a. An integer data field contains student id b. Two String data fields named firstname and lastname c. A String data field contains student’s email address 1.2 methods: a. A no-arg constructor that will create a default student object. b. A constructor that creates a student with the specified student id, firstname, lastname and email_address...
I need code in java The Student class: CODE IN JAVA: Student.java file: public class Student { private String name; private double gpa; private int idNumber; public Student() { this.name = ""; this.gpa = 0; this.idNumber = 0; } public Student(String name, double gpa, int idNumber) { this.name = name; this.gpa = gpa; this.idNumber = idNumber; } public Student(Student s)...
Here is the code from the previous three steps: #include <iostream> using namespace std; class Student { private: //class variables int ID; string firstName,lastName; public: Student(int ID,string firstName,string lastName) //constructor { this->ID=ID; this->firstName=firstName; this->lastName=lastName; } int getID() //getter method { return ID; } virtual string getType() = 0; //pure virtual function virtual void printInfo() //virtual function to print basic details of a student { cout << "Student type: " << getType() << endl; cout << "Student ID: " << ID...