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
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