*Java Program Please
You are working at a university that tracks students. Each student is identified by their name and faculty advisor. Each faculty advisor is identified by their name, department, and maximum number of students they can advise. Using solid OO design principles, create a modular program that gathers user input for one student and then prints out the information gathered by creating the appropriate data definition and implementation classes. All data must be validated.
FacultyAdvisor.java
import javax.naming.InvalidNameException;
public class FacultyAdvisor {
String name;
String department;
int MAX_students;
int presentCount=0;
public int getPresentCount() {
return presentCount;
}
public void setPresentCount(int presentCount) {
this.presentCount =
presentCount;
}
public FacultyAdvisor(String name, String department,
int mAX_students) {
super();
setName(name);
setDepartment(department);
setMAX_students(mAX_students);
}
public String getName() {
return name;
}
public void setName(String name) {
if(name.contains("[0-9]")) {
try {
throw new InvalidNameException("Name should not
contain Digits");
} catch
(InvalidNameException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return;
}
this.name = name;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
if(department.contains("[0-9]"))
{
try {
throw new InvalidNameException("Department
should not contain Digits");
} catch
(InvalidNameException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return;
}
this.department = department;
}
public int getMAX_students() {
return MAX_students;
}
public void setMAX_students(int mAX_students) {
if(name.contains("[/w]")) {
try {
throw new InvalidNameException("MAX_students
should be an Integer");
} catch
(InvalidNameException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return;
}
this.MAX_students =
mAX_students;
}
@Override
public String toString() {
return "\nFacultyAdvisor \nName : "
+ name + "\nDepartment : " + department + "\nMaximum number of
students : " + MAX_students+"\nPresent count of students he is
assisting : "+this.presentCount;
}
}
Student.java
import javax.naming.InvalidNameException;
public class Student {
String name;
FacultyAdvisor advisor;
public Student(String name, FacultyAdvisor advisor)
{
super();
int count =
advisor.getPresentCount();
if(count<advisor.getMAX_students()) {
setName(name);
advisor.setPresentCount(count+1);
this.advisor = advisor;
}
else
System.out.println("Advisor cannot be tagged to student as Advisor
reaches the maximum students he can advise.");
setName(name);
}
public void setName(String name) {
if(name.contains("[0-9]")) {
try {
throw new InvalidNameException("Name should not
contain Digits");
} catch
(InvalidNameException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return;
}
this.name = name;
}
@Override
public String toString() {
return "\nStudent\nName : " + name
+ "\n"+advisor.toString();
}
}
Driver.java
import java.util.Scanner;
public class Driver {
public static void main(String[] args) {
// TODO Auto-generated method
stub
Scanner scan = new
Scanner(System.in);
System.out.println("Enter name of
faculty : ");
String aName = scan.next();
System.out.println("Enter name of
Department : ");
String dep = scan.next();
System.out.println("Enter Maximum
students : ");
int students =
scan.nextInt();
FacultyAdvisor advisor = new
FacultyAdvisor(aName, dep, students);
System.out.println("Enter name of
Student: ");
String name = scan.next();
Student student = new Student(name,
advisor);
System.out.println("\nPrinting
Student deatils : ");
System.out.println(student.toString());
}
}
Output
Enter name of faculty :
John
Enter name of Department :
Computers
Enter Maximum students :
5
Enter name of Student:
Nicholas
Printing Student deatils :
Student
Name : Nicholas
FacultyAdvisor
Name : John
Department : Computers
Maximum number of students : 5
Present count of students he is assisting : 1
Feel free to ask any doubts, if you face any difficulty in understanding.
Please upvote the answer if you find it helpful
*Java Program Please You are working at a university that tracks students. Each student is identified...
(JAVA) Write a program that maintains student test scores in a two-dimesnional array, with the students identified by rows and test scores identified by columns. Ask the user for the number of students and for the number of tests (which will be the size of the two-dimensional array). Populate the array with user input (with numbers in {0, 100} for test scores). Assume that a score >= 60 is a pass for the below. Then, write methods for: Computing the...
In JAVA please! Write program for exercises You will write a Graphical User Interface(GUI) application to manage student information system. The application should allow: 1. Collect student information and store it in a binary data file. Each student is identified by an unique ID. The user should be able to view/edit an existing student. Do not allow student to edit ID. 2. Collect Course information and store it in a separate data file. Each course is identified by an unique...
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...
You are asked to build and test the following system using Java and the object-oriented concepts you learned in this course: Project (20 marks) CIT College of Information technology has students, faculty, courses and departments. You are asked to create a program to manage all these information's. Create a class CIT to represents the following: Array of Students, each student is represented by class Student. Array of Faculty, each faculty is represented by class Faculty. Array of Course, each course...
please help
Write a simple program with Student class having STL list of Record's structure as a member. 1. Records of the Students are not accessible to the outside world. 2. Student shall output its standing (Freshman, Sophomore etc). 3. A Student can only be created with the name 4. A class can only be added if there is a class name and the passing grade. Driver program creates a Student, adds few classes to the Student's records, then prints...
Write a Java program which will store, manipulate, and print student registration information. As part of the solution, identify the following classes: Student Admissions. The class Student must have the following fields – Name, Address, Id number, Courses, and Date, where: Name is a user defined class comprising of at minimum first name and last name. Address is a user defined class comprising of fields - street, city, state, and zip code. Date is a predefined class in the java.util...
Write a program in Java according to the following specifications: The program reads a text file with student records (first name, last name and grade on each line). Then it prompts the user to enter a command, executes the command and loops. The commands are the following: "print" - prints the student records (first name, last name, grade). "sortfirst" - sorts the student records by first name. "sortlast" - sorts the student records by last name. "sortgrade" - sorts the...
Program in IDLE: At a university, each student is assigned a system login name, which the student uses to log into the campus computer system. As part of your internship with the university's Information Technology department, you have been asked to write the code that generates system login names for students. You will use the following algorithm to generate a login name: 1) Get the first 3 characters of the student's first name. 2) Get the first 2 characters of...
Java program
Program: Grade Stats In this program you will create a utility to calculate and display various statistics about the grades of a class. In particular, you will read a CSV file (comma separated value) that stores the grades for a class, and then print out various statistics, either for the whole class, individual assignments, or individual students Things you will learn Robustly parsing simple text files Defining your own objects and using them in a program Handling multiple...
Create a class hierarchy to be used in a university setting. The classes are as follows: The base class is Person. The class should have 3 data members: personID (integer), firstName(string), and lastName(string). The class should also have a static data member called nextID which is used to assign an ID number to each object created (personID). All data members must be private. Create the following member functions: o Accessor functions to allow access to first name and last name...