Question: Unit 6-7 Free Response Write four methods : Using the PinnaclePerson class write the four missing methods according to the comments written with each method

Unit 6-7 Free Response

Write four methods :

  • Using the PinnaclePerson class write the four missing methods according to the comments written with each method

public class PinnaclePerson {

private boolean isStudent;

private int elective;

private String option1;

private String option2;

public PinnaclePerson(boolean s, int e) {

isStudent = s;

elective = e;

}

// print "student" if isStudent is true

// otherwise prints "not a student"

public void student() {

}

// Print the string based on the value of elective

// 1 = "Computer Science"

// 2 = "Art"

// 3 = "Business"

// 4 = "Music"

public void printElective()

{

}

// Store the elective choice in option1 based on the values of

// isStudent and elective, if isStudent is true, store in option1 a

// string indicating the student's elective

// For example, if isStudent is true and elective is 2,

// the following string should be store in option1

// "Thanks for being a student. You are enrolled in Art."

// If isStudent is false, the following string should be stored in

// option1 regardless of the value of elective

// "Sorry you aren't a student at Pinnacle"

public void setOption1() {

}

// Return true if the strings option1 and option2 contain the same

// value and return false otherwise.

public boolean checkOptions() {

}

}

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!