Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions