Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java class President { String firstName; String lastName; String academicLevel; //constructor President() { firstName=?; lastName=?; academicLevel=?; } //Accessor methods public String getFirstName(){ return firstName; }

image text in transcribed
image text in transcribed
Java class President { String firstName; String lastName; String academicLevel; //constructor President() { firstName="?"; lastName="?"; academicLevel="?"; } //Accessor methods public String getFirstName(){ return firstName; } public String getLastName(){ return lastName; } public String getAcademicLevel(){ return academicLevel; } //mutator methods public void setFirstName(String fname){ firstName=fname; } public void setLastName(String lname){ lastName=lname; } public void setAcademicLevel(String level){ academicLevel=level; } public String toString(){ return this.getLastName()+","+this.getFirstName()+"("+this.getAcademicLevel()+")"; } }//end of President class public class Main { public static void main(String[] args) { President obj=new President(); obj.setFirstName("Bob"); obj.setLastName("Water"); obj.setAcademicLevel("Senior"); System.out.println(obj); } } JUSCHPUn.html (3.2 KB) Club class The Club class describes a club. It has the following attributes Attribute name Attribute type Description clubName String The name of the Club number of Members int The number of members of the club university string The university of the club current President President The current president of the club The following constructor should be provided to initialize each attribute. This constructor initializes the value of string attributes to "?" and the value of integer attribute to 0, and an object of President using the constructor of the President class. public club) The following access methods should be provided to get the attributes public String getClubName() public int get Number of Members public String get University) public President getCurrent President The following modifier(mutator) methods should be provided to change the attributes public void setClubName(String someName) public void setNumberOfMembers(int someNumber) public void setuniversity (String some University) public void setCurrent President (string firsthame, string lastName, String some level The following accessor methods should be provided to get the attributes: public String getClubName () public int getNumberOfMembers() public String getUniversity) public President getCurrent President () The following modifier(mutator) methods should be provided to change the attributes: public void setClubName (String someName) public void setNumberOfMembers(int someNumber) public void setUniversity (String some University) public void setCurrent President(String firstName, String lastName, String some Level) The following method must be defined: public String toString() The toString method constructs a string of the following format: Inclub Name :tit Swimming Clubin Number of Members:\t87 University: \t\tArizona State Universityin President: titWater, Bob (Senior) inin

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analytics And Quality Management Fundamental Tools

Authors: Joseph Nguyen

1st Edition

B0CNGG3Y2W, 979-8862833232

More Books

Students also viewed these Databases questions