OOP-Projects-Java

Log | Files | Refs | README

commit 6b9e9d07cd52c517d16acd844b0215102d5227a6
parent fef978b1725346ec6539a2f0232060d814f83d0c
Author: William Lindholm <william_lindholm@outlook.com>
Date:   Wed, 22 Feb 2023 08:59:51 +0100

very minor changes

Diffstat:
MOOP2023_a22willi_a21liltr_assignment3/src/breakRoom/CoffeeMaker.java | 5++---
MOOP2023_a22willi_a21liltr_assignment3/src/breakRoom/Main.java | 2++
MOOP2023_a22willi_a21liltr_assignment3/src/breakRoom/Worker.java | 3+--
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/OOP2023_a22willi_a21liltr_assignment3/src/breakRoom/CoffeeMaker.java b/OOP2023_a22willi_a21liltr_assignment3/src/breakRoom/CoffeeMaker.java @@ -11,7 +11,7 @@ import coffee.Coffee; import coffee.Latte; public class CoffeeMaker extends Thread { - private static int timeScale = 1; // used to change speed of simulation (default = 1). + private static final int timeScale = 100; // used to change speed of simulation (default = 1). private int timeToCreateCoffee = 2000; //the default time it takes the coffeemaker to create one coffee. private int timeToServeCoffee = 1000; //the default time it takes the coffeemaker to serve one cup of coffee. private int coffeBufferSize = 20; //the max amount of coffees the coffeemaker can store. @@ -73,8 +73,7 @@ public class CoffeeMaker extends Thread { /** - * Used to cancel the scheduled task. - * Subsequently closes thread. + * Used to cancel the scheduled tasks. */ public void cancel() { createCoffee.cancel(); diff --git a/OOP2023_a22willi_a21liltr_assignment3/src/breakRoom/Main.java b/OOP2023_a22willi_a21liltr_assignment3/src/breakRoom/Main.java @@ -19,6 +19,8 @@ public class Main extends Thread{ worker4.start(); coffeeMachine.start(); + System.out.println("======Started Simulation====="); + //wait for 20 seconds Thread.sleep(20000); diff --git a/OOP2023_a22willi_a21liltr_assignment3/src/breakRoom/Worker.java b/OOP2023_a22willi_a21liltr_assignment3/src/breakRoom/Worker.java @@ -7,7 +7,7 @@ import java.util.TimerTask; import coffee.Coffee; public class Worker extends Thread { - private static int timeScale = 1; // used to change speed of simulation (default = 1) + private static final int timeScale = 100; // used to change speed of simulation (default = 1) private String name; private int energy; @@ -61,7 +61,6 @@ public class Worker extends Thread { /** * Used to cancel the scheduled task. - * Subsequently closes thread. */ public void cancel() { task.cancel();