Print the year state variable


Create a class called StudentInfo. It should have the following properties:
1. Three state variables:
int year... representing the student's year in school
int points... how many points the student has in the class
String name... the name of the student
2. Constructor should accept two parameters.
a. One should be an int variable used to initialize the state variable: year.
b. The other should be a String that is used to initialize the state variable: name.
c. The constructor should also initialize the state variable points to 0.
3. Create two methods:
a. changeYr... returns nothing... accepts an int that is the new year for the student. The method changes year to the new year.
b. addPoints ... returns nothing... accepts an int that is the amount of points being added. It is added to points to produce a new points total for the student.
Create a Tester class that has a main( ) method. In that method you should input from the keyboard the current year (11) in school for the student (via the constructor) along with the name (Sally Jones) of the student.
1. Use these two pieces of data from the keyboard to create a new StudentInfo object called student1.
2. Call the changeYr method to change the year to 12.
3. Print the year state variable.
4. Call the addPoints method to add 75 points to the student's points.
5. Print the student's information in this form:

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Print the year state variable
Reference No:- TGS0116711

Expected delivery within 24 Hours