Week 5

Week5.java

import java.util.*;

public class Week5 {
    public static void main(String[] args) {
        String myName = ""; // add your name
        System.out.println("Week 5");
        System.out.println("Name: " + myName);

        // Create an object of the Dog class
       

        // Call the void methods
      
      
        // Create an object of the Greeting class


        // Call the void methods with arguments


        // Create an object of BankAccount class

    }
}

Dog.java

public class Dog {

    // A void method that makes the dog bark
    

    // A void method that makes the dog wag its tail
    

    // A void method that makes the dog roll over
    


}

Cat.java

public class Cat {

    // Private instance variable of the cat's name
    private String name;
    
    // Private instance variable to track the cat's hunger level
    private int hungerLevel;

    // Constructor to initialize the name and hunger level



    // A void method to feed the cat (decrease hunger level)


    // A void method to make the cat play (increase hunger level)


    // A void method to display the current hunger level



}

Battery.java

public class Battery {

    // Private instance variable to keep track of the battery charge level
    private int chargeLevel;

    // Constructor to initialize the charge level


    // A void method to charge the battery (increase charge level)


    // A void method to use the battery (decrease charge level)


    // A void method to reset the battery charge level


    // A method to display the current charge level
    public void displayChargeLevel() {
        System.out.println("Current charge level: " + chargeLevel + "%");
    }
}

Greeting.java

public class Greeting {

    // Void method with a single parameter
 
    // Void method with two parameters


}

Calculator.java

public class Calculator {

    // void addNumbers method with two parameters
    

    // void multiplyNumbers method with two parameters
    

}

Song.java

public class Song {
    public void printTitle(String title) {
    
    }
    public void printAuthor(String author) {
    
    }
    public void printSong() {
    
    }
    public void printVerse() {
    
    }
    public void printChorus() {
    
    }
}

BankAccount.java

public class BankAccount {

    // private instance variable

    // constructors

    // methods
   

}

Last updated

Was this helpful?