Activity 3.14
Source Code
public class Activity3_14 {
public static void main(String[] args) {
System.out.println("Activity 3.14");
// Example 1
}
}
PetRobot.java
public class PetRobot {
// instance variables
private String name;
private int batteryLevel; // 0–100 %
// constructor
public PetRobot(String name) {
this.name = name;
this.batteryLevel = 100;
}
// getter methods
public String getName() {
return name;
}
public int getBatteryLevel() {
return batteryLevel;
}
// mutator method
public void setBatteryLevel(int batteryLevel) {
this.batteryLevel = batteryLevel;
}
// lightShow
}
Last updated