package prisoner_student_7_4;

/**
 *
 * @author Almer
 */
public class Prisoner_Student_7_4 {
    String name;
    double height;
    int sentence;

    public Prisoner_Student_7_4(String name, double height, int sentence) {
        this.name = name;
        this.height = height;
        this.sentence = sentence;
    }

    // Zero-argument method to print all fields
    public void printInfo() {
        System.out.println("Name: " + name);
        System.out.println("Height: " + height);
        System.out.println("Sentence: " + sentence);
    }

    // Overloaded method with a boolean argument
    public void printInfo(boolean think) {
        printInfo(); // Call the zero-argument version

        if (think) {
            think();
        }
    }
  
    public void think() {
        System.out.println(name + " is thinking...");
    }
}
   
  
  package prisoner_student_7_4;


public class PrisonTest_Student_7_4 {
  
    public static void main(String[] args){
        
    
       Prisoner_Student_7_4 p01 = new Prisoner_Student_7_4("Bubba", 2.08, 4);

        // Call the first version of the print method
        p01.printInfo();

        // Call the second version of the print method with boolean argument
        p01.printInfo(true);
    }
}