Question: CompSci 251: Intermediate Computer Programming Spring 2017 -Java Lab 5 For this lab we will be looking at static, or class variables. Remember that where
CompSci 251: Intermediate Computer Programming Spring 2017 -Java
Lab 5
For this lab we will be looking at static, or class variables. Remember that where instances variables are associated with a particular instance, static variables are associated with the particular class. Specifically, if there are n instances of a class, there are n copies of an instance variable, but exactly one copy of a static variable (even when n = 0).
| Student |
| - uniqueId : int - id: int - name: String |
| + Student(name: String) + getName(): String + setName(name: String) + getId() + toString(): String + equals(other: Object): boolean |
Create a Student class conforming to the diagram above. Each student instance has a distinct ID which is not the same as any other student. In order to ensure we dont assign duplicate IDs, we keep track of all the IDs weve assigned in a static variable uniqueId. Every time a student is created, this value is changed.
For the equals method, it returns true when the current object and the argument hold other Person object have the same id in their id instance variables and have the same names.
Create a driver that asks the user, in a loop, for a students name. You should create an instance of your Student class and print the new student to the console. You should stop when the user enters the word "quit".

Student uniqueld: int - id: int name: String + Student (name: String) + getName): String +set Name(name: String) + getld +toString0: String + equals(other: Object): boolean
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
