Question: Create a class called student, this class contains: Three private instance variables: age(date type: int) ,name (date type: String) and Major(date type: String); Two overloaded

Create a class called student, this class contains: Three private instance variables: age(date type: int) ,name (date type: String) and Major(date type: String); Two overloaded constructors: the first constructor doesn't have parameters , it sets both age, name and Major to default (age: 20, name: Tom, Major: IT); The second constructor has three parameters, these three parameters can initialize both age, name and Major as specified. Three public methods: getName():A public method for retrieving student's name; setAge(int studentage):A public method that sets the age of the student. getCollegeName(): return student's college name( return Strome if student's major is IT , Marketing , Finance or Management, return Sciences if student's major is CS or Physics, return others if student's major is not on the list above) The class should contain a main() method which tests two overloaded constructors and three public methods: getName(), setAge(int studentage)and getCollegeName()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!