Lesson Plan: Java Program on Fishing with Constructors and Methods

Lesson Objectives

Lesson Outline

1. Introduction (10 minutes)

Brief discussion on OOP concepts, constructors, and methods.

2. Explanation of the Program Structure (15 minutes)

Discussion of the FishingTrip and FishingApp classes.

3. Writing the Code Together (20 minutes)

FishingTrip.java

public class FishingTrip {
    private String location;
    private int fishCaught;
    private String weather;

    public FishingTrip() {
        this.location = "Unknown";
        this.fishCaught = 0;
*************** insert the correct Code ***********
    }

    public FishingTrip(String location, int fishCaught) {
        this.location = location;
*************** insert the correct Code ***********
    }

    public FishingTrip(String location, int fishCaught, String weather) {
*************** insert the correct Code ***********
        this.weather = weather;
    }

    public void displayTripDetails() {
*************** insert the correct Code ***********
    }

    public void catchFish(int newFish) {
        this.fishCaught += newFish;
   *************** insert the correct Code ***********
    }

    public void changeWeather(String newWeather) {
        this.weather = newWeather;
        System.out.println("Weather updated to: " + this.weather);
    }
}
    

FishingApp.java

public class FishingApp {
    public static void main(String[] args) {
        FishingTrip trip1 = new FishingTrip();
*************** insert the correct Code ***********
        trip3.changeWeather("Rainy");
    }
}
    

4. Running and Testing the Program (10 minutes)

Compile and run FishingApp.java. Observe outputs showing different fishing trip scenarios.

Lesson Summary

We built a Java program with a fishing-related theme using constructors and methods.

Expected Output

Trip 1:
Fishing Trip Location: Unknown
Fish Caught: 0
Weather Condition: Sunny

Trip 2:
Fishing Trip Location: Lake Superior
Fish Caught: 5
Weather Condition: Cloudy
New total fish caught: 8

Trip 3:
Fishing Trip Location: Pacific Ocean
Fish Caught: 10
Weather Condition: Windy
Weather updated to: Rainy
    

Homework/Extra Practice


You will drop off 5 files into Google Classroom:
	• Your files will be: (Remember the python program is dropped off first.)
		• PX_lastname_Fishing.java (Java program that is instantiated)
		• PX_lastname_FishingTester.java (Java program that instantiates the object)
		• PX_lastname_Fishing.png (Screenshot of class notes)
		• PX_lastname_Fishing.png (Screenshot inside Eclipse)
		• PX_lastname_Fishing.mp4 (Video running the program)

            
                 If you do not understand this assignment,
                 ask Mr. Cusack and/or attend tutorials.