Question
Create a Java project called Lab8-Q3. Inside this project create a class named Q3 with a main function. Also create a class named Student. The
Create a Java project called Lab8-Q3. Inside this project create a class named "Q3" with a main function. Also create a class named "Student".
The main function should have the following lines of code
Student Chris = new Student("Chris Chambers" , "Z3453234");
Chris.StudentProfile();
Student Tom = new Student();
Tom.StudentProfile();
Student.NumStudents();
and output the following
Name: Chris Chambers
ZNumber: Z3453234
Enter the students name:
Tom Brady
Enter the students Z number:
Z3425890
Name: Tom Brady
ZNumber: Z3425890
There are 2 students
The class Student should have the following variables
private static int studentCount = 0;
private String studentName;
private String studentZNumber;
The constructor for Student should be overloaded. If it is passed two strings as arguments it
will assign values to the variables studentName and studentZNumber. If it is passed no
arguments then it will prompt the user to enter the Students Name and Z Number.
The static variable studentCount will keep tracking of how many students have been created.
The method StudentProfile() will print out the students name and Z number.
NumStudents() will be a static method that print out how many students have been created.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started