Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DeliveryPerson {
- public String name;
- public int onTimeDeliveries;
- public DeliveryPerson(String name, int onTimeDeliveries) {
- this.name = name;
- this.onTimeDeliveries = onTimeDeliveries;
- }
- public String toString() {
- return "The name of the delivery person is: " + name + "\nThe number of the successful deliveries is: " + onTimeDeliveries;
- }
- public void deliverOrder(boolean onTime) {
- if (onTime) {
- onTimeDeliveries++;
- System.out.println("The new number of successful deliveries is: " + onTimeDeliveries);
- } else {
- System.out.println(name + " is late.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement