diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..41f560e
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,19 @@
+# Normalise line endings. The repository was written on Windows in 2017 and most
+# sources are still CRLF, which shows up as whole-file diffs for anyone on Linux
+# or macOS. Text is stored LF in the repository and checked out native.
+* text=auto
+
+*.java text diff=java
+*.md text
+*.xml text
+*.yml text
+*.properties text
+
+*.classpath text
+*.project text
+*.iml text
+
+*.png binary
+*.jpg binary
+*.gif binary
+*.jar binary
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..e8055f4
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,33 @@
+# Builds every example on the Java release named in pom.xml, on all three
+# desktop operating systems a student might be using. Its job is to notice when
+# a future JDK stops accepting this code, rather than leaving it to be found
+# years later.
+name: build
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ workflow_dispatch:
+ schedule:
+ - cron: "0 6 1 * *" # monthly, so bit-rot surfaces without a push
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up JDK 25
+ uses: actions/setup-java@v4
+ with:
+ distribution: temurin
+ java-version: '25'
+ cache: maven
+
+ - name: Build
+ run: mvn -B --no-transfer-progress clean compile
diff --git a/.gitignore b/.gitignore
index 2a13d10..9059538 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,4 +50,9 @@ local.properties
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
-.worksheet
\ No newline at end of file
+.worksheet
+# Maven
+target/
+
+# IntelliJ per-user state (layout, open tabs, local paths)
+.idea/workspace.xml
diff --git a/ConsoleApps/pom.xml b/ConsoleApps/pom.xml
new file mode 100644
index 0000000..12d0dae
--- /dev/null
+++ b/ConsoleApps/pom.xml
@@ -0,0 +1,22 @@
+
+
+
+ 4.0.0
+
+
+ beam.example
+ java-app-examples
+ 1.2.0
+
+
+ console-apps
+ Console Examples
+
+
+
+ src
+
+
+
diff --git a/ConsoleApps/src/beam/example/airline/reservation/AirlineReservationDriver.java b/ConsoleApps/src/beam/example/airline/reservation/AirlineReservationDriver.java
index b4d41ad..5579dd4 100644
--- a/ConsoleApps/src/beam/example/airline/reservation/AirlineReservationDriver.java
+++ b/ConsoleApps/src/beam/example/airline/reservation/AirlineReservationDriver.java
@@ -1,157 +1,157 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Airline Reservation Driver
- *
- */
-package beam.example.airline.reservation;
-
-import java.util.Scanner;
-import java.util.Arrays;
-import java.util.Random;
-
-class AirlineReservationDriver
-{
- public static void main(String[] args)
- {
- // initialize process variables
- int economySeats = 0;
- int firstSeats = 0;
- int userSelect;
-
- // initialize 10 seat primitive boolean single-dimension array
- boolean[] flight = new boolean[10];
-
- // set all values to "false", indicating an empty seat
- Arrays.fill(flight, false);
-
- // initialize input scanner
- Scanner input = new Scanner(System.in);
-
- // generate a flight number
- Random rand = new Random();
- int low = 100;
- int high = 1000;
- int flightNumber = rand.nextInt(high-low) + low;
-
- // print the header
- AirlineReservationDriver.airlineHeader(flightNumber);
-
- // start seat selection: 1 for First Class, 2 for Economy Class
- // the if statements are a bit of a sledge-hammer, but it works
- while (economySeats + firstSeats < 10)
- {
- // print the select message based on filled seats, then prompts user for input
- AirlineReservationDriver.selectMessage(economySeats, firstSeats);
- System.out.print("- Enter Selection: ");
- userSelect = input.nextInt();
- input.nextLine();
-
- // user selected first class and it's not full
- if ((userSelect == 1) & (firstSeats < 5))
- {
- flight[firstSeats] = true;
- firstSeats++;
- System.out.println("- Bording Pass: seat [" + firstSeats + "]");
- System.out.println("");
- userSelect = 0;
- }
-
- // user selected first class, and it was full
- if (userSelect == 1 & firstSeats == 5)
- {
- System.out.println("\n* First Class if Full. Would you like Economy Seating?");
- System.out.println("- Use 2 For Economy, 3 for Next Fight");
- System.out.print("- Enter Selection: ");
- userSelect = input.nextInt();
- input.nextLine();
-
- }
-
- // user selected economy and it is not full
- if ((userSelect == 2) & (economySeats < 5))
- {
- flight[economySeats + 5] = true;
- economySeats++;
- System.out.println("- Boarding Pass: seat [" + (economySeats + 5) + "]");
- System.out.println("");
- userSelect = 0;
- }
-
- // user selected economy and it is full
- if ((userSelect == 2) & (economySeats == 5))
- {
- System.out.println("\n* Economy if Full. Would you like First Class Seating?");
- System.out.println("- Use 1 for First Class, 3 for Next Fight");
- System.out.print("- Enter Selection: ");
- userSelect = input.nextInt();
- input.nextLine();
- }
-
- if (userSelect == 3)
- {
- System.out.println("\n* Next flight leaves in 3 hours.\n");
- }
-
- // reset userSelect variable
- // userSelect = 0;
-
- } // END - reservation entry while loop
-
- // close scanner to prevent resource leaks
- input.close();
-
- // print airline header and flight is full message
- AirlineReservationDriver.airlineHeader(flightNumber);
- AirlineReservationDriver.fullFlight();
-
- } // END - Main Method
-
-
- // Method: Full Flight
- private static void fullFlight()
- {
- System.out.println("* Flight is now full.");
- System.out.println("* Next flight leaves in 3 hours. ");
- } // END - Full Flight Method
-
-
- // Method: Selection message
- private static void selectMessage(int economySeats, int firstSeats)
- {
- String fSeating = ("- Use 1 for First Class Seating");
- String eSeating = ("- Use 2 for Economy Seating");
- String efSeating = ("- Use 1 First Class, 2 for Economy");
-
- // if both first and economy are open
- if (firstSeats < 5 &economySeats < 5)
- {
- System.out.println(efSeating);
- }
-
- // if first is full and economy is open
- if (firstSeats == 5 & economySeats < 5)
- {
- System.out.println(eSeating);
- }
-
- // if first is open and economy is full
- if (firstSeats < 5 & economySeats == 5)
- {
- System.out.println(fSeating);
- }
- } // END - Select Message
-
-
- // Method: Print Header
- static void airlineHeader(int flightNumber)
- {
- System.out.println("Puddle Jumper Airline Reservation System");
- System.out.println("Flight : PJ" + flightNumber + " HLN to SLC");
- System.out.println("----------------------------------------");
-
- } // END - Airline Header
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Airline Reservation Driver
+ *
+ */
+package beam.example.airline.reservation;
+
+import java.util.Scanner;
+import java.util.Arrays;
+import java.util.Random;
+
+class AirlineReservationDriver
+{
+ public static void main(String[] args)
+ {
+ // initialize process variables
+ int economySeats = 0;
+ int firstSeats = 0;
+ int userSelect;
+
+ // initialize 10 seat primitive boolean single-dimension array
+ boolean[] flight = new boolean[10];
+
+ // set all values to "false", indicating an empty seat
+ Arrays.fill(flight, false);
+
+ // initialize input scanner
+ Scanner input = new Scanner(System.in);
+
+ // generate a flight number
+ Random rand = new Random();
+ int low = 100;
+ int high = 1000;
+ int flightNumber = rand.nextInt(high-low) + low;
+
+ // print the header
+ AirlineReservationDriver.airlineHeader(flightNumber);
+
+ // start seat selection: 1 for First Class, 2 for Economy Class
+ // the if statements are a bit of a sledge-hammer, but it works
+ while (economySeats + firstSeats < 10)
+ {
+ // print the select message based on filled seats, then prompts user for input
+ AirlineReservationDriver.selectMessage(economySeats, firstSeats);
+ System.out.print("- Enter Selection: ");
+ userSelect = input.nextInt();
+ input.nextLine();
+
+ // user selected first class and it's not full
+ if ((userSelect == 1) & (firstSeats < 5))
+ {
+ flight[firstSeats] = true;
+ firstSeats++;
+ System.out.println("- Bording Pass: seat [" + firstSeats + "]");
+ System.out.println("");
+ userSelect = 0;
+ }
+
+ // user selected first class, and it was full
+ if (userSelect == 1 & firstSeats == 5)
+ {
+ System.out.println("\n* First Class if Full. Would you like Economy Seating?");
+ System.out.println("- Use 2 For Economy, 3 for Next Fight");
+ System.out.print("- Enter Selection: ");
+ userSelect = input.nextInt();
+ input.nextLine();
+
+ }
+
+ // user selected economy and it is not full
+ if ((userSelect == 2) & (economySeats < 5))
+ {
+ flight[economySeats + 5] = true;
+ economySeats++;
+ System.out.println("- Boarding Pass: seat [" + (economySeats + 5) + "]");
+ System.out.println("");
+ userSelect = 0;
+ }
+
+ // user selected economy and it is full
+ if ((userSelect == 2) & (economySeats == 5))
+ {
+ System.out.println("\n* Economy if Full. Would you like First Class Seating?");
+ System.out.println("- Use 1 for First Class, 3 for Next Fight");
+ System.out.print("- Enter Selection: ");
+ userSelect = input.nextInt();
+ input.nextLine();
+ }
+
+ if (userSelect == 3)
+ {
+ System.out.println("\n* Next flight leaves in 3 hours.\n");
+ }
+
+ // reset userSelect variable
+ // userSelect = 0;
+
+ } // END - reservation entry while loop
+
+ // close scanner to prevent resource leaks
+ input.close();
+
+ // print airline header and flight is full message
+ AirlineReservationDriver.airlineHeader(flightNumber);
+ AirlineReservationDriver.fullFlight();
+
+ } // END - Main Method
+
+
+ // Method: Full Flight
+ private static void fullFlight()
+ {
+ System.out.println("* Flight is now full.");
+ System.out.println("* Next flight leaves in 3 hours. ");
+ } // END - Full Flight Method
+
+
+ // Method: Selection message
+ private static void selectMessage(int economySeats, int firstSeats)
+ {
+ String fSeating = ("- Use 1 for First Class Seating");
+ String eSeating = ("- Use 2 for Economy Seating");
+ String efSeating = ("- Use 1 First Class, 2 for Economy");
+
+ // if both first and economy are open
+ if (firstSeats < 5 &economySeats < 5)
+ {
+ System.out.println(efSeating);
+ }
+
+ // if first is full and economy is open
+ if (firstSeats == 5 & economySeats < 5)
+ {
+ System.out.println(eSeating);
+ }
+
+ // if first is open and economy is full
+ if (firstSeats < 5 & economySeats == 5)
+ {
+ System.out.println(fSeating);
+ }
+ } // END - Select Message
+
+
+ // Method: Print Header
+ static void airlineHeader(int flightNumber)
+ {
+ System.out.println("Puddle Jumper Airline Reservation System");
+ System.out.println("Flight : PJ" + flightNumber + " HLN to SLC");
+ System.out.println("----------------------------------------");
+
+ } // END - Airline Header
+
} // END - Airline Reservation System
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/animal/sighting/Animal.java b/ConsoleApps/src/beam/example/animal/sighting/Animal.java
index be3e4b1..df9701c 100644
--- a/ConsoleApps/src/beam/example/animal/sighting/Animal.java
+++ b/ConsoleApps/src/beam/example/animal/sighting/Animal.java
@@ -1,88 +1,88 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Class for Animal Sighting
- *
- */
-package beam.example.animal.sighting;
-
-public class Animal
-{
- private String animalName;
- private int animalCount;
-
- // constructor: super, all fields
- public Animal(String animalName, int animalCount) {
- super();
- this.animalName = animalName;
- this.animalCount = animalCount;
- }
-
- // constructor: name only
- public String getAnimalName()
- {
- return animalName;
- }
-
- /* GETTERS and SETTERS */
- public Animal(String animalName) {
- super();
- this.animalName = animalName;
- }
-
- public void setAnimalName(String animalName)
- {
- this.animalName = animalName;
- }
-
- public int getAnimalCount()
- {
- return animalCount;
- }
-
- public void setAnimalCount(int animalCount)
- {
- this.animalCount = animalCount;
- }
-
- // override for hashCode method
- @Override
- public int hashCode()
- {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((animalName == null) ? 0 : animalName.hashCode());
- return result;
- }
-
- // override for equals method
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Animal other = (Animal) obj;
- if (animalName == null)
- {
- if (other.animalName != null)
- return false;
- } else if (!animalName.equals(other.animalName))
- return false;
- return true;
- }
-
- // object toString method
- @Override
- public String toString()
- {
- return "Animal Type: " + animalName + " Count: " + animalCount;
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Class for Animal Sighting
+ *
+ */
+package beam.example.animal.sighting;
+
+public class Animal
+{
+ private String animalName;
+ private int animalCount;
+
+ // constructor: super, all fields
+ public Animal(String animalName, int animalCount) {
+ super();
+ this.animalName = animalName;
+ this.animalCount = animalCount;
+ }
+
+ // constructor: name only
+ public String getAnimalName()
+ {
+ return animalName;
+ }
+
+ /* GETTERS and SETTERS */
+ public Animal(String animalName) {
+ super();
+ this.animalName = animalName;
+ }
+
+ public void setAnimalName(String animalName)
+ {
+ this.animalName = animalName;
+ }
+
+ public int getAnimalCount()
+ {
+ return animalCount;
+ }
+
+ public void setAnimalCount(int animalCount)
+ {
+ this.animalCount = animalCount;
+ }
+
+ // override for hashCode method
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((animalName == null) ? 0 : animalName.hashCode());
+ return result;
+ }
+
+ // override for equals method
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Animal other = (Animal) obj;
+ if (animalName == null)
+ {
+ if (other.animalName != null)
+ return false;
+ } else if (!animalName.equals(other.animalName))
+ return false;
+ return true;
+ }
+
+ // object toString method
+ @Override
+ public String toString()
+ {
+ return "Animal Type: " + animalName + " Count: " + animalCount;
+ }
+
} /* END - Animal Class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/animal/sighting/AnimalDriver.java b/ConsoleApps/src/beam/example/animal/sighting/AnimalDriver.java
index ee958c4..62f754d 100644
--- a/ConsoleApps/src/beam/example/animal/sighting/AnimalDriver.java
+++ b/ConsoleApps/src/beam/example/animal/sighting/AnimalDriver.java
@@ -1,86 +1,86 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Class for Animal Sighting Driver
- *
- */
-package beam.example.animal.sighting;
-
-import java.util.Scanner;
-import java.util.ArrayList;
-
-public class AnimalDriver
-{
- public static void main(String[] args)
- {
- // setup the array list
- ArrayList sighted = new ArrayList();
-
- // start the scanner
- Scanner input = new Scanner(System.in);
-
- // set process variables
- String inputAnimal;
- boolean doneSightSeeing = false;
-
- System.out.println("** Prickly Pear Creek Safari Sight Seeing **");
- System.out.println("--------------------------------------------");
- System.out.println("Enter the animal you see, or quit to exit.");
- System.out.println("");
-
- // start sight seeing loop :-)
- while (!doneSightSeeing)
- {
- System.out.print("Enter Animal : ");
- inputAnimal = input.next().toLowerCase();
- doneSightSeeing = tooManyLions(inputAnimal);
-
- // if we're not scared of the Lions, or tired, keep going
- if (!doneSightSeeing)
- {
- Animal animal = new Animal(inputAnimal);
-
- if (!sighted.contains(animal))
- {
- sighted.add(animal);
- animal.setAnimalCount(+ 1);
- }
- else
- {
- Animal dupeSighting = sighted.get(sighted.indexOf(animal));
- dupeSighting.setAnimalCount(dupeSighting.getAnimalCount() + 1);
- }
- }
- } // end while loop
-
-
- // loop through the arrayList and print what was observed
- System.out.println("");
- System.out.println("Summary of Animals Identified");
- System.out.println("------------------------------------------");
-
- for (Animal animals : sighted)
- {
- System.out.println(animals);
- }
-
- // close the scanner
- input.close();
-
- // just more screen candy
- System.out.println("");
- System.out.println("Thank you for using Prickly Pear Creek Safari");
- }
-
- // get me out of here method
- static boolean tooManyLions(String input)
- {
- String check;
- check = input.toUpperCase();
-
- return check.equals("QUIT");
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Class for Animal Sighting Driver
+ *
+ */
+package beam.example.animal.sighting;
+
+import java.util.Scanner;
+import java.util.ArrayList;
+
+public class AnimalDriver
+{
+ public static void main(String[] args)
+ {
+ // setup the array list
+ ArrayList sighted = new ArrayList();
+
+ // start the scanner
+ Scanner input = new Scanner(System.in);
+
+ // set process variables
+ String inputAnimal;
+ boolean doneSightSeeing = false;
+
+ System.out.println("** Prickly Pear Creek Safari Sight Seeing **");
+ System.out.println("--------------------------------------------");
+ System.out.println("Enter the animal you see, or quit to exit.");
+ System.out.println("");
+
+ // start sight seeing loop :-)
+ while (!doneSightSeeing)
+ {
+ System.out.print("Enter Animal : ");
+ inputAnimal = input.next().toLowerCase();
+ doneSightSeeing = tooManyLions(inputAnimal);
+
+ // if we're not scared of the Lions, or tired, keep going
+ if (!doneSightSeeing)
+ {
+ Animal animal = new Animal(inputAnimal);
+
+ if (!sighted.contains(animal))
+ {
+ sighted.add(animal);
+ animal.setAnimalCount(+ 1);
+ }
+ else
+ {
+ Animal dupeSighting = sighted.get(sighted.indexOf(animal));
+ dupeSighting.setAnimalCount(dupeSighting.getAnimalCount() + 1);
+ }
+ }
+ } // end while loop
+
+
+ // loop through the arrayList and print what was observed
+ System.out.println("");
+ System.out.println("Summary of Animals Identified");
+ System.out.println("------------------------------------------");
+
+ for (Animal animals : sighted)
+ {
+ System.out.println(animals);
+ }
+
+ // close the scanner
+ input.close();
+
+ // just more screen candy
+ System.out.println("");
+ System.out.println("Thank you for using Prickly Pear Creek Safari");
+ }
+
+ // get me out of here method
+ static boolean tooManyLions(String input)
+ {
+ String check;
+ check = input.toUpperCase();
+
+ return check.equals("QUIT");
+ }
+
} /* END - Animal Driver */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/calculate/sales/Product.java b/ConsoleApps/src/beam/example/calculate/sales/Product.java
index ce6af70..eda6e3c 100644
--- a/ConsoleApps/src/beam/example/calculate/sales/Product.java
+++ b/ConsoleApps/src/beam/example/calculate/sales/Product.java
@@ -1,78 +1,78 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Class for Products
- *
- */
-package beam.example.calculate.sales;
-
-class Product {
-
- // initialize variables
- private int productID;
- private double productCost;
-
- // constructor
- Product(int productID, double productCost)
- {
- super();
- this.productID = productID;
- this.productCost = productCost;
- setProductID(0);
- }
-
- /** @return the product ID */
- public int getProductID()
- {
- return productID;
- }
-
- /** @param productID sets the product number */
- public void setProductID(int productID)
- {
- switch (productID)
- {
- case 1:
- setProductCost(2.98);
- break;
-
- case 2:
- setProductCost(4.50);
- break;
-
- case 3:
- setProductCost(9.98);
- break;
-
- case 4:
- setProductCost(4.49);
- break;
-
- case 5:
- setProductCost(6.87);
- break;
-
- default:
- setProductCost(0.00);
- break;
- } // END - Case switch
-
- this.productID = productID;
- }
-
- /** @return returns the product cost based on ID */
- double getProductCost()
- {
- return productCost;
- }
-
- /**
- * @param productCost sets the product cost */
- private void setProductCost(double productCost)
- {
- this.productCost = productCost;
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Class for Products
+ *
+ */
+package beam.example.calculate.sales;
+
+class Product {
+
+ // initialize variables
+ private int productID;
+ private double productCost;
+
+ // constructor
+ Product(int productID, double productCost)
+ {
+ super();
+ this.productID = productID;
+ this.productCost = productCost;
+ setProductID(0);
+ }
+
+ /** @return the product ID */
+ public int getProductID()
+ {
+ return productID;
+ }
+
+ /** @param productID sets the product number */
+ public void setProductID(int productID)
+ {
+ switch (productID)
+ {
+ case 1:
+ setProductCost(2.98);
+ break;
+
+ case 2:
+ setProductCost(4.50);
+ break;
+
+ case 3:
+ setProductCost(9.98);
+ break;
+
+ case 4:
+ setProductCost(4.49);
+ break;
+
+ case 5:
+ setProductCost(6.87);
+ break;
+
+ default:
+ setProductCost(0.00);
+ break;
+ } // END - Case switch
+
+ this.productID = productID;
+ }
+
+ /** @return returns the product cost based on ID */
+ double getProductCost()
+ {
+ return productCost;
+ }
+
+ /**
+ * @param productCost sets the product cost */
+ private void setProductCost(double productCost)
+ {
+ this.productCost = productCost;
+ }
+
} /* END - Product class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/calculate/sales/ProductDriver.java b/ConsoleApps/src/beam/example/calculate/sales/ProductDriver.java
index 2d777c9..a1dd79e 100644
--- a/ConsoleApps/src/beam/example/calculate/sales/ProductDriver.java
+++ b/ConsoleApps/src/beam/example/calculate/sales/ProductDriver.java
@@ -1,127 +1,127 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Driver for Product Sales
- *
- */
-package beam.example.calculate.sales;
-
-import java.util.Scanner;
-
-
-class ProductDriver
-{
- public static void main(String[] args) {
-
- // initialize loop control and quantity variables.
- int pCount;
- int number = 0;
- int p1Count = 0;
- int p2Count = 0;
- int p3Count = 0;
- int p4Count = 0;
- int p5Count = 0;
- int quantity;
- double itemTotal;
-
- // initialize the Scanner.
- Scanner input = new Scanner(System.in);
-
- // start while loop for product and quantity entry.
- while (number != -1)
- {
- // user entry, product ID.
- System.out.print("Enter Product ID (1-5) or (-1) to quit : ");
- number = input.nextInt();
-
- if (number != -1)
- {
- // user entry, product quantity.
- System.out.print("Enter Quantity : ");
- quantity = input.nextInt();
-
- if (number == 1)
- {
- p1Count += quantity;
- }
- if (number == 2)
- {
- p2Count += quantity;
- }
- if (number == 3)
- {
- p3Count += quantity;
- }
- if (number == 4)
- {
- p4Count += quantity;
- }
- if (number == 5)
- {
- p5Count += quantity;
- }
- }
- System.out.print("\n");
- } // END - Entry loop.
-
- // close input scanner to prevent resource leaks
- input.close();
- System.out.println("** End of Product Entry **");
-
- // print summary header
- System.out.print("\nItem Qty\tCosts");
- System.out.print("\n-------------------------");
-
- // create a Product Class instance
- Product value = new Product(0,0.00);
-
- // loop through product number (1-5) and calculate the summaries
- for (int count = 1; count <= 5; count++)
- {
- // set product ID which sets the ProductCost
- value.setProductID(count);
-
- switch (count)
- {
- case 1:
- itemTotal = p1Count * value.getProductCost();
- pCount = p1Count;
- break;
-
- case 2:
- itemTotal = p2Count * value.getProductCost();
- pCount = p2Count;
- break;
-
- case 3:
- itemTotal = p3Count * value.getProductCost();
- pCount = p3Count;
- break;
-
- case 4:
- itemTotal = p4Count * value.getProductCost();
- pCount = p4Count;
- break;
-
- case 5:
- itemTotal = p5Count * value.getProductCost();
- pCount = p5Count;
- break;
-
- default:
- itemTotal = 0.00;
- pCount = 0;
- break;
- } // END - Case switch
-
- // print the product line totals
- System.out.printf("\nProduct-%s %s $%.2f", count, pCount, itemTotal);
-
- } // END - for loop
- System.out.print("\n");
-
- } // END - Main Method
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Driver for Product Sales
+ *
+ */
+package beam.example.calculate.sales;
+
+import java.util.Scanner;
+
+
+class ProductDriver
+{
+ public static void main(String[] args) {
+
+ // initialize loop control and quantity variables.
+ int pCount;
+ int number = 0;
+ int p1Count = 0;
+ int p2Count = 0;
+ int p3Count = 0;
+ int p4Count = 0;
+ int p5Count = 0;
+ int quantity;
+ double itemTotal;
+
+ // initialize the Scanner.
+ Scanner input = new Scanner(System.in);
+
+ // start while loop for product and quantity entry.
+ while (number != -1)
+ {
+ // user entry, product ID.
+ System.out.print("Enter Product ID (1-5) or (-1) to quit : ");
+ number = input.nextInt();
+
+ if (number != -1)
+ {
+ // user entry, product quantity.
+ System.out.print("Enter Quantity : ");
+ quantity = input.nextInt();
+
+ if (number == 1)
+ {
+ p1Count += quantity;
+ }
+ if (number == 2)
+ {
+ p2Count += quantity;
+ }
+ if (number == 3)
+ {
+ p3Count += quantity;
+ }
+ if (number == 4)
+ {
+ p4Count += quantity;
+ }
+ if (number == 5)
+ {
+ p5Count += quantity;
+ }
+ }
+ System.out.print("\n");
+ } // END - Entry loop.
+
+ // close input scanner to prevent resource leaks
+ input.close();
+ System.out.println("** End of Product Entry **");
+
+ // print summary header
+ System.out.print("\nItem Qty\tCosts");
+ System.out.print("\n-------------------------");
+
+ // create a Product Class instance
+ Product value = new Product(0,0.00);
+
+ // loop through product number (1-5) and calculate the summaries
+ for (int count = 1; count <= 5; count++)
+ {
+ // set product ID which sets the ProductCost
+ value.setProductID(count);
+
+ switch (count)
+ {
+ case 1:
+ itemTotal = p1Count * value.getProductCost();
+ pCount = p1Count;
+ break;
+
+ case 2:
+ itemTotal = p2Count * value.getProductCost();
+ pCount = p2Count;
+ break;
+
+ case 3:
+ itemTotal = p3Count * value.getProductCost();
+ pCount = p3Count;
+ break;
+
+ case 4:
+ itemTotal = p4Count * value.getProductCost();
+ pCount = p4Count;
+ break;
+
+ case 5:
+ itemTotal = p5Count * value.getProductCost();
+ pCount = p5Count;
+ break;
+
+ default:
+ itemTotal = 0.00;
+ pCount = 0;
+ break;
+ } // END - Case switch
+
+ // print the product line totals
+ System.out.printf("\nProduct-%s %s $%.2f", count, pCount, itemTotal);
+
+ } // END - for loop
+ System.out.print("\n");
+
+ } // END - Main Method
+
} /* END - ProductDriver class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/domain/purchase/DomainNameRegistration.java b/ConsoleApps/src/beam/example/domain/purchase/DomainNameRegistration.java
index 5651506..3c00b57 100644
--- a/ConsoleApps/src/beam/example/domain/purchase/DomainNameRegistration.java
+++ b/ConsoleApps/src/beam/example/domain/purchase/DomainNameRegistration.java
@@ -1,122 +1,122 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Domain Registration Class implements IPayable
- *
- *
- */
-package beam.example.domain.purchase;
-
-
-public class DomainNameRegistration implements IPayable
-{
- // class variables
- private String ownerName;
- private String domainName;
- private String registrar;
- private double costPerYear;
- private int quantity;
-
- // Constructor
- DomainNameRegistration(
- String ownerName,
- String domainName,
- String registrar,
- double costPerYear,
- int quantity
- )
- {
- this.ownerName = ownerName;
- this.domainName = domainName;
- this.registrar = registrar;
- this.costPerYear = costPerYear;
- this.quantity = quantity;
- }
-
- // Method: Payable, totalDue. implements Payable
- @Override
- public double getTotalDue()
- {
- return getCostPerYear() * quantity;
- }
-
- // return ownerName
- private String getOwnerName()
- {
- return ownerName;
- }
-
- // set ownerName
- private void setOwnerName(String ownerName)
- {
- this.ownerName = ownerName;
- }
-
- // return domainName
- private String getDomainName()
- {
- return domainName;
- }
-
- // set domainName
- private void setDomainName(String domainName)
- {
- this.domainName = domainName;
- }
-
- // return registrar
- private String getRegistrar()
- {
- return registrar;
- }
-
- // set registrar
- private void setRegistrar(String registrar)
- {
- this.registrar = registrar;
- }
-
- // return costPerYear
- private double getCostPerYear()
- {
- return costPerYear;
- }
-
- // set costPerYear
- public void setCostPerYear(double costPerYear)
- {
- this.costPerYear = costPerYear;
- }
-
- // return quantity
- private int getQuantity()
- {
- return quantity;
- }
-
- // set quantity
- private void setQuantity(int quantity)
- {
- this.quantity = quantity;
- }
-
- // print toString
- @Override
- public String toString() {
- return String.format("Type........: Domain Name Registration%n"
- + "Owner.......: %s%n"
- + "Domain......: %s%n"
- + "Registrar...: %s%n"
- + "Yearly Cost.: %.2f%n"
- + "Years.......: %s",
- getOwnerName(),
- getDomainName(),
- getRegistrar(),
- getCostPerYear(),
- getQuantity()
- );
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Domain Registration Class implements IPayable
+ *
+ *
+ */
+package beam.example.domain.purchase;
+
+
+public class DomainNameRegistration implements IPayable
+{
+ // class variables
+ private String ownerName;
+ private String domainName;
+ private String registrar;
+ private double costPerYear;
+ private int quantity;
+
+ // Constructor
+ DomainNameRegistration(
+ String ownerName,
+ String domainName,
+ String registrar,
+ double costPerYear,
+ int quantity
+ )
+ {
+ this.ownerName = ownerName;
+ this.domainName = domainName;
+ this.registrar = registrar;
+ this.costPerYear = costPerYear;
+ this.quantity = quantity;
+ }
+
+ // Method: Payable, totalDue. implements Payable
+ @Override
+ public double getTotalDue()
+ {
+ return getCostPerYear() * quantity;
+ }
+
+ // return ownerName
+ private String getOwnerName()
+ {
+ return ownerName;
+ }
+
+ // set ownerName
+ private void setOwnerName(String ownerName)
+ {
+ this.ownerName = ownerName;
+ }
+
+ // return domainName
+ private String getDomainName()
+ {
+ return domainName;
+ }
+
+ // set domainName
+ private void setDomainName(String domainName)
+ {
+ this.domainName = domainName;
+ }
+
+ // return registrar
+ private String getRegistrar()
+ {
+ return registrar;
+ }
+
+ // set registrar
+ private void setRegistrar(String registrar)
+ {
+ this.registrar = registrar;
+ }
+
+ // return costPerYear
+ private double getCostPerYear()
+ {
+ return costPerYear;
+ }
+
+ // set costPerYear
+ public void setCostPerYear(double costPerYear)
+ {
+ this.costPerYear = costPerYear;
+ }
+
+ // return quantity
+ private int getQuantity()
+ {
+ return quantity;
+ }
+
+ // set quantity
+ private void setQuantity(int quantity)
+ {
+ this.quantity = quantity;
+ }
+
+ // print toString
+ @Override
+ public String toString() {
+ return String.format("Type........: Domain Name Registration%n"
+ + "Owner.......: %s%n"
+ + "Domain......: %s%n"
+ + "Registrar...: %s%n"
+ + "Yearly Cost.: %.2f%n"
+ + "Years.......: %s",
+ getOwnerName(),
+ getDomainName(),
+ getRegistrar(),
+ getCostPerYear(),
+ getQuantity()
+ );
+ }
+
} /* END - Domain Name Registration Class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/domain/purchase/IPayable.java b/ConsoleApps/src/beam/example/domain/purchase/IPayable.java
index ac16278..69170f2 100644
--- a/ConsoleApps/src/beam/example/domain/purchase/IPayable.java
+++ b/ConsoleApps/src/beam/example/domain/purchase/IPayable.java
@@ -1,18 +1,18 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Payable Interface
- *
- */
-package beam.example.domain.purchase;
-
-interface IPayable
-{
- // calculate the payment of something
- default double getTotalDue() {
- return 0;
- }
-
-} /* END - Payable Interface */
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Payable Interface
+ *
+ */
+package beam.example.domain.purchase;
+
+interface IPayable
+{
+ // calculate the payment of something
+ default double getTotalDue() {
+ return 0;
+ }
+
+} /* END - Payable Interface */
diff --git a/ConsoleApps/src/beam/example/domain/purchase/LegalServiceBill.java b/ConsoleApps/src/beam/example/domain/purchase/LegalServiceBill.java
index 0b31a41..412c5e1 100644
--- a/ConsoleApps/src/beam/example/domain/purchase/LegalServiceBill.java
+++ b/ConsoleApps/src/beam/example/domain/purchase/LegalServiceBill.java
@@ -1,149 +1,149 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Legal Service Bill Class implements IPayable
- *
- *
- */
-package beam.example.domain.purchase;
-
-public class LegalServiceBill implements IPayable
-{
- // Class variables
- private String caseName;
- private String caseNumber;
- private double hours;
- private double rate;
- private double expenses;
- private boolean status;
-
- // Constructor
- LegalServiceBill(
- String caseName,
- String caseNumber,
- double hours,
- double rate,
- double expenses,
- boolean status
- )
- {
- this.caseName = caseName;
- this.caseNumber = caseNumber;
- this.hours = hours;
- this.rate = rate;
- this.expenses = expenses;
- this.status = status;
- }
-
- // Method: Payable, totalDue. implements Payable
- @Override
- public double getTotalDue()
- {
- double amount;
-
- if (!isStatus())
- {
- amount = (getHours() * getRate()) + getExpenses();
- }
- else
- {
- amount = 0.0; // return 0.00 if paid (isStatus) is true
- }
-
- return amount;
- }
-
- // return caseName
- private String getCaseName()
- {
- return caseName;
- }
-
- // set caseName
- public void setCaseName(String caseName)
- {
- this.caseName = caseName;
- }
-
- // return caseNumber
- private String getCaseNumber()
- {
- return caseNumber;
- }
-
- // set caseNumber
- public void setCaseNumber(String caseNumber)
- {
- this.caseNumber = caseNumber;
- }
-
- // return hours
- private double getHours()
- {
- return hours;
- }
-
- // set hours
- public void setHours(double hours)
- {
- this.hours = hours;
- }
-
- // return rate
- private double getRate()
- {
- return rate;
- }
-
- // set rate
- public void setRate(double rate)
- {
- this.rate = rate;
- }
-
- // return expenses
- private double getExpenses()
- {
- return expenses;
- }
-
- // set expenses
- public void setExpenses(double expenses)
- {
- this.expenses = expenses;
- }
-
- // return status
- private boolean isStatus()
- {
- return status;
- }
-
- // set status
- public void setStatus(boolean status)
- {
- this.status = status;
- }
-
- // print toString
- @Override
- public String toString()
- {
- return String.format("Type........: Legal Service%n"
- + "Name........: %s%n"
- + "Number......: %s%n"
- + "Hours.......: %s%n"
- + "Rate........: $%.2f%n"
- + "Expenses....: $%.2f%n"
- + "Paid........: %s",
- getCaseName(),
- getCaseNumber(),
- getHours(),
- getRate(),
- getExpenses(),
- isStatus());
- }
-
-} /* END - Legal Service Bill Class */
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Legal Service Bill Class implements IPayable
+ *
+ *
+ */
+package beam.example.domain.purchase;
+
+public class LegalServiceBill implements IPayable
+{
+ // Class variables
+ private String caseName;
+ private String caseNumber;
+ private double hours;
+ private double rate;
+ private double expenses;
+ private boolean status;
+
+ // Constructor
+ LegalServiceBill(
+ String caseName,
+ String caseNumber,
+ double hours,
+ double rate,
+ double expenses,
+ boolean status
+ )
+ {
+ this.caseName = caseName;
+ this.caseNumber = caseNumber;
+ this.hours = hours;
+ this.rate = rate;
+ this.expenses = expenses;
+ this.status = status;
+ }
+
+ // Method: Payable, totalDue. implements Payable
+ @Override
+ public double getTotalDue()
+ {
+ double amount;
+
+ if (!isStatus())
+ {
+ amount = (getHours() * getRate()) + getExpenses();
+ }
+ else
+ {
+ amount = 0.0; // return 0.00 if paid (isStatus) is true
+ }
+
+ return amount;
+ }
+
+ // return caseName
+ private String getCaseName()
+ {
+ return caseName;
+ }
+
+ // set caseName
+ public void setCaseName(String caseName)
+ {
+ this.caseName = caseName;
+ }
+
+ // return caseNumber
+ private String getCaseNumber()
+ {
+ return caseNumber;
+ }
+
+ // set caseNumber
+ public void setCaseNumber(String caseNumber)
+ {
+ this.caseNumber = caseNumber;
+ }
+
+ // return hours
+ private double getHours()
+ {
+ return hours;
+ }
+
+ // set hours
+ public void setHours(double hours)
+ {
+ this.hours = hours;
+ }
+
+ // return rate
+ private double getRate()
+ {
+ return rate;
+ }
+
+ // set rate
+ public void setRate(double rate)
+ {
+ this.rate = rate;
+ }
+
+ // return expenses
+ private double getExpenses()
+ {
+ return expenses;
+ }
+
+ // set expenses
+ public void setExpenses(double expenses)
+ {
+ this.expenses = expenses;
+ }
+
+ // return status
+ private boolean isStatus()
+ {
+ return status;
+ }
+
+ // set status
+ public void setStatus(boolean status)
+ {
+ this.status = status;
+ }
+
+ // print toString
+ @Override
+ public String toString()
+ {
+ return String.format("Type........: Legal Service%n"
+ + "Name........: %s%n"
+ + "Number......: %s%n"
+ + "Hours.......: %s%n"
+ + "Rate........: $%.2f%n"
+ + "Expenses....: $%.2f%n"
+ + "Paid........: %s",
+ getCaseName(),
+ getCaseNumber(),
+ getHours(),
+ getRate(),
+ getExpenses(),
+ isStatus());
+ }
+
+} /* END - Legal Service Bill Class */
diff --git a/ConsoleApps/src/beam/example/domain/purchase/SoftwareLicense.java b/ConsoleApps/src/beam/example/domain/purchase/SoftwareLicense.java
index 2e026ed..95dacf4 100644
--- a/ConsoleApps/src/beam/example/domain/purchase/SoftwareLicense.java
+++ b/ConsoleApps/src/beam/example/domain/purchase/SoftwareLicense.java
@@ -1,123 +1,123 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Legal Service Bill Class implements IPayable
- *
- *
- */
-package beam.example.domain.purchase;
-
-public class SoftwareLicense implements IPayable
-{
-
- // class variables
- private String ownerName;
- private int productId;
- private String description;
- private double costPerSeat;
- private int quantity;
-
- // Constructor
- SoftwareLicense(
- String ownerName,
- int productId,
- String description,
- double costPerSeat,
- int quantity
- )
- {
- this.ownerName = ownerName;
- this.productId = productId;
- this.description = description;
- this.costPerSeat = costPerSeat;
- this.quantity = quantity;
- }
-
- // Method: Payable, totalDue. implements Payable
- @Override
- public double getTotalDue()
- {
- return getCostPerSeat() * quantity;
- }
-
- // return ownerName
- private String getOwnerName()
- {
- return ownerName;
- }
-
- // set ownerName
- public void setOwnerName(String ownerName)
- {
- this.ownerName = ownerName;
- }
-
- // return productId
- private int getProductId()
- {
- return productId;
- }
-
- // set productId
- public void setProductId(int productId)
- {
- this.productId = productId;
- }
-
- // return description
- public String getDescription()
- {
- return description;
- }
-
- // set description
- public void setDescription(String description)
- {
- this.description = description;
- }
-
- // return costPerSeat
- private double getCostPerSeat()
- {
- return costPerSeat;
- }
-
- // set costPerSeat
- public void setCostPerSeat(double costPerSeat)
- {
- this.costPerSeat = costPerSeat;
- }
-
- // return quantity
- private int getQuantity()
- {
- return quantity;
- }
-
- // set quantity
- public void setQuantity(int quantity)
- {
- this.quantity = quantity;
- }
-
- // print toString
- @Override
- public String toString()
- {
- return String.format("Type........: Software License%n"
- + "Owner.......: %s%n"
- + "Product ID..: %s%n"
- + "Description : %s%n"
- + "Seat Cost...: %.2f%n"
- + "Quantity....: %s",
- getOwnerName(),
- getProductId(),
- getDescription(),
- getCostPerSeat(),
- getQuantity()
- );
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Legal Service Bill Class implements IPayable
+ *
+ *
+ */
+package beam.example.domain.purchase;
+
+public class SoftwareLicense implements IPayable
+{
+
+ // class variables
+ private String ownerName;
+ private int productId;
+ private String description;
+ private double costPerSeat;
+ private int quantity;
+
+ // Constructor
+ SoftwareLicense(
+ String ownerName,
+ int productId,
+ String description,
+ double costPerSeat,
+ int quantity
+ )
+ {
+ this.ownerName = ownerName;
+ this.productId = productId;
+ this.description = description;
+ this.costPerSeat = costPerSeat;
+ this.quantity = quantity;
+ }
+
+ // Method: Payable, totalDue. implements Payable
+ @Override
+ public double getTotalDue()
+ {
+ return getCostPerSeat() * quantity;
+ }
+
+ // return ownerName
+ private String getOwnerName()
+ {
+ return ownerName;
+ }
+
+ // set ownerName
+ public void setOwnerName(String ownerName)
+ {
+ this.ownerName = ownerName;
+ }
+
+ // return productId
+ private int getProductId()
+ {
+ return productId;
+ }
+
+ // set productId
+ public void setProductId(int productId)
+ {
+ this.productId = productId;
+ }
+
+ // return description
+ public String getDescription()
+ {
+ return description;
+ }
+
+ // set description
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ // return costPerSeat
+ private double getCostPerSeat()
+ {
+ return costPerSeat;
+ }
+
+ // set costPerSeat
+ public void setCostPerSeat(double costPerSeat)
+ {
+ this.costPerSeat = costPerSeat;
+ }
+
+ // return quantity
+ private int getQuantity()
+ {
+ return quantity;
+ }
+
+ // set quantity
+ public void setQuantity(int quantity)
+ {
+ this.quantity = quantity;
+ }
+
+ // print toString
+ @Override
+ public String toString()
+ {
+ return String.format("Type........: Software License%n"
+ + "Owner.......: %s%n"
+ + "Product ID..: %s%n"
+ + "Description : %s%n"
+ + "Seat Cost...: %.2f%n"
+ + "Quantity....: %s",
+ getOwnerName(),
+ getProductId(),
+ getDescription(),
+ getCostPerSeat(),
+ getQuantity()
+ );
+ }
+
} /* END - Software License */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/gross/pay/CommissionEmployee.java b/ConsoleApps/src/beam/example/gross/pay/CommissionEmployee.java
index a3488e0..1995c0a 100644
--- a/ConsoleApps/src/beam/example/gross/pay/CommissionEmployee.java
+++ b/ConsoleApps/src/beam/example/gross/pay/CommissionEmployee.java
@@ -1,72 +1,72 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Commission Employee Class extends (is-a) Employee Class
- *
- */
-package beam.example.gross.pay;
-
-public class CommissionEmployee extends Employee
-{
- // subclass variables
- private double grossSales;
- private double commissionRate;
-
- // Constructor, super must be the first line
- CommissionEmployee(
- String firstName,
- String lastName,
- String employeeId,
- double grossSales,
- double commissionRate
- )
- {
- super(firstName, lastName, employeeId);
- this.grossSales = grossSales;
- this.commissionRate = commissionRate;
- }
-
- // Method: calculatePayment
- // overrides abstract method calculatePayment in Employee abstract class
- @Override
- public double calculatePayment()
- {
- return getCommissionRate() * getGrossSales();
- }
-
- // return grossSales
- double getGrossSales()
- {
- return grossSales;
- }
-
- // set grossSales
- public void setGrossSales(double grossSales)
- {
- this.grossSales = grossSales;
- }
-
- // return commissionRate
- double getCommissionRate()
- {
- return commissionRate;
- }
-
- // set commissionRate
- public void setCommissionRate(double commissionRate)
- {
- this.commissionRate = commissionRate;
- }
-
- @Override
- public String toString()
- {
- return String.format("Commission Employee -> %s%n%s....: $%.2f",
- super.toString(),
- "Gross Sales", getGrossSales(),
- "Commision Rate", getCommissionRate());
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Commission Employee Class extends (is-a) Employee Class
+ *
+ */
+package beam.example.gross.pay;
+
+public class CommissionEmployee extends Employee
+{
+ // subclass variables
+ private double grossSales;
+ private double commissionRate;
+
+ // Constructor, super must be the first line
+ CommissionEmployee(
+ String firstName,
+ String lastName,
+ String employeeId,
+ double grossSales,
+ double commissionRate
+ )
+ {
+ super(firstName, lastName, employeeId);
+ this.grossSales = grossSales;
+ this.commissionRate = commissionRate;
+ }
+
+ // Method: calculatePayment
+ // overrides abstract method calculatePayment in Employee abstract class
+ @Override
+ public double calculatePayment()
+ {
+ return getCommissionRate() * getGrossSales();
+ }
+
+ // return grossSales
+ double getGrossSales()
+ {
+ return grossSales;
+ }
+
+ // set grossSales
+ public void setGrossSales(double grossSales)
+ {
+ this.grossSales = grossSales;
+ }
+
+ // return commissionRate
+ double getCommissionRate()
+ {
+ return commissionRate;
+ }
+
+ // set commissionRate
+ public void setCommissionRate(double commissionRate)
+ {
+ this.commissionRate = commissionRate;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.format("Commission Employee -> %s%n%s....: $%.2f",
+ super.toString(),
+ "Gross Sales", getGrossSales(),
+ "Commision Rate", getCommissionRate());
+ }
+
} /* END - Commission Employee Subclass */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/gross/pay/Employee.java b/ConsoleApps/src/beam/example/gross/pay/Employee.java
index 76d64b6..0793d30 100644
--- a/ConsoleApps/src/beam/example/gross/pay/Employee.java
+++ b/ConsoleApps/src/beam/example/gross/pay/Employee.java
@@ -1,58 +1,58 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Employee Abstract Class
- *
- */
-package beam.example.gross.pay;
-
-public abstract class Employee
-{
- private final String firstName;
- private final String lastName;
- private final String employeeId;
-
- // Constructor
- Employee(
- String firstName,
- String lastName,
- String employeeId
- )
- {
- this.firstName = firstName;
- this.lastName = lastName;
- this.employeeId = employeeId;
- }
-
- // Method: calculatePayment
- // Abstract method, must be overridden by concrete subclasses
- public abstract double calculatePayment();
-
- // return firstName
- String getFirstName()
- {
- return firstName;
- }
-
- // return lastName
- String getLastName()
- {
- return lastName;
- }
-
- // return employeeID
- String getEmployeeId()
- {
- return employeeId;
- }
-
- // return String for Employee Object
- @Override
- public String toString()
- {
- return String.format("%s %s%nEmployee ID....: %s ", getFirstName(), getLastName(), getEmployeeId());
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Employee Abstract Class
+ *
+ */
+package beam.example.gross.pay;
+
+public abstract class Employee
+{
+ private final String firstName;
+ private final String lastName;
+ private final String employeeId;
+
+ // Constructor
+ Employee(
+ String firstName,
+ String lastName,
+ String employeeId
+ )
+ {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.employeeId = employeeId;
+ }
+
+ // Method: calculatePayment
+ // Abstract method, must be overridden by concrete subclasses
+ public abstract double calculatePayment();
+
+ // return firstName
+ String getFirstName()
+ {
+ return firstName;
+ }
+
+ // return lastName
+ String getLastName()
+ {
+ return lastName;
+ }
+
+ // return employeeID
+ String getEmployeeId()
+ {
+ return employeeId;
+ }
+
+ // return String for Employee Object
+ @Override
+ public String toString()
+ {
+ return String.format("%s %s%nEmployee ID....: %s ", getFirstName(), getLastName(), getEmployeeId());
+ }
+
} /* END - Employee Abstract Super Class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/gross/pay/GrossPayDriver.java b/ConsoleApps/src/beam/example/gross/pay/GrossPayDriver.java
index 791053f..ff41700 100644
--- a/ConsoleApps/src/beam/example/gross/pay/GrossPayDriver.java
+++ b/ConsoleApps/src/beam/example/gross/pay/GrossPayDriver.java
@@ -1,165 +1,165 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Gross Pay calculator based on pay type
- * H = Hourly
- * S = Salary
- * C = Commission
- *
- * Note: This example demonstrates a basic (is-a) relationship.
- * In OOP terms, object classes can extend other object classes.
- * In this case, Hourly, Salary, and Commission (is-a) Employee.
- * By extending the Employee class, each extended class must also
- * implement any abstract methods the partent class describes.
- * Employee requires each class implement the calculatePayment()
- * method.
- *
- */
-package beam.example.gross.pay;
-
-import java.util.Scanner;
-
-public class GrossPayDriver
-{
-
- // Method: Main
- public static void main(String[] args)
- {
- // main method variables
- int empCount;
- String empType;
- String empFirst;
- String empLast;
- String empId;
- double empWage;
- double empHours;
- double empSalary;
- double empSales;
- double empRate;
- double totalPay = 0;
-
- // start the scanner
- Scanner input = new Scanner(System.in);
-
- // start user input
- System.out.println("Employee Pay Calculator");
- System.out.println("H = Hourly, S = Salary, C = Commission\n");
-
- // how many employee's to process
- System.out.print("Number of Employee's.......: ");
- empCount = input.nextInt();
- System.out.println("");
-
- // create object array based on empCount
- Employee[] employees = new Employee[empCount];
-
- // start employee entry loop
- for (int counter = 0; counter < empCount; counter++)
- {
- // type of employee
- System.out.printf("Employee-%s Type (H, S, C)..: ", (counter + 1));
- empType = input.next().toUpperCase();
- input.nextLine();
-
- // employee's first name
- System.out.print("First Name ................: ");
- empFirst = input.next();
- input.nextLine();
-
- // employee's last name
- System.out.print("Last Name .................: ");
- empLast = input.next();
- input.nextLine();
-
- // employee's ID
- System.out.print("Employee ID ...............: ");
- empId = input.next();
- input.nextLine();
-
- // switch for Hourly, Salary, and Commission based on empType
- switch (empType)
- {
- case "H": // hourly employee
- System.out.print("Hourly Rate ...............: ");
- empWage = input.nextDouble();
-
- System.out.print("Hours Worked ..............: ");
- empHours = input.nextDouble();
-
- // create the HourlyEmployee Object
- HourlyEmployee hourly = new HourlyEmployee(
- empFirst,
- empLast,
- empId,
- empWage,
- empHours);
-
- // add hourly object to employees array
- employees[counter] = hourly;
-
- break;
-
- case "S": // salary employee
- System.out.print("Weekly Salary .............: ");
- empSalary = input.nextDouble();
-
- // create the SalariedEmployee Object
- SalariedEmployee salary = new SalariedEmployee(
- empFirst,
- empLast,
- empId,
- empSalary);
-
- // add salaried object to employees array
- employees[counter] = salary;
-
- break;
-
- case "C": // commission employee
- System.out.print("Employee Sales ............: ");
- empSales = input.nextDouble();
-
- System.out.print("Commision Rate ..........: ");
- empRate = input.nextDouble();
-
- // create the CommissionEmployee Object
- CommissionEmployee commission = new CommissionEmployee(
- empFirst,
- empLast,
- empId,
- empSales,
- empRate);
-
- // add commission object to employees array
- employees[counter] = commission;
-
- break;
-
- } // END - Case switch
- System.out.println(""); // separates entries
-
- } // END - Entry For Loop
-
- // close the scanner to prevent resource leaks
- input.close();
-
- // for loop to print individual employee summaries
- for (Employee employee : employees) {
-
- System.out.print(employee); // calls the Employee class toString()
- System.out.printf("\nEmployee Pay...: $%.2f", employee.calculatePayment());
- System.out.println("\n");
-
- // add employee's pay to totalPay
- totalPay += employee.calculatePayment();
-
- } // END - Employee Summary For Loop
-
- // print total pay for all employee's
- System.out.printf("\nTotal Pay......: $%.2f", totalPay);
-
- } /* END - Main Method */
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Gross Pay calculator based on pay type
+ * H = Hourly
+ * S = Salary
+ * C = Commission
+ *
+ * Note: This example demonstrates a basic (is-a) relationship.
+ * In OOP terms, object classes can extend other object classes.
+ * In this case, Hourly, Salary, and Commission (is-a) Employee.
+ * By extending the Employee class, each extended class must also
+ * implement any abstract methods the partent class describes.
+ * Employee requires each class implement the calculatePayment()
+ * method.
+ *
+ */
+package beam.example.gross.pay;
+
+import java.util.Scanner;
+
+public class GrossPayDriver
+{
+
+ // Method: Main
+ public static void main(String[] args)
+ {
+ // main method variables
+ int empCount;
+ String empType;
+ String empFirst;
+ String empLast;
+ String empId;
+ double empWage;
+ double empHours;
+ double empSalary;
+ double empSales;
+ double empRate;
+ double totalPay = 0;
+
+ // start the scanner
+ Scanner input = new Scanner(System.in);
+
+ // start user input
+ System.out.println("Employee Pay Calculator");
+ System.out.println("H = Hourly, S = Salary, C = Commission\n");
+
+ // how many employee's to process
+ System.out.print("Number of Employee's.......: ");
+ empCount = input.nextInt();
+ System.out.println("");
+
+ // create object array based on empCount
+ Employee[] employees = new Employee[empCount];
+
+ // start employee entry loop
+ for (int counter = 0; counter < empCount; counter++)
+ {
+ // type of employee
+ System.out.printf("Employee-%s Type (H, S, C)..: ", (counter + 1));
+ empType = input.next().toUpperCase();
+ input.nextLine();
+
+ // employee's first name
+ System.out.print("First Name ................: ");
+ empFirst = input.next();
+ input.nextLine();
+
+ // employee's last name
+ System.out.print("Last Name .................: ");
+ empLast = input.next();
+ input.nextLine();
+
+ // employee's ID
+ System.out.print("Employee ID ...............: ");
+ empId = input.next();
+ input.nextLine();
+
+ // switch for Hourly, Salary, and Commission based on empType
+ switch (empType)
+ {
+ case "H": // hourly employee
+ System.out.print("Hourly Rate ...............: ");
+ empWage = input.nextDouble();
+
+ System.out.print("Hours Worked ..............: ");
+ empHours = input.nextDouble();
+
+ // create the HourlyEmployee Object
+ HourlyEmployee hourly = new HourlyEmployee(
+ empFirst,
+ empLast,
+ empId,
+ empWage,
+ empHours);
+
+ // add hourly object to employees array
+ employees[counter] = hourly;
+
+ break;
+
+ case "S": // salary employee
+ System.out.print("Weekly Salary .............: ");
+ empSalary = input.nextDouble();
+
+ // create the SalariedEmployee Object
+ SalariedEmployee salary = new SalariedEmployee(
+ empFirst,
+ empLast,
+ empId,
+ empSalary);
+
+ // add salaried object to employees array
+ employees[counter] = salary;
+
+ break;
+
+ case "C": // commission employee
+ System.out.print("Employee Sales ............: ");
+ empSales = input.nextDouble();
+
+ System.out.print("Commision Rate ..........: ");
+ empRate = input.nextDouble();
+
+ // create the CommissionEmployee Object
+ CommissionEmployee commission = new CommissionEmployee(
+ empFirst,
+ empLast,
+ empId,
+ empSales,
+ empRate);
+
+ // add commission object to employees array
+ employees[counter] = commission;
+
+ break;
+
+ } // END - Case switch
+ System.out.println(""); // separates entries
+
+ } // END - Entry For Loop
+
+ // close the scanner to prevent resource leaks
+ input.close();
+
+ // for loop to print individual employee summaries
+ for (Employee employee : employees) {
+
+ System.out.print(employee); // calls the Employee class toString()
+ System.out.printf("\nEmployee Pay...: $%.2f", employee.calculatePayment());
+ System.out.println("\n");
+
+ // add employee's pay to totalPay
+ totalPay += employee.calculatePayment();
+
+ } // END - Employee Summary For Loop
+
+ // print total pay for all employee's
+ System.out.printf("\nTotal Pay......: $%.2f", totalPay);
+
+ } /* END - Main Method */
+
} /* END - Gross Pay Driver Class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/gross/pay/HourlyEmployee.java b/ConsoleApps/src/beam/example/gross/pay/HourlyEmployee.java
index c80f018..63ad685 100644
--- a/ConsoleApps/src/beam/example/gross/pay/HourlyEmployee.java
+++ b/ConsoleApps/src/beam/example/gross/pay/HourlyEmployee.java
@@ -1,82 +1,82 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Hourly Employee extends (is-a) Employee Class
- *
- */
-package beam.example.gross.pay;
-
-public class HourlyEmployee extends Employee
-{
-
- // subclass variables
- private double wage;
- private double hours;
-
- // Constructor, super must be the first line
- HourlyEmployee(
- String firstName,
- String lastName,
- String employeeId,
- double wage,
- double hours
- )
- {
- super(firstName, lastName, employeeId);
- this.wage = wage;
- this.hours = hours;
- }
-
- // Method: calculatePayment
- // overrides abstract method earnings in Employee abstract class
- @Override
- public double calculatePayment()
- {
- if (getHours() <= 40)
- {
- return getWage() * getHours();
-
- }
- else
- {
- return 40 * getWage() + (getHours() - 40) * getWage() * 1.5;
- }
- }
-
- // return wage
- double getWage()
- {
- return wage;
- }
-
- // set wage
- public void setWage(double wage)
- {
- this.wage = wage;
- }
-
- // return hours;
- double getHours()
- {
- return hours;
- }
-
- // set hours
- void setHours(double hours)
- {
- this.hours = hours;
- }
-
- // return String for HourlyEmployee
- @Override
- public String toString()
- {
- return String.format("Hourly Employee -> %s%n%s....: $%,.2f%n%s...: %,.2f",
- super.toString(),
- "Hourly Wage", getWage(),
- "Hours Worked", getHours());
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Hourly Employee extends (is-a) Employee Class
+ *
+ */
+package beam.example.gross.pay;
+
+public class HourlyEmployee extends Employee
+{
+
+ // subclass variables
+ private double wage;
+ private double hours;
+
+ // Constructor, super must be the first line
+ HourlyEmployee(
+ String firstName,
+ String lastName,
+ String employeeId,
+ double wage,
+ double hours
+ )
+ {
+ super(firstName, lastName, employeeId);
+ this.wage = wage;
+ this.hours = hours;
+ }
+
+ // Method: calculatePayment
+ // overrides abstract method earnings in Employee abstract class
+ @Override
+ public double calculatePayment()
+ {
+ if (getHours() <= 40)
+ {
+ return getWage() * getHours();
+
+ }
+ else
+ {
+ return 40 * getWage() + (getHours() - 40) * getWage() * 1.5;
+ }
+ }
+
+ // return wage
+ double getWage()
+ {
+ return wage;
+ }
+
+ // set wage
+ public void setWage(double wage)
+ {
+ this.wage = wage;
+ }
+
+ // return hours;
+ double getHours()
+ {
+ return hours;
+ }
+
+ // set hours
+ void setHours(double hours)
+ {
+ this.hours = hours;
+ }
+
+ // return String for HourlyEmployee
+ @Override
+ public String toString()
+ {
+ return String.format("Hourly Employee -> %s%n%s....: $%,.2f%n%s...: %,.2f",
+ super.toString(),
+ "Hourly Wage", getWage(),
+ "Hours Worked", getHours());
+ }
+
} /* END - SalariedEmployee Subclass */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/gross/pay/SalariedEmployee.java b/ConsoleApps/src/beam/example/gross/pay/SalariedEmployee.java
index c43ec90..ca7c273 100644
--- a/ConsoleApps/src/beam/example/gross/pay/SalariedEmployee.java
+++ b/ConsoleApps/src/beam/example/gross/pay/SalariedEmployee.java
@@ -1,57 +1,57 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Salary Employee extends (is-a) Employee Class
- *
- */
-package beam.example.gross.pay;
-
-public class SalariedEmployee extends Employee
-{
- // subclass variables
- private double weeklySalary;
-
- // Constructor, super must be the first line
- SalariedEmployee(
- String firstName,
- String lastName,
- String employeeId,
- double weeklySalary
- )
- {
- super(firstName, lastName, employeeId);
- this.weeklySalary = weeklySalary;
- }
-
- // Method: calculatePayment
- // overrides abstract method calculatePayment in Employee abstract class
- @Override
- public double calculatePayment()
- {
- return getWeeklySalary();
- }
-
- // return weeklySalary
- double getWeeklySalary()
- {
- return weeklySalary;
- }
-
- // set weeklySalary
- public void setWeeklySalary(double weeklySalary)
- {
- this.weeklySalary = weeklySalary;
- }
-
- // return String for SalariedEmployee
- @Override
- public String toString()
- {
- return String.format("Salaried Employee -> %s%n%s..: $%.2f",
- super.toString(),
- "Weekly Salary", getWeeklySalary());
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Salary Employee extends (is-a) Employee Class
+ *
+ */
+package beam.example.gross.pay;
+
+public class SalariedEmployee extends Employee
+{
+ // subclass variables
+ private double weeklySalary;
+
+ // Constructor, super must be the first line
+ SalariedEmployee(
+ String firstName,
+ String lastName,
+ String employeeId,
+ double weeklySalary
+ )
+ {
+ super(firstName, lastName, employeeId);
+ this.weeklySalary = weeklySalary;
+ }
+
+ // Method: calculatePayment
+ // overrides abstract method calculatePayment in Employee abstract class
+ @Override
+ public double calculatePayment()
+ {
+ return getWeeklySalary();
+ }
+
+ // return weeklySalary
+ double getWeeklySalary()
+ {
+ return weeklySalary;
+ }
+
+ // set weeklySalary
+ public void setWeeklySalary(double weeklySalary)
+ {
+ this.weeklySalary = weeklySalary;
+ }
+
+ // return String for SalariedEmployee
+ @Override
+ public String toString()
+ {
+ return String.format("Salaried Employee -> %s%n%s..: $%.2f",
+ super.toString(),
+ "Weekly Salary", getWeeklySalary());
+ }
+
} /* END - Salaried Employee subclass */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/hourly/salary/HourlyEmployee.java b/ConsoleApps/src/beam/example/hourly/salary/HourlyEmployee.java
index b2949c7..e80aabc 100644
--- a/ConsoleApps/src/beam/example/hourly/salary/HourlyEmployee.java
+++ b/ConsoleApps/src/beam/example/hourly/salary/HourlyEmployee.java
@@ -1,79 +1,79 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Class for Hourly Salary
- *
- */
-package beam.example.hourly.salary;
-
-public class HourlyEmployee {
-
- // Instance variables
- private String firstName;
- private String lastName;
- private String empNumber;
- private double hours;
- private double payRate;
-
- public HourlyEmployee(String firstName, String lastName, String empNumber,
- double hours, double payRate)
- {
- // Assign instance variables
- this.firstName = firstName;
- this.lastName = lastName;
- this.empNumber = empNumber;
- this.hours = hours;
- this.payRate = payRate;
-
- } // END - Constructor
-
- /** @param firstName sets employee first name */
- public void setFirstName(String firstName) { this.firstName = firstName; }
-
- /** @return firstName returns employee first name */
- public String getFirstName() { return firstName; }
-
- /** @param lastName sets employee last name */
- public void setLastName(String lastName) { this.lastName = lastName; }
-
- /** @return lastName returns employee last name */
- public String getLastName() { return lastName; }
-
- /** @param empNumber sets employee ID number */
- public void setEmpNumber(String empNumber) { this.empNumber = empNumber; }
-
- /** @return empNumber returns employee ID number */
- public String getEmpNumber() { return empNumber; }
-
- /** @param hours sets hours worked */
- public void setHours(double hours) { this.hours = hours; }
-
- /** @return hours returns hours worked */
- public double getHours() { return hours; }
-
- /** @param payRate sets hourly pay rate */
- public void setPayRate(double payRate) { this.payRate = payRate; }
-
- /** @return hours returns hourly pay rate */
- public double getPayRate() { return payRate; }
-
- /** @return calculatePay returns gross pay */
- public double calculatePay()
- {
- double grossPay;
-
- // If hours is > 40, add overtime to base pay.
- if (getHours() > 40)
- {
- grossPay = ((1.5 * getPayRate()) * (getHours() - 40.0)) + (40.0 * getPayRate());
- }
- else
- {
- grossPay = (getHours() * getPayRate());
- }
- return grossPay;
- } // END - Calculate Pay Method
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Class for Hourly Salary
+ *
+ */
+package beam.example.hourly.salary;
+
+public class HourlyEmployee {
+
+ // Instance variables
+ private String firstName;
+ private String lastName;
+ private String empNumber;
+ private double hours;
+ private double payRate;
+
+ public HourlyEmployee(String firstName, String lastName, String empNumber,
+ double hours, double payRate)
+ {
+ // Assign instance variables
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.empNumber = empNumber;
+ this.hours = hours;
+ this.payRate = payRate;
+
+ } // END - Constructor
+
+ /** @param firstName sets employee first name */
+ public void setFirstName(String firstName) { this.firstName = firstName; }
+
+ /** @return firstName returns employee first name */
+ public String getFirstName() { return firstName; }
+
+ /** @param lastName sets employee last name */
+ public void setLastName(String lastName) { this.lastName = lastName; }
+
+ /** @return lastName returns employee last name */
+ public String getLastName() { return lastName; }
+
+ /** @param empNumber sets employee ID number */
+ public void setEmpNumber(String empNumber) { this.empNumber = empNumber; }
+
+ /** @return empNumber returns employee ID number */
+ public String getEmpNumber() { return empNumber; }
+
+ /** @param hours sets hours worked */
+ public void setHours(double hours) { this.hours = hours; }
+
+ /** @return hours returns hours worked */
+ public double getHours() { return hours; }
+
+ /** @param payRate sets hourly pay rate */
+ public void setPayRate(double payRate) { this.payRate = payRate; }
+
+ /** @return hours returns hourly pay rate */
+ public double getPayRate() { return payRate; }
+
+ /** @return calculatePay returns gross pay */
+ public double calculatePay()
+ {
+ double grossPay;
+
+ // If hours is > 40, add overtime to base pay.
+ if (getHours() > 40)
+ {
+ grossPay = ((1.5 * getPayRate()) * (getHours() - 40.0)) + (40.0 * getPayRate());
+ }
+ else
+ {
+ grossPay = (getHours() * getPayRate());
+ }
+ return grossPay;
+ } // END - Calculate Pay Method
+
} // END - Hourly Employee class
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/hourly/salary/HourlyEmployeeDriver.java b/ConsoleApps/src/beam/example/hourly/salary/HourlyEmployeeDriver.java
index 5f96bae..3bb9189 100644
--- a/ConsoleApps/src/beam/example/hourly/salary/HourlyEmployeeDriver.java
+++ b/ConsoleApps/src/beam/example/hourly/salary/HourlyEmployeeDriver.java
@@ -1,73 +1,73 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Driver for Hourly Salary
- *
- */
-package beam.example.hourly.salary;
-
-import java.util.Scanner;
-
-public class HourlyEmployeeDriver {
-
- public static void main(String[] args)
- {
- // Initialize the Scanner
- Scanner input = new Scanner(System.in);
-
- // Initialize loop counter
- int counter = 1;
-
- // Print the header
- System.out.println("\nSalary Calculator for (3) Employee's");
- System.out.println("--------------------------------------\n");
-
- // Create / reset object to hold console I/O input
- HourlyEmployee record = new HourlyEmployee("","","",0.00,0.00);
-
- // As per instruction, loop through (3) employees and compute grossPay.
- while (counter <= 3)
- {
- // Start entering employee data.
- System.out.printf("Enter Employee-%s Data\n", counter);
-
- System.out.print("First Name....: ");
- String fname = input.next();
- record.setFirstName(fname);
-
- System.out.print("Last Name.....: ");
- String lname = input.next();
- record.setLastName(lname);
-
- System.out.print("Employee ID...: ");
- String empid = input.next();
- record.setEmpNumber(empid);
-
- System.out.print("Hours Worked..: ");
- double hrs = input.nextDouble();
- record.setHours(hrs);
-
- System.out.print("Pay rate......: ");
- double prate = input.nextDouble();
- record.setPayRate(prate);
-
- // Print gross pay for record.
- double gross = record.calculatePay();
- System.out.printf("Gross Pay.....: $%.2f%n\n", gross);
-
- // Increment the loop counter.
- counter++;
-
- } // END - While Loop employee data entry.
-
- // Print end of routine
- System.out.print("*--End Salary Calculator--*\n");
-
- // Close the input scanner ( prevent resource leaks ).
- input.close();
-
- } // END - Main method
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Driver for Hourly Salary
+ *
+ */
+package beam.example.hourly.salary;
+
+import java.util.Scanner;
+
+public class HourlyEmployeeDriver {
+
+ public static void main(String[] args)
+ {
+ // Initialize the Scanner
+ Scanner input = new Scanner(System.in);
+
+ // Initialize loop counter
+ int counter = 1;
+
+ // Print the header
+ System.out.println("\nSalary Calculator for (3) Employee's");
+ System.out.println("--------------------------------------\n");
+
+ // Create / reset object to hold console I/O input
+ HourlyEmployee record = new HourlyEmployee("","","",0.00,0.00);
+
+ // As per instruction, loop through (3) employees and compute grossPay.
+ while (counter <= 3)
+ {
+ // Start entering employee data.
+ System.out.printf("Enter Employee-%s Data\n", counter);
+
+ System.out.print("First Name....: ");
+ String fname = input.next();
+ record.setFirstName(fname);
+
+ System.out.print("Last Name.....: ");
+ String lname = input.next();
+ record.setLastName(lname);
+
+ System.out.print("Employee ID...: ");
+ String empid = input.next();
+ record.setEmpNumber(empid);
+
+ System.out.print("Hours Worked..: ");
+ double hrs = input.nextDouble();
+ record.setHours(hrs);
+
+ System.out.print("Pay rate......: ");
+ double prate = input.nextDouble();
+ record.setPayRate(prate);
+
+ // Print gross pay for record.
+ double gross = record.calculatePay();
+ System.out.printf("Gross Pay.....: $%.2f%n\n", gross);
+
+ // Increment the loop counter.
+ counter++;
+
+ } // END - While Loop employee data entry.
+
+ // Print end of routine
+ System.out.print("*--End Salary Calculator--*\n");
+
+ // Close the input scanner ( prevent resource leaks ).
+ input.close();
+
+ } // END - Main method
+
} // END - HourlyEmployee class
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/parking/garage/ParkingCharge.java b/ConsoleApps/src/beam/example/parking/garage/ParkingCharge.java
index 94995a3..13e7af9 100644
--- a/ConsoleApps/src/beam/example/parking/garage/ParkingCharge.java
+++ b/ConsoleApps/src/beam/example/parking/garage/ParkingCharge.java
@@ -1,82 +1,82 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Class for Parking Charges
- *
- */
-package beam.example.parking.garage;
-
-public class ParkingCharge
-{
-
- // set final variables
- private static final double MINCHAEGE = 2.0;
- private static final double MAXCHARGE = 10.0;
- private static final double INCCHARGE = 0.50;
-
- // Set min and max hours
- private static final double MINHOURS = 3.0;
- private static final double MAXHOURS = 24;
-
- // Set variable to keeping track of daily charges
- private double runTotal;
-
- // constructor
- public ParkingCharge(double runTotal)
- {
- // Assign instance variables.
- this.runTotal = runTotal;
-
- }
-
- /** @return runTotal returns running total of charges */
- public double getRunTotal()
- {
- return runTotal;
- }
-
- /** @param runTotal sets running total of charges */
- public void setRunTotal(double runTotal)
- {
- this.runTotal = getRunTotal() + runTotal;
- }
-
- /** Calculate Charges - calculate customer and total running charges */
- public static double calculateCharges(double customerHours)
- {
- // Set variable for customer hours
- double customerCharge = 0.0;
-
- // If customerHours are < 3 first, set MINCHAEGE
- if (customerHours <= MINHOURS)
- {
- customerCharge = MINCHAEGE;
- }
-
- // If customerHours greater than MINHOURS and less than MAXHOURS
- // calculate the charge
- if((customerHours > MINHOURS) && (customerHours < MAXHOURS))
- {
- customerCharge = INCCHARGE * (Math.ceil(customerHours) - MINHOURS)
- + MINCHAEGE;
-
- if (customerCharge > MAXCHARGE)
- {
- customerCharge = MAXCHARGE;
- }
- }
-
- // If customerHours are greater than MAXHOURS, set MAXCHARGE
- if(customerHours > MAXHOURS)
- {
- customerCharge = MAXCHARGE;
- }
-
- // Return customer parking charge
- return customerCharge;
-
- } // END - Calculate Charges method.
-
-} /* END - ParkingCharge class */
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Class for Parking Charges
+ *
+ */
+package beam.example.parking.garage;
+
+public class ParkingCharge
+{
+
+ // set final variables
+ private static final double MINCHAEGE = 2.0;
+ private static final double MAXCHARGE = 10.0;
+ private static final double INCCHARGE = 0.50;
+
+ // Set min and max hours
+ private static final double MINHOURS = 3.0;
+ private static final double MAXHOURS = 24;
+
+ // Set variable to keeping track of daily charges
+ private double runTotal;
+
+ // constructor
+ public ParkingCharge(double runTotal)
+ {
+ // Assign instance variables.
+ this.runTotal = runTotal;
+
+ }
+
+ /** @return runTotal returns running total of charges */
+ public double getRunTotal()
+ {
+ return runTotal;
+ }
+
+ /** @param runTotal sets running total of charges */
+ public void setRunTotal(double runTotal)
+ {
+ this.runTotal = getRunTotal() + runTotal;
+ }
+
+ /** Calculate Charges - calculate customer and total running charges */
+ public static double calculateCharges(double customerHours)
+ {
+ // Set variable for customer hours
+ double customerCharge = 0.0;
+
+ // If customerHours are < 3 first, set MINCHAEGE
+ if (customerHours <= MINHOURS)
+ {
+ customerCharge = MINCHAEGE;
+ }
+
+ // If customerHours greater than MINHOURS and less than MAXHOURS
+ // calculate the charge
+ if((customerHours > MINHOURS) && (customerHours < MAXHOURS))
+ {
+ customerCharge = INCCHARGE * (Math.ceil(customerHours) - MINHOURS)
+ + MINCHAEGE;
+
+ if (customerCharge > MAXCHARGE)
+ {
+ customerCharge = MAXCHARGE;
+ }
+ }
+
+ // If customerHours are greater than MAXHOURS, set MAXCHARGE
+ if(customerHours > MAXHOURS)
+ {
+ customerCharge = MAXCHARGE;
+ }
+
+ // Return customer parking charge
+ return customerCharge;
+
+ } // END - Calculate Charges method.
+
+} /* END - ParkingCharge class */
diff --git a/ConsoleApps/src/beam/example/parking/garage/ParkingChargeDriver.java b/ConsoleApps/src/beam/example/parking/garage/ParkingChargeDriver.java
index 02baf08..c6d99a4 100644
--- a/ConsoleApps/src/beam/example/parking/garage/ParkingChargeDriver.java
+++ b/ConsoleApps/src/beam/example/parking/garage/ParkingChargeDriver.java
@@ -1,56 +1,56 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Driver for Parking Garage
- *
- */
-package beam.example.parking.garage;
-
-import java.util.Scanner;
-
-public class ParkingChargeDriver
-{
-
- public static void main(String[] args)
- {
- // Initialize the Scanner
- Scanner input = new Scanner(System.in);
-
- // Initialize loop control and counter variables.
- double hours = 0.0;
- double charges;
-
- // Set the input objects to 0 initially.
- ParkingCharge costs = new ParkingCharge(0.0);
-
- // Start while loop for customer hour entry.
- while (hours != -1)
- {
- System.out.printf("Enter Hours (-1 to quit)..: ");
- hours = input.nextDouble();
-
- // Only allow entry if hours are greater than zero
- if(hours > 0)
- {
- charges = ParkingCharge.calculateCharges(hours);
- costs.setRunTotal(charges);
- System.out.printf("Customer charge is........: " +
- "$%.2f ", charges);
- System.out.print("\n");
- System.out.printf("Running Daily Total.......: " +
- "$%.2f%n", costs.getRunTotal());
- }
- System.out.print("\n");
- } // END - Customer Hours Entry.
-
- // Close the input scanner ( prevent resource leaks )
- input.close();
-
- // END - Customer Hour Entry.
- System.out.printf("Total Daily Reciepts = $%.2f%n", costs.getRunTotal());
-
- } // END - Main Method.
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Driver for Parking Garage
+ *
+ */
+package beam.example.parking.garage;
+
+import java.util.Scanner;
+
+public class ParkingChargeDriver
+{
+
+ public static void main(String[] args)
+ {
+ // Initialize the Scanner
+ Scanner input = new Scanner(System.in);
+
+ // Initialize loop control and counter variables.
+ double hours = 0.0;
+ double charges;
+
+ // Set the input objects to 0 initially.
+ ParkingCharge costs = new ParkingCharge(0.0);
+
+ // Start while loop for customer hour entry.
+ while (hours != -1)
+ {
+ System.out.printf("Enter Hours (-1 to quit)..: ");
+ hours = input.nextDouble();
+
+ // Only allow entry if hours are greater than zero
+ if(hours > 0)
+ {
+ charges = ParkingCharge.calculateCharges(hours);
+ costs.setRunTotal(charges);
+ System.out.printf("Customer charge is........: " +
+ "$%.2f ", charges);
+ System.out.print("\n");
+ System.out.printf("Running Daily Total.......: " +
+ "$%.2f%n", costs.getRunTotal());
+ }
+ System.out.print("\n");
+ } // END - Customer Hours Entry.
+
+ // Close the input scanner ( prevent resource leaks )
+ input.close();
+
+ // END - Customer Hour Entry.
+ System.out.printf("Total Daily Reciepts = $%.2f%n", costs.getRunTotal());
+
+ } // END - Main Method.
+
} /* END - ParkingChangeDriver class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/radio/station/Amplifier.java b/ConsoleApps/src/beam/example/radio/station/Amplifier.java
index 6bc1e4d..1a74b88 100644
--- a/ConsoleApps/src/beam/example/radio/station/Amplifier.java
+++ b/ConsoleApps/src/beam/example/radio/station/Amplifier.java
@@ -1,78 +1,78 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Amplifier Class
- *
- */
-package beam.example.radio.station;
-
-public class Amplifier
-{
- private String manufacturer;
- private String model;
-
- // constructor-1
- public Amplifier(String manufacturer, String model)
- {
- super();
- this.manufacturer = manufacturer;
- this.model = model;
- }
-
- // constructor-2
- public Amplifier(String model)
- {
- super();
- this.model = model;
- }
-
- /** @param value @return power level */
- public String checkPower(String value)
- {
- String maxPower = value;
-
- if (value == "AL-1500")
- {
- maxPower = "2500";
- }
- else
- {
- maxPower = "1000";
- }
-
- return String.format("%sW",maxPower);
- }
-
- /** @return manufacturer of amplifier */
- public String getManufacturer()
- {
- return manufacturer;
- }
-
- /** @param manufacturer of amplifier */
- public void setManufacturer(String manufacturer)
- {
- this.manufacturer = manufacturer;
- }
-
- /** @return model of amplifier */
- public String getModel()
- {
- return model;
- }
-
- /** @param model of amplifier */
- public void setCost(String model)
- {
- this.model = model;
- }
-
- @Override
- public String toString()
- {
- return String.format("%s %s", manufacturer, model);
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Amplifier Class
+ *
+ */
+package beam.example.radio.station;
+
+public class Amplifier
+{
+ private String manufacturer;
+ private String model;
+
+ // constructor-1
+ public Amplifier(String manufacturer, String model)
+ {
+ super();
+ this.manufacturer = manufacturer;
+ this.model = model;
+ }
+
+ // constructor-2
+ public Amplifier(String model)
+ {
+ super();
+ this.model = model;
+ }
+
+ /** @param value @return power level */
+ public String checkPower(String value)
+ {
+ String maxPower = value;
+
+ if (value == "AL-1500")
+ {
+ maxPower = "2500";
+ }
+ else
+ {
+ maxPower = "1000";
+ }
+
+ return String.format("%sW",maxPower);
+ }
+
+ /** @return manufacturer of amplifier */
+ public String getManufacturer()
+ {
+ return manufacturer;
+ }
+
+ /** @param manufacturer of amplifier */
+ public void setManufacturer(String manufacturer)
+ {
+ this.manufacturer = manufacturer;
+ }
+
+ /** @return model of amplifier */
+ public String getModel()
+ {
+ return model;
+ }
+
+ /** @param model of amplifier */
+ public void setCost(String model)
+ {
+ this.model = model;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.format("%s %s", manufacturer, model);
+ }
+
} /* END - Amplifier Class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/radio/station/Antenna.java b/ConsoleApps/src/beam/example/radio/station/Antenna.java
index c1a1e10..2240009 100644
--- a/ConsoleApps/src/beam/example/radio/station/Antenna.java
+++ b/ConsoleApps/src/beam/example/radio/station/Antenna.java
@@ -1,68 +1,68 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Antenna Class
- *
- */
-package beam.example.radio.station;
-
-public class Antenna
-{
- private String manufacturer;
- private String model;
- private String type;
-
- // constructor
- public Antenna(String manufacturer, String model, String type)
- {
- super();
- this.manufacturer = manufacturer;
- this.model = model;
- this.type = type;
- }
-
- /** @param manufacturer of antenna */
- public String getManufacturer()
- {
- return manufacturer;
- }
-
- /** @param manufacturer of antenna */
- public void setManufacturer(String manufacturer)
- {
- this.manufacturer = manufacturer;
- }
-
- /** @param model of antenna */
- public String getModel()
- {
- return model;
- }
-
- /** @param model of antenna */
- public void setModel(String model)
- {
- this.model = model;
- }
-
- /** @param type of antenna */
- public String getType()
- {
- return type;
- }
-
- /** @param type of antenna */
- public void setType(String type)
- {
- this.type = type;
- }
-
- @Override
- public String toString()
- {
- return String.format("%s %s %s", manufacturer, model, type);
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Antenna Class
+ *
+ */
+package beam.example.radio.station;
+
+public class Antenna
+{
+ private String manufacturer;
+ private String model;
+ private String type;
+
+ // constructor
+ public Antenna(String manufacturer, String model, String type)
+ {
+ super();
+ this.manufacturer = manufacturer;
+ this.model = model;
+ this.type = type;
+ }
+
+ /** @param manufacturer of antenna */
+ public String getManufacturer()
+ {
+ return manufacturer;
+ }
+
+ /** @param manufacturer of antenna */
+ public void setManufacturer(String manufacturer)
+ {
+ this.manufacturer = manufacturer;
+ }
+
+ /** @param model of antenna */
+ public String getModel()
+ {
+ return model;
+ }
+
+ /** @param model of antenna */
+ public void setModel(String model)
+ {
+ this.model = model;
+ }
+
+ /** @param type of antenna */
+ public String getType()
+ {
+ return type;
+ }
+
+ /** @param type of antenna */
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.format("%s %s %s", manufacturer, model, type);
+ }
+
} /* END - Antenna Class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/radio/station/Operator.java b/ConsoleApps/src/beam/example/radio/station/Operator.java
index e0b8d61..19feed1 100644
--- a/ConsoleApps/src/beam/example/radio/station/Operator.java
+++ b/ConsoleApps/src/beam/example/radio/station/Operator.java
@@ -1,110 +1,110 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Operator Class
- *
- */
-package beam.example.radio.station;
-
-public class Operator
-{
- private String firstName;
- private String lastName;
- private String callsign;
- private String association;
-
- // constructor-1
- public Operator(String firstName, String lastName, String callsign, String association)
- {
- super();
- this.firstName = firstName;
- this.lastName = lastName;
- this.callsign = callsign;
- this.association = association;
- }
-
- // constructor-2
- public Operator(String association)
- {
- super();
- this.association = association;
- }
-
- /** @return association fee */
- public String calculateAssociationFee()
- {
- double fee = 0;
-
- if (association != null)
- {
- switch (association)
- {
- case "ARRL":
- fee = 120.00;
- break;
-
- case "CWOPS":
- fee = 25.00;
- break;
- }
- }
- return String.format("$%.2f", fee);
- }
-
- /** @return first name of operator */
- public String getFirstName()
- {
- return firstName;
- }
-
- /** @param firstName of operator */
- public void setFirstName(String firstName)
- {
- this.firstName = firstName;
- }
-
- /** @return lastName of operator */
- public String getLastName()
- {
- return lastName;
- }
-
- /** @param lastName of operator */
- public void setLastName(String lastName)
- {
- this.lastName = lastName;
- }
-
- /** @return callsign of operator */
- public String getCallsign()
- {
- return callsign;
- }
-
- /** @param callsign of operator */
- public void setCallsign(String callsign)
- {
- this.callsign = callsign;
- }
-
- /** @return association of operator */
- public String getAssociation()
- {
- return association;
- }
-
- /** @param association of operator */
- public void setAssociation(String association)
- {
- this.callsign = association;
- }
-
- @Override
- public String toString()
- {
- return String.format("Operator ........: %s %s, %s", firstName, lastName, callsign);
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Operator Class
+ *
+ */
+package beam.example.radio.station;
+
+public class Operator
+{
+ private String firstName;
+ private String lastName;
+ private String callsign;
+ private String association;
+
+ // constructor-1
+ public Operator(String firstName, String lastName, String callsign, String association)
+ {
+ super();
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.callsign = callsign;
+ this.association = association;
+ }
+
+ // constructor-2
+ public Operator(String association)
+ {
+ super();
+ this.association = association;
+ }
+
+ /** @return association fee */
+ public String calculateAssociationFee()
+ {
+ double fee = 0;
+
+ if (association != null)
+ {
+ switch (association)
+ {
+ case "ARRL":
+ fee = 120.00;
+ break;
+
+ case "CWOPS":
+ fee = 25.00;
+ break;
+ }
+ }
+ return String.format("$%.2f", fee);
+ }
+
+ /** @return first name of operator */
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ /** @param firstName of operator */
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+
+ /** @return lastName of operator */
+ public String getLastName()
+ {
+ return lastName;
+ }
+
+ /** @param lastName of operator */
+ public void setLastName(String lastName)
+ {
+ this.lastName = lastName;
+ }
+
+ /** @return callsign of operator */
+ public String getCallsign()
+ {
+ return callsign;
+ }
+
+ /** @param callsign of operator */
+ public void setCallsign(String callsign)
+ {
+ this.callsign = callsign;
+ }
+
+ /** @return association of operator */
+ public String getAssociation()
+ {
+ return association;
+ }
+
+ /** @param association of operator */
+ public void setAssociation(String association)
+ {
+ this.callsign = association;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.format("Operator ........: %s %s, %s", firstName, lastName, callsign);
+ }
+
} /* END - Operator class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/radio/station/RadioStation.java b/ConsoleApps/src/beam/example/radio/station/RadioStation.java
index e7cd4e0..751c5ad 100644
--- a/ConsoleApps/src/beam/example/radio/station/RadioStation.java
+++ b/ConsoleApps/src/beam/example/radio/station/RadioStation.java
@@ -1,102 +1,102 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Radio Station Class
- *
- */
-package beam.example.radio.station;
-
-import java.util.ArrayList;
-
-public class RadioStation
-{
- private String stationCall;
- private Operator operator;
- private ArrayList amplifiers = new ArrayList();
- private ArrayList antennas = new ArrayList();
- private ArrayList transceivers = new ArrayList();
-
- // constructor-1
- public RadioStation(String stationCall)
- {
- super();
- this.stationCall = stationCall;
- }
-
- // constructor-2
- public RadioStation(String stationCall, Operator operator)
- {
- super();
- this.stationCall = stationCall;
- this.operator = operator;
- }
-
- /** @return stationCall of station */
- public String getstationCall()
- {
- return stationCall;
- }
-
- /** @param stationCall of station */
- public void setstationCall(String stationCall)
- {
- this.stationCall = stationCall;
- }
-
- /** @return operator callsign */
- public Operator getOperator()
- {
- return operator;
- }
-
- /** @param operator callsign */
- public void setOperator(Operator operator)
- {
- this.operator = operator;
- }
-
- /** @return amplifiers ArrayList */
- public ArrayList getAmplifiers()
- {
- return amplifiers;
- }
-
- /** @param amplifiers ArrayList */
- public void setAmplifiers(ArrayList amplifiers)
- {
- this.amplifiers = amplifiers;
- }
-
- /** @return antennas ArrayList */
- public ArrayList getAntennas()
- {
- return antennas;
- }
-
- /** @param antennas ArrayList */
- public void setAntennas(ArrayList antennas)
- {
- this.antennas = antennas;
- }
-
- /** @return transceiver ArrayList */
- public ArrayList getTrancievers()
- {
- return transceivers;
- }
-
- /** @param transceiver ArrayList */
- public void setTrancievers(ArrayList trancievers)
- {
- this.transceivers = trancievers;
- }
-
- @Override
- public String toString()
- {
- return "Station Call ....: " + stationCall;
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Radio Station Class
+ *
+ */
+package beam.example.radio.station;
+
+import java.util.ArrayList;
+
+public class RadioStation
+{
+ private String stationCall;
+ private Operator operator;
+ private ArrayList amplifiers = new ArrayList();
+ private ArrayList antennas = new ArrayList();
+ private ArrayList transceivers = new ArrayList();
+
+ // constructor-1
+ public RadioStation(String stationCall)
+ {
+ super();
+ this.stationCall = stationCall;
+ }
+
+ // constructor-2
+ public RadioStation(String stationCall, Operator operator)
+ {
+ super();
+ this.stationCall = stationCall;
+ this.operator = operator;
+ }
+
+ /** @return stationCall of station */
+ public String getstationCall()
+ {
+ return stationCall;
+ }
+
+ /** @param stationCall of station */
+ public void setstationCall(String stationCall)
+ {
+ this.stationCall = stationCall;
+ }
+
+ /** @return operator callsign */
+ public Operator getOperator()
+ {
+ return operator;
+ }
+
+ /** @param operator callsign */
+ public void setOperator(Operator operator)
+ {
+ this.operator = operator;
+ }
+
+ /** @return amplifiers ArrayList */
+ public ArrayList getAmplifiers()
+ {
+ return amplifiers;
+ }
+
+ /** @param amplifiers ArrayList */
+ public void setAmplifiers(ArrayList amplifiers)
+ {
+ this.amplifiers = amplifiers;
+ }
+
+ /** @return antennas ArrayList */
+ public ArrayList getAntennas()
+ {
+ return antennas;
+ }
+
+ /** @param antennas ArrayList */
+ public void setAntennas(ArrayList antennas)
+ {
+ this.antennas = antennas;
+ }
+
+ /** @return transceiver ArrayList */
+ public ArrayList getTrancievers()
+ {
+ return transceivers;
+ }
+
+ /** @param transceiver ArrayList */
+ public void setTrancievers(ArrayList trancievers)
+ {
+ this.transceivers = trancievers;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Station Call ....: " + stationCall;
+ }
+
} /* END - RadioStation Class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/radio/station/RadioStationDriver.java b/ConsoleApps/src/beam/example/radio/station/RadioStationDriver.java
index 2c91db8..ba59ec8 100644
--- a/ConsoleApps/src/beam/example/radio/station/RadioStationDriver.java
+++ b/ConsoleApps/src/beam/example/radio/station/RadioStationDriver.java
@@ -1,61 +1,61 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Sets up the station operator, station data, adds
- * equipment to (3) arrays, uses (2) methods to check
- * equipment power and association fees, then prints
- * the station equipment list.
- *
- * Note: This example demonstrates a basic (has-a) relationship.
- * In OOP terms, it inherits objects from other classes. In
- * this case, a RadioStation (has-a) Operator, Transceiver,
- * Antenna and so on.
- *
- */
-package beam.example.radio.station;
-
-public class RadioStationDriver
-{
- public static void main(String[] args)
- {
- // Create an operator for later addition to station
- Operator operator1 = new Operator("Greg","Beam","KI7MT","ARRL");
-
- // Create a new station
- RadioStation station = new RadioStation("KI7MT", operator1);
-
- // Add Transceivers to station
- station.getTrancievers().add(new Transceiver("Yaesu","FT-2000D"));
- station.getTrancievers().add(new Transceiver("Icom","IC-7800"));
-
- // Add Amplifiers to station
- station.getAmplifiers().add(new Amplifier("Ameritron","AL-1500"));
- station.getAmplifiers().add(new Amplifier("Collins","30L-1"));
-
- // Add Antennas to station
- station.getAntennas().add(new Antenna("Force-12","MX-5-20","Yagi"));
- station.getAntennas().add(new Antenna("VorTex","5BTV","Vertical"));
-
- // get the stations power based on Amplifier Model
- String modelCheck = station.getAmplifiers().get(0).getModel();
- Amplifier pwrcheck = new Amplifier(modelCheck);
-
- // Print out station configuration and fees
- System.out.println(station);
- System.out.println(operator1);
- System.out.println("Association Fees : " + station.getOperator().calculateAssociationFee());
- System.out.println("");
-
- // print out station equipment list
- System.out.println("Equipment List");
- System.out.println("------------------------------------------------------------------");
- System.out.println("Transceivers ....: " + station.getTrancievers());
- System.out.println("Amplifiers ......: " + station.getAmplifiers());
- System.out.println("Antennas ........: " + station.getAntennas());
- System.out.println("Max Power .......: "+ pwrcheck.checkPower(modelCheck));
-
- } // END - Main Method
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Sets up the station operator, station data, adds
+ * equipment to (3) arrays, uses (2) methods to check
+ * equipment power and association fees, then prints
+ * the station equipment list.
+ *
+ * Note: This example demonstrates a basic (has-a) relationship.
+ * In OOP terms, it inherits objects from other classes. In
+ * this case, a RadioStation (has-a) Operator, Transceiver,
+ * Antenna and so on.
+ *
+ */
+package beam.example.radio.station;
+
+public class RadioStationDriver
+{
+ public static void main(String[] args)
+ {
+ // Create an operator for later addition to station
+ Operator operator1 = new Operator("Greg","Beam","KI7MT","ARRL");
+
+ // Create a new station
+ RadioStation station = new RadioStation("KI7MT", operator1);
+
+ // Add Transceivers to station
+ station.getTrancievers().add(new Transceiver("Yaesu","FT-2000D"));
+ station.getTrancievers().add(new Transceiver("Icom","IC-7800"));
+
+ // Add Amplifiers to station
+ station.getAmplifiers().add(new Amplifier("Ameritron","AL-1500"));
+ station.getAmplifiers().add(new Amplifier("Collins","30L-1"));
+
+ // Add Antennas to station
+ station.getAntennas().add(new Antenna("Force-12","MX-5-20","Yagi"));
+ station.getAntennas().add(new Antenna("VorTex","5BTV","Vertical"));
+
+ // get the stations power based on Amplifier Model
+ String modelCheck = station.getAmplifiers().get(0).getModel();
+ Amplifier pwrcheck = new Amplifier(modelCheck);
+
+ // Print out station configuration and fees
+ System.out.println(station);
+ System.out.println(operator1);
+ System.out.println("Association Fees : " + station.getOperator().calculateAssociationFee());
+ System.out.println("");
+
+ // print out station equipment list
+ System.out.println("Equipment List");
+ System.out.println("------------------------------------------------------------------");
+ System.out.println("Transceivers ....: " + station.getTrancievers());
+ System.out.println("Amplifiers ......: " + station.getAmplifiers());
+ System.out.println("Antennas ........: " + station.getAntennas());
+ System.out.println("Max Power .......: "+ pwrcheck.checkPower(modelCheck));
+
+ } // END - Main Method
+
} /* END - Class Driver */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/radio/station/Transceiver.java b/ConsoleApps/src/beam/example/radio/station/Transceiver.java
index 0564f9a..1ea5f83 100644
--- a/ConsoleApps/src/beam/example/radio/station/Transceiver.java
+++ b/ConsoleApps/src/beam/example/radio/station/Transceiver.java
@@ -1,54 +1,54 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Radio Station Class
- *
- */
-package beam.example.radio.station;
-
-public class Transceiver
-{
- private String manufacturer;
- private String model;
-
- // constructor-1
- public Transceiver(String manufacturer, String model)
- {
- super();
- this.manufacturer = manufacturer;
- this.model = model;
- }
-
- /** @return manufacturer of transceiver */
- public String getManufacturer()
- {
- return manufacturer;
- }
-
- /** @param manufacturer of transceiver */
- public void setManufacturer(String manufacturer)
- {
- this.manufacturer = manufacturer;
- }
-
- /** @return model of transceiver */
- public String getModel()
- {
- return model;
- }
-
- /** @param model of transceiver */
- public void setModel(String model)
- {
- this.model = model;
- }
-
- @Override
- public String toString()
- {
- return String.format("%s %s", manufacturer, model);
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Radio Station Class
+ *
+ */
+package beam.example.radio.station;
+
+public class Transceiver
+{
+ private String manufacturer;
+ private String model;
+
+ // constructor-1
+ public Transceiver(String manufacturer, String model)
+ {
+ super();
+ this.manufacturer = manufacturer;
+ this.model = model;
+ }
+
+ /** @return manufacturer of transceiver */
+ public String getManufacturer()
+ {
+ return manufacturer;
+ }
+
+ /** @param manufacturer of transceiver */
+ public void setManufacturer(String manufacturer)
+ {
+ this.manufacturer = manufacturer;
+ }
+
+ /** @return model of transceiver */
+ public String getModel()
+ {
+ return model;
+ }
+
+ /** @param model of transceiver */
+ public void setModel(String model)
+ {
+ this.model = model;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.format("%s %s", manufacturer, model);
+ }
+
} /* END - Transceiver Class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/salary/tests/Employee.java b/ConsoleApps/src/beam/example/salary/tests/Employee.java
index ccba788..7ed55d0 100644
--- a/ConsoleApps/src/beam/example/salary/tests/Employee.java
+++ b/ConsoleApps/src/beam/example/salary/tests/Employee.java
@@ -1,126 +1,126 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Class for Employee
- *
- */
-package beam.example.salary.tests;
-
-public class Employee
-{
- // Instance variables
- private String firstName;
- private String lastName;
- private double monthlySalary;
- private double raiseFactor;
-
- public Employee(String firstName, String lastName, double monthlySalary, double raiseFactor)
- {
- // instance variables
- this.firstName = firstName;
- this.lastName = lastName;
- this.raiseFactor = raiseFactor;
-
- // only assign monthly salary if > 0.00.
- if (monthlySalary > 0.0)
- {
- this.monthlySalary = monthlySalary;
- }
-
- } // end constructor
-
- /** @param firstName sets employee first name */
- public void setFirstName(String firstName)
- {
- this.firstName = firstName;
- }
-
- /** @return firstName returns employee first name */
- public String getFirstName()
- {
- return firstName;
- }
-
- /** @param lastName sets employee last name */
- public void setLastName(String lastName)
- {
- this.lastName = lastName;
- }
-
- /** @return lastName returns employee last name */
- public String getLastName()
- {
- return lastName;
- }
-
- /** @param monthlySalary sets monthly salary if greater than ( 0.00 ) */
- public void setMonthlySalary(double monthlySalary)
- {
- if (monthlySalary > 0.00)
- {
- this.monthlySalary = monthlySalary;
- }
- }
-
- /** @return lastName returns monthly salary */
- public double getMonthlySalary()
- {
- return monthlySalary;
- }
-
- /** @param raiseFactor sets raise factor */
- public void setRaiseFactor(double raiseFactor)
- {
- this.raiseFactor = raiseFactor;
- }
-
- /** @return raiseFactor returns raise factor */
- public double getRaiseFactor()
- {
- return raiseFactor;
- }
-
- /** @return yearSalary returns ( monthlySalary * 12 ) */
- public double yearlySalary()
- {
- double yearSalary;
- yearSalary = (monthlySalary * 12);
- return yearSalary;
- }
-
- /** @return salaryAfterRaise returns yearly salary after raise */
- public double salaryAfterRaise()
- {
- double salaryAfterRaise;
- salaryAfterRaise = ((yearlySalary() * (raiseFactor) + yearlySalary()));
- return salaryAfterRaise;
- }
-
- /** Print summary for positive and negative salaries */
- public void printSalary()
- {
- if (getMonthlySalary() > 0.00)
- {
- // For positive monthly salaries.
- System.out.printf(" * %s %s yearly salary is $%.2f. "
- + "After raise is $%.2f",
- getFirstName(),
- getLastName(),
- yearlySalary(),
- salaryAfterRaise());
- System.out.println();
- }
- else
- {
- // For negative monthly salaries.
- System.out.printf(" * %s %s monthly salary is =< 0.00, cannot continue.",
- getFirstName(),
- getLastName());
- System.out.println();
- }
-
- } // END - Print Salary
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Class for Employee
+ *
+ */
+package beam.example.salary.tests;
+
+public class Employee
+{
+ // Instance variables
+ private String firstName;
+ private String lastName;
+ private double monthlySalary;
+ private double raiseFactor;
+
+ public Employee(String firstName, String lastName, double monthlySalary, double raiseFactor)
+ {
+ // instance variables
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.raiseFactor = raiseFactor;
+
+ // only assign monthly salary if > 0.00.
+ if (monthlySalary > 0.0)
+ {
+ this.monthlySalary = monthlySalary;
+ }
+
+ } // end constructor
+
+ /** @param firstName sets employee first name */
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+
+ /** @return firstName returns employee first name */
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ /** @param lastName sets employee last name */
+ public void setLastName(String lastName)
+ {
+ this.lastName = lastName;
+ }
+
+ /** @return lastName returns employee last name */
+ public String getLastName()
+ {
+ return lastName;
+ }
+
+ /** @param monthlySalary sets monthly salary if greater than ( 0.00 ) */
+ public void setMonthlySalary(double monthlySalary)
+ {
+ if (monthlySalary > 0.00)
+ {
+ this.monthlySalary = monthlySalary;
+ }
+ }
+
+ /** @return lastName returns monthly salary */
+ public double getMonthlySalary()
+ {
+ return monthlySalary;
+ }
+
+ /** @param raiseFactor sets raise factor */
+ public void setRaiseFactor(double raiseFactor)
+ {
+ this.raiseFactor = raiseFactor;
+ }
+
+ /** @return raiseFactor returns raise factor */
+ public double getRaiseFactor()
+ {
+ return raiseFactor;
+ }
+
+ /** @return yearSalary returns ( monthlySalary * 12 ) */
+ public double yearlySalary()
+ {
+ double yearSalary;
+ yearSalary = (monthlySalary * 12);
+ return yearSalary;
+ }
+
+ /** @return salaryAfterRaise returns yearly salary after raise */
+ public double salaryAfterRaise()
+ {
+ double salaryAfterRaise;
+ salaryAfterRaise = ((yearlySalary() * (raiseFactor) + yearlySalary()));
+ return salaryAfterRaise;
+ }
+
+ /** Print summary for positive and negative salaries */
+ public void printSalary()
+ {
+ if (getMonthlySalary() > 0.00)
+ {
+ // For positive monthly salaries.
+ System.out.printf(" * %s %s yearly salary is $%.2f. "
+ + "After raise is $%.2f",
+ getFirstName(),
+ getLastName(),
+ yearlySalary(),
+ salaryAfterRaise());
+ System.out.println();
+ }
+ else
+ {
+ // For negative monthly salaries.
+ System.out.printf(" * %s %s monthly salary is =< 0.00, cannot continue.",
+ getFirstName(),
+ getLastName());
+ System.out.println();
+ }
+
+ } // END - Print Salary
+
} /* END - Employee class */
\ No newline at end of file
diff --git a/ConsoleApps/src/beam/example/salary/tests/EmployeeDriver.java b/ConsoleApps/src/beam/example/salary/tests/EmployeeDriver.java
index 0a30364..2701689 100644
--- a/ConsoleApps/src/beam/example/salary/tests/EmployeeDriver.java
+++ b/ConsoleApps/src/beam/example/salary/tests/EmployeeDriver.java
@@ -1,89 +1,89 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java Console Application
- * Description..: Driver for Employee Salary
- *
- */
-package beam.example.salary.tests;
-
-public class EmployeeDriver
-{
-
- public static void main(String[] args)
- {
-
- // print header
- System.out.println("\n Positive and Negative Salary Tests");
- System.out.println("------------------------------------\n");
-
- // test methods
- positiveSalary();
- negativeSalary();
- bothSalary();
-
- // Print end of routine message
- System.out.print("\n End Yearly Salary Calculator Tests.\n");
-
- } // END - Main Method
-
- // Method: Positive Salary
- private static void positiveSalary()
- {
- System.out.println("Test Method - positive monthly salaries");
-
- // Set default record values for testing */
- Employee record1 = new Employee("Jane", "Programmer", 0.00, 0.10);
- Employee record2 = new Employee("Joe", "Programmer", 0.00, 0.10);
-
- // Assert positive values for both records
- record1.setMonthlySalary(3600.00);
- record2.setMonthlySalary(3200.00);
-
- // Prints records.
- record1.printSalary();
- record2.printSalary();
-
- } // END - positiveSalary
-
- // Method: Negative Salary
- private static void negativeSalary()
- {
- System.out.println("\nTest Method - negative monthly salaries");
-
- // Set default values for testing.
- Employee record1 = new Employee("Jane", "Programmer", 0.00, 0.10);
- Employee record2 = new Employee("Joe", "Programmer", 0.00, 0.10);
-
- // Assert negative monthly salaries
- record1.setMonthlySalary(-0.01);
- record2.setMonthlySalary(-0.01);
-
- // Prints salary records.
- record1.printSalary();
- record2.printSalary();
-
- } // END - negativeSalary
-
- // Method: Both Salary
- private static void bothSalary()
- {
- System.out.println("\nTest Method - positive and negative monthly " +
- "salaries");
-
- // Set default record values for testing.
- Employee record1 = new Employee("Jane", "Programmer", 0.00, 0.10);
- Employee record2 = new Employee("Joe", "Programmer", 0.00, 0.10);
-
- // Assert positive and negative monthly salaries */
- record1.setMonthlySalary(3200.00);
- record2.setMonthlySalary(-0.01);
-
- // Print salary records
- record1.printSalary();
- record2.printSalary();
-
- } // END - bothSalary
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java Console Application
+ * Description..: Driver for Employee Salary
+ *
+ */
+package beam.example.salary.tests;
+
+public class EmployeeDriver
+{
+
+ public static void main(String[] args)
+ {
+
+ // print header
+ System.out.println("\n Positive and Negative Salary Tests");
+ System.out.println("------------------------------------\n");
+
+ // test methods
+ positiveSalary();
+ negativeSalary();
+ bothSalary();
+
+ // Print end of routine message
+ System.out.print("\n End Yearly Salary Calculator Tests.\n");
+
+ } // END - Main Method
+
+ // Method: Positive Salary
+ private static void positiveSalary()
+ {
+ System.out.println("Test Method - positive monthly salaries");
+
+ // Set default record values for testing */
+ Employee record1 = new Employee("Jane", "Programmer", 0.00, 0.10);
+ Employee record2 = new Employee("Joe", "Programmer", 0.00, 0.10);
+
+ // Assert positive values for both records
+ record1.setMonthlySalary(3600.00);
+ record2.setMonthlySalary(3200.00);
+
+ // Prints records.
+ record1.printSalary();
+ record2.printSalary();
+
+ } // END - positiveSalary
+
+ // Method: Negative Salary
+ private static void negativeSalary()
+ {
+ System.out.println("\nTest Method - negative monthly salaries");
+
+ // Set default values for testing.
+ Employee record1 = new Employee("Jane", "Programmer", 0.00, 0.10);
+ Employee record2 = new Employee("Joe", "Programmer", 0.00, 0.10);
+
+ // Assert negative monthly salaries
+ record1.setMonthlySalary(-0.01);
+ record2.setMonthlySalary(-0.01);
+
+ // Prints salary records.
+ record1.printSalary();
+ record2.printSalary();
+
+ } // END - negativeSalary
+
+ // Method: Both Salary
+ private static void bothSalary()
+ {
+ System.out.println("\nTest Method - positive and negative monthly " +
+ "salaries");
+
+ // Set default record values for testing.
+ Employee record1 = new Employee("Jane", "Programmer", 0.00, 0.10);
+ Employee record2 = new Employee("Joe", "Programmer", 0.00, 0.10);
+
+ // Assert positive and negative monthly salaries */
+ record1.setMonthlySalary(3200.00);
+ record2.setMonthlySalary(-0.01);
+
+ // Print salary records
+ record1.printSalary();
+ record2.printSalary();
+
+ } // END - bothSalary
+
} /* END - EmployeeDriver class */
\ No newline at end of file
diff --git a/GuiApps/.classpath b/GuiApps/.classpath
index af6f9dc..0cbf9cd 100644
--- a/GuiApps/.classpath
+++ b/GuiApps/.classpath
@@ -1,6 +1,6 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/GuiApps/.project b/GuiApps/.project
index 34e376a..78f42f9 100644
--- a/GuiApps/.project
+++ b/GuiApps/.project
@@ -1,17 +1,17 @@
-
-
- GuiApps
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
+
+
+ GuiApps
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/GuiApps/pom.xml b/GuiApps/pom.xml
new file mode 100644
index 0000000..8967ba2
--- /dev/null
+++ b/GuiApps/pom.xml
@@ -0,0 +1,22 @@
+
+
+
+ 4.0.0
+
+
+ beam.example
+ java-app-examples
+ 1.2.0
+
+
+ gui-apps
+ Graphical Examples
+
+
+
+ src
+
+
+
diff --git a/GuiApps/src/beam/example/firefighter/cost/Driver.java b/GuiApps/src/beam/example/firefighter/cost/Driver.java
index edc522f..f2fa737 100644
--- a/GuiApps/src/beam/example/firefighter/cost/Driver.java
+++ b/GuiApps/src/beam/example/firefighter/cost/Driver.java
@@ -1,188 +1,188 @@
-package beam.example.firefighter.cost;
-
-/**
- * Fire Fighter Cost Calculator
- *
- * Driver for Calculating / Estimating Fire Fighter Costs
- * Repository git@github.com:KI7MT/java-app-examples.git
- *
- *
- * - Driver has user inputs, a loop, switch, and random number generator
- *
- Station generates an ArrayList by stationName, addResponder and loopReponders methods
- *
- Expense Interface adds calculateExpense() method
- *
- FirstResponder Implements Expense (has-a) Expense
- *
- FireFighter adds 3 different Fire Fighter types (is-a) FirstResponder
- *
- Data validation with pop-up message for all fields
- *
- *
- * Build Details
- *
- * - Uses (7) classes, only (4) required
- *
- Calls all methods in extended classes
- *
- FireFighter* extends FirstResponder class
- *
- FireFighter* overrides FirstResponder calculateCost() method
- *
- Station (has-a) expense through FireFighter* and FirstResponder classes
- *
- Expense is the Interface, implemented through FirstResponder class
- *
- Station ArrayList (responders) holds the FireFighter* objects
- *
- User interaction requires multiple input items
- *
- Cost calculation, SubTotal and Grand Total are performed by the Station Class
- *
- All ToString use String.format("") type
- *
- *
- * @author Greg Beam
- * @version 1.2
- * @since 30-DEC-2017
- *
- */
-import java.util.Scanner;
-import java.util.Random;
-
-public class Driver
-{
- /**
- * Method: Main, set Station Name, number of Responders, first and last names
- * of each responder, then call Station.loopResponders() to print the total costs.
- *
- * @param args none
- */
- public static void main(String[] args)
- {
- // station variables
- String stationName;
-
- // fire fighter variables
- String fName;
- String lName;
- String ffType;
- double ppeEmt = 350.00;
- double ppeStructure = 2200.00;
- double ppeWildland = 650.00;
- double chainSaw = 450.00;
- double emtKit = 1200.00;
- double toolKit = 175.00 ;
- double radio = 1200.00;
- double pager = 125.00;
-
- // loop counter
- int ffCount;
-
- // start the scanner
- Scanner input = new Scanner(System.in);
-
- // start user input
- System.out.println("Fire Fighter Cost Estimator\n");
-
- // enter the name of the station to add fire fighters too
- System.out.print("Fire Station Name........: ");
- stationName = input.nextLine();
-
- // instantiate Station class, creates ArrayList responders, enables
- // add and loop methods and sets the station name of the Object
- // to: stationName
- Station station = new Station(stationName);
-
- // how many fire fighters to add to ArrayList stationName
- System.out.print("Number of Fire Fighters..: ");
- ffCount = input.nextInt();
- input.nextLine();
- System.out.print("USE 1 = EMT, 2 = Structure, 3 = Wildland\n");
- System.out.println();
-
- // start fire fighter entry loop
- for (int counter = 0; counter < ffCount; counter++)
- {
- // eye-candy: random number generator for FF number
- System.out.printf("Fire Fighter Number..: %s%n", ranInt(1000,50000));
-
- // fire fighter first name
- System.out.print("First Name ..........: ");
- fName = input.next();
- input.nextLine();
-
- // fire fighter last name
- System.out.print("Last Name ...........: ");
- lName= input.next();
- input.nextLine();
-
- // type of fire fighter
- System.out.print("FF-Type (1, 2, or 3) : ");
- ffType = input.next();
- input.nextLine();
-
- // switch for Hourly, Salary, and Commission based on empType
- switch (ffType)
- {
- case "1": // Fire Fighter EMT
- FireFighterEmt emt = new FireFighterEmt(
- fName,
- lName,
- ppeEmt,
- radio,
- pager,
- emtKit);
-
- // add object to responders array list
- station.addResponder(emt);
-
- break;
-
- case "2": // Fire Fighter Structure
- FireFighterStructure structure = new FireFighterStructure(
- fName,
- lName,
- ppeStructure,
- radio,
- pager,
- toolKit);
-
- // add object to responders array list
- station.addResponder(structure);
-
- break;
-
- case "3": // Fire Fighter Wildland
- FireFighterWildland wildland = new FireFighterWildland(
- fName,
- lName,
- ppeWildland,
- radio,
- pager,
- chainSaw);
-
- // add object to responders array list
- station.addResponder(wildland);
-
- break;
-
- } // END - Case switch
- System.out.println(""); // separates entries
-
- } // END - Entry Loop
-
- // close the scanner to prevent resource leaks
- input.close();
-
- // call Station.loopResponders() to print the data
- station.loopResponder();
-
- } /* END - Main Method */
-
- //--------------------------------------------------------------------------------------//
- // General Purpose Methods
- //--------------------------------------------------------------------------------------//
-
- /**
- * Method: generates a random number. Used for fire fighter badge number (eye-candy).
- *
- * @param min number
- * @param max number
- * @return random number for fire fighter number
- */
- private static int ranInt(int min, int max)
- {
- Random rand = new Random();
- return rand.nextInt((max - min) + 1);
-
- } /* END - Random number generator method */
-
+package beam.example.firefighter.cost;
+
+/**
+ * Fire Fighter Cost Calculator
+ *
+ * Driver for Calculating / Estimating Fire Fighter Costs
+ * Repository git@github.com:KI7MT/java-app-examples.git
+ *
+ *
+ * - Driver has user inputs, a loop, switch, and random number generator
+ *
- Station generates an ArrayList by stationName, addResponder and loopReponders methods
+ *
- Expense Interface adds calculateExpense() method
+ *
- FirstResponder Implements Expense (has-a) Expense
+ *
- FireFighter adds 3 different Fire Fighter types (is-a) FirstResponder
+ *
- Data validation with pop-up message for all fields
+ *
+ *
+ * Build Details
+ *
+ * - Uses (7) classes, only (4) required
+ *
- Calls all methods in extended classes
+ *
- FireFighter* extends FirstResponder class
+ *
- FireFighter* overrides FirstResponder calculateCost() method
+ *
- Station (has-a) expense through FireFighter* and FirstResponder classes
+ *
- Expense is the Interface, implemented through FirstResponder class
+ *
- Station ArrayList (responders) holds the FireFighter* objects
+ *
- User interaction requires multiple input items
+ *
- Cost calculation, SubTotal and Grand Total are performed by the Station Class
+ *
- All ToString use String.format("") type
+ *
+ *
+ * @author Greg Beam
+ * @version 1.2
+ * @since 30-DEC-2017
+ *
+ */
+import java.util.Scanner;
+import java.util.Random;
+
+public class Driver
+{
+ /**
+ * Method: Main, set Station Name, number of Responders, first and last names
+ * of each responder, then call Station.loopResponders() to print the total costs.
+ *
+ * @param args none
+ */
+ public static void main(String[] args)
+ {
+ // station variables
+ String stationName;
+
+ // fire fighter variables
+ String fName;
+ String lName;
+ String ffType;
+ double ppeEmt = 350.00;
+ double ppeStructure = 2200.00;
+ double ppeWildland = 650.00;
+ double chainSaw = 450.00;
+ double emtKit = 1200.00;
+ double toolKit = 175.00 ;
+ double radio = 1200.00;
+ double pager = 125.00;
+
+ // loop counter
+ int ffCount;
+
+ // start the scanner
+ Scanner input = new Scanner(System.in);
+
+ // start user input
+ System.out.println("Fire Fighter Cost Estimator\n");
+
+ // enter the name of the station to add fire fighters too
+ System.out.print("Fire Station Name........: ");
+ stationName = input.nextLine();
+
+ // instantiate Station class, creates ArrayList responders, enables
+ // add and loop methods and sets the station name of the Object
+ // to: stationName
+ Station station = new Station(stationName);
+
+ // how many fire fighters to add to ArrayList stationName
+ System.out.print("Number of Fire Fighters..: ");
+ ffCount = input.nextInt();
+ input.nextLine();
+ System.out.print("USE 1 = EMT, 2 = Structure, 3 = Wildland\n");
+ System.out.println();
+
+ // start fire fighter entry loop
+ for (int counter = 0; counter < ffCount; counter++)
+ {
+ // eye-candy: random number generator for FF number
+ System.out.printf("Fire Fighter Number..: %s%n", ranInt(1000,50000));
+
+ // fire fighter first name
+ System.out.print("First Name ..........: ");
+ fName = input.next();
+ input.nextLine();
+
+ // fire fighter last name
+ System.out.print("Last Name ...........: ");
+ lName= input.next();
+ input.nextLine();
+
+ // type of fire fighter
+ System.out.print("FF-Type (1, 2, or 3) : ");
+ ffType = input.next();
+ input.nextLine();
+
+ // switch for Hourly, Salary, and Commission based on empType
+ switch (ffType)
+ {
+ case "1": // Fire Fighter EMT
+ FireFighterEmt emt = new FireFighterEmt(
+ fName,
+ lName,
+ ppeEmt,
+ radio,
+ pager,
+ emtKit);
+
+ // add object to responders array list
+ station.addResponder(emt);
+
+ break;
+
+ case "2": // Fire Fighter Structure
+ FireFighterStructure structure = new FireFighterStructure(
+ fName,
+ lName,
+ ppeStructure,
+ radio,
+ pager,
+ toolKit);
+
+ // add object to responders array list
+ station.addResponder(structure);
+
+ break;
+
+ case "3": // Fire Fighter Wildland
+ FireFighterWildland wildland = new FireFighterWildland(
+ fName,
+ lName,
+ ppeWildland,
+ radio,
+ pager,
+ chainSaw);
+
+ // add object to responders array list
+ station.addResponder(wildland);
+
+ break;
+
+ } // END - Case switch
+ System.out.println(""); // separates entries
+
+ } // END - Entry Loop
+
+ // close the scanner to prevent resource leaks
+ input.close();
+
+ // call Station.loopResponders() to print the data
+ station.loopResponder();
+
+ } /* END - Main Method */
+
+ //--------------------------------------------------------------------------------------//
+ // General Purpose Methods
+ //--------------------------------------------------------------------------------------//
+
+ /**
+ * Method: generates a random number. Used for fire fighter badge number (eye-candy).
+ *
+ * @param min number
+ * @param max number
+ * @return random number for fire fighter number
+ */
+ private static int ranInt(int min, int max)
+ {
+ Random rand = new Random();
+ return rand.nextInt((max - min) + 1);
+
+ } /* END - Random number generator method */
+
} /* END - Driver Class */
\ No newline at end of file
diff --git a/GuiApps/src/beam/example/firefighter/cost/Expense.java b/GuiApps/src/beam/example/firefighter/cost/Expense.java
index b0e6e24..d414acd 100644
--- a/GuiApps/src/beam/example/firefighter/cost/Expense.java
+++ b/GuiApps/src/beam/example/firefighter/cost/Expense.java
@@ -1,21 +1,21 @@
-package beam.example.firefighter.cost;
-
-/**
- * Expense.java
- * Interface for calculating costs for an Object
- * Repository git@github.com:KI7MT/java-app-examples.git
- *
- * @author Greg Beam
- * @version 1.2
- * @since 30-DEC-2017
- *
- */
-
-public interface Expense
-{
- // calculates the cost of something or someone
- default double calculateExpense() {
- return 0;
- }
-
+package beam.example.firefighter.cost;
+
+/**
+ * Expense.java
+ * Interface for calculating costs for an Object
+ * Repository git@github.com:KI7MT/java-app-examples.git
+ *
+ * @author Greg Beam
+ * @version 1.2
+ * @since 30-DEC-2017
+ *
+ */
+
+public interface Expense
+{
+ // calculates the cost of something or someone
+ default double calculateExpense() {
+ return 0;
+ }
+
} /* END - Expense Interface */
\ No newline at end of file
diff --git a/GuiApps/src/beam/example/firefighter/cost/FireFighterCostGUI.java b/GuiApps/src/beam/example/firefighter/cost/FireFighterCostGUI.java
index a8997a6..b6994c1 100644
--- a/GuiApps/src/beam/example/firefighter/cost/FireFighterCostGUI.java
+++ b/GuiApps/src/beam/example/firefighter/cost/FireFighterCostGUI.java
@@ -1,440 +1,440 @@
-package beam.example.firefighter.cost;
-
-/**
- * FireFighterCostGUI.java
- * UI Driver for calculating Fire Fighter costs
- * Repository git@github.com:KI7MT/java-app-examples.git
- *
- * @author Greg Beam
- * @version 1.2
- * @since 30-DEC-2017
- *
- */
-import java.awt.EventQueue;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import javax.swing.JComboBox;
-import javax.swing.DefaultComboBoxModel;
-import java.awt.Font;
-import javax.swing.JButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-
-public class FireFighterCostGUI extends JFrame
-{
- /**
- * Class Variables
- *
- * - Serial Version UID
- *
- Initializes JTextFields, JComboBox, BoxOptions, JTextArea
- *
- Creates Station Array
- *
- Initializes Wildland, Structure, and EMT variable names
- *
- Sets default values for chainSaw, emtKit, and toolKit
- *
- *
- */
- private static final long serialVersionUID = 1L;
- private JTextField txtFirstName;
- private JTextField txtLastName;
- private JTextField txtPpeCost;
- private JTextField txtRadioCost;
- private JTextField txtPagerCost;
- private DefaultComboBoxModel comboModel;
- private JComboBox comboBox;
- private static JTextArea textArea;
- private String[] boxOptions = {"Select..", "EMT", "Wildland", "Structure"};
-
- // variables used in processing fire fighters
- Station station = new Station("York Fire Rescue");
- FireFighterWildland wildland;
- FireFighterEmt emt;
- FireFighterStructure structure;
- private double chainSaw = 450.00;
- private double emtKit = 1200.00;
- private double toolKit = 175.00 ;
-
- /**
- * Method: Main UI Frame
- *
- * Provides the Main UI Frame, entry fields, and associated controls.
- */
- public FireFighterCostGUI()
- {
- setResizable(false);
- setTitle("Fire Fighter Cost Calculator");
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 450, 335);
- getContentPane().setLayout(null);
-
- // First Name and Label
- JLabel lblFirstName = new JLabel("First Name");
- lblFirstName.setFont(new Font("Tahoma", Font.BOLD, 12));
- lblFirstName.setBounds(10, 11, 63, 14);
- getContentPane().add(lblFirstName);
- txtFirstName = new JTextField();
- txtFirstName.setBounds(10, 26, 86, 20);
- txtFirstName.setColumns(10);
- getContentPane().add(txtFirstName);
-
- // Last Name and Label
- JLabel lblLastName = new JLabel("Last Name");
- lblLastName.setFont(new Font("Tahoma", Font.BOLD, 12));
- lblLastName.setBounds(101, 12, 63, 14);
- getContentPane().add(lblLastName);
- txtLastName = new JTextField();
- txtLastName.setBounds(101, 26, 86, 20);
- txtLastName.setColumns(10);
- getContentPane().add(txtLastName);
-
- // PPE Cost and Label
- JLabel lblPpeCost = new JLabel("PPE Cost");
- lblPpeCost.setFont(new Font("Tahoma", Font.BOLD, 12));
- lblPpeCost.setBounds(10, 57, 86, 14);
- getContentPane().add(lblPpeCost);
- txtPpeCost = new JTextField();
- txtPpeCost.setBounds(10, 71, 86, 20);
- getContentPane().add(txtPpeCost);
- txtPpeCost.setColumns(10);
-
- // Radio Cost and Label
- JLabel lblRadioCost = new JLabel("Radio Cost");
- lblRadioCost.setFont(new Font("Tahoma", Font.BOLD, 12));
- lblRadioCost.setBounds(10, 102, 86, 14);
- getContentPane().add(lblRadioCost);
- txtRadioCost = new JTextField();
- txtRadioCost.setColumns(10);
- txtRadioCost.setBounds(10, 118, 86, 20);
- getContentPane().add(txtRadioCost);
-
- // Pager Cost and Label
- JLabel lblPagerCost = new JLabel("Pager Cost");
- lblPagerCost.setFont(new Font("Tahoma", Font.BOLD, 12));
- lblPagerCost.setBounds(10, 149, 86, 14);
- getContentPane().add(lblPagerCost);
- txtPagerCost = new JTextField();
- txtPagerCost.setColumns(10);
- txtPagerCost.setBounds(10, 167, 86, 20);
- getContentPane().add(txtPagerCost);
-
- // JComboBox and Text Label
- JLabel lblType = new JLabel("Type");
- lblType.setFont(new Font("Tahoma", Font.BOLD, 12));
- lblType.setBounds(10, 198, 86, 14);
- getContentPane().add(lblType);
- comboModel = new DefaultComboBoxModel(boxOptions);
- comboBox = new JComboBox(comboModel);
- comboBox.setBounds(9, 217, 87, 20);
- getContentPane().add(comboBox);
-
- // JTextArea - Main Text box for UI
- textArea = new JTextArea();
- textArea.setFocusable(false);
- textArea.setEditable(false);
- textArea.setBounds(204, 26, 198, 211);
- textArea.setText("Ready for entries ...");
-
- /**
- * ActionListener: ADD BUTTON
- *
- * - LAdds fire fighter data to Station.ArrayList responders
- * - Clears the input boxes and the JTextArea
- * - Displays calculations for the fire fighter being entered
- *
- *
- * @throws IllegalArgumentException for empty names
- * @throws NumberFormatException for invalid cost entries
- * @throws NumberFormatException for invalid index on combobox ~ 0
- *
- */
- JButton btnAdd = new JButton("Add");
- btnAdd.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- String fname = "";
- String lname = "";
- double ppeCost = 0;
- double radioCost = 0;
- double pagerCost = 0;
- String fftype = "EMT";
- boolean datavalid = false;
-
- // first name cannot be blank
- try
- {
- fname = txtFirstName.getText();
- // check if empty
- if(fname.trim().isEmpty())
- {
- throw new IllegalArgumentException();
- }
- datavalid = true;
- } catch (IllegalArgumentException e1)
- {
- JOptionPane.showMessageDialog(null, "Please Enter A First Name", "Entry Error", JOptionPane.ERROR_MESSAGE);
- txtFirstName.requestFocus();
- datavalid = false;
- }
-
- // last name cannot be blank
- if (datavalid)
- {
- try
- {
- lname = txtLastName.getText();
- if(lname.trim().isEmpty())
- {
- throw new IllegalArgumentException();
- }
- datavalid = true;
- } catch (Exception e2)
- {
- JOptionPane.showMessageDialog(null, "Please Enter A Last Name", "Entry Error", JOptionPane.ERROR_MESSAGE);
- txtLastName.requestFocus();
- datavalid = false;
- }
- }
-
- // catch integer or double error
- if (datavalid)
- {
- try
- {
- ppeCost = Double.parseDouble(txtPpeCost.getText());
- } catch (NumberFormatException e3)
- {
- JOptionPane.showMessageDialog(null, "PPE Cost Error, Check Entry", "Entry Status Error", JOptionPane.ERROR_MESSAGE);
- txtPpeCost.requestFocus();
- datavalid = false;
- }
- }
-
- // catch integer or double error
- if (datavalid)
- {
- try
- {
- radioCost = Double.parseDouble(txtRadioCost.getText());
- datavalid = true;
- } catch (NumberFormatException e4)
- {
- JOptionPane.showMessageDialog(null, "Radio Cost Error, Check Entry", "Entry Status Error", JOptionPane.ERROR_MESSAGE);
- txtRadioCost.requestFocus();
- datavalid = false;
- }
- }
-
- // catch integer or double error
- if (datavalid)
- {
- try
- {
- pagerCost = Double.parseDouble(txtPagerCost.getText());
- datavalid = true;
- } catch (NumberFormatException e5)
- {
- JOptionPane.showMessageDialog(null, "Pager Cost Error, Check Entry", "Entry Status Error", JOptionPane.ERROR_MESSAGE);
- txtPagerCost.requestFocus();
- datavalid = false;
- }
- }
-
- // check for combobox errors
- if (datavalid)
- {
- try
- {
- fftype = comboBox.getSelectedItem().toString();
-
- // check is the user
- if (comboBox.getSelectedItem() == "Select..")
- {
- throw new NumberFormatException();
- }
- datavalid = true;
- }
- catch (NumberFormatException e6)
- {
- JOptionPane.showMessageDialog(null, "Please Select A Fire Fighter Type", "Type Selection Error", JOptionPane.ERROR_MESSAGE);
- comboBox.requestFocus();
- datavalid = false;
- }
- }
-
- // only use the switch if datavalid
- if (datavalid)
- {
- // clear the main text area first
- clearUI();
-
- // switch for EMT, Wildland, or Structure Fire Fighter
- switch (fftype)
- {
- case "EMT": // Fire Fighter EMT
- emt = new FireFighterEmt(
- fname,
- lname,
- ppeCost,
- radioCost,
- pagerCost,
- emtKit);
-
- // add object to responders array list
- station.addResponder(emt);
- textArea.setText(station.toString() + "\n" + emt.toString());
- break;
-
- case "Structure": // Fire Fighter Structure
- structure = new FireFighterStructure(
- fname,
- lname,
- ppeCost,
- radioCost,
- pagerCost,
- toolKit);
-
- // add object to responders array list
- station.addResponder(structure);
- textArea.setText(station.toString() + "\n" + structure.toString());
- break;
-
- case "Wildland": // Fire Fighter Wildland
- wildland = new FireFighterWildland(
- fname,
- lname,
- ppeCost,
- radioCost,
- pagerCost,
- chainSaw);
-
- // add object to responders array list
- station.addResponder(wildland);
- textArea.setText(station.toString() + "\n" + wildland.toString());
- break;
- } // END - Case switch
- }
- }
- });
- btnAdd.setBounds(7, 259, 89, 23);
- getContentPane().add(btnAdd);
-
- /**
- * ActionListener: Clear
- *
- * - Clears the input boxes and the JTextArea
- *
- *
- */
- JButton btnClear = new JButton("Clear");
- btnClear.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- clearUI();
- }
-
- });
- btnClear.setBounds(106, 259, 89, 23);
- getContentPane().add(btnClear);
-
- /**
- * Action Event Handler: Station Cost
- *
- * - Loops through Station.ArrayList responders
- * - Display data for each object (FirsrstResponders) in the array
- * - Calculates cost for each Fire Fighters plus a summary cost
- *
- */
- JButton btnStationCost = new JButton("Station Cost");
- btnStationCost.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- // clear the screen first
- clearUI();
-
- // format and append Station Cost to the JTextArea
- String s = String.format("%-14s %-20s", "Station :", station.getStationName());
- textArea.append(s + "\n\n");
-
- // local variable for total cost calculation
- double grandTotal = 0;
-
- // loop through the array to print responder data
- for (FirstResponder respond : station.getResponders())
- {
- textArea.append(respond.toString());
- textArea.append("\n\n");
- grandTotal += respond.calculateExpense();
- }
-
- // format and append Station Cost to the JTextArea
- String g = String.format("%-14s $%-20.2f", "Station Cost :", grandTotal);
- textArea.append(g);
- }
- });
- btnStationCost.setBounds(205, 259, 118, 23);
- getContentPane().add(btnStationCost);
-
- // ScrollPane with auto-vertical scroll bar
- JScrollPane scrollPane = new JScrollPane(textArea);
- scrollPane.setFocusable(false);
- scrollPane.setBounds(205, 26, 216, 211);
- getContentPane().add(scrollPane);
-
- JLabel lblCostSummary = new JLabel("Cost Summary");
- lblCostSummary.setFont(new Font("Tahoma", Font.BOLD, 12));
- lblCostSummary.setBounds(267, 11, 103, 14);
- getContentPane().add(lblCostSummary);
- }
-
- /**
- * Method: clearUI
- *
- * - Clears the contents of all UI files including the JTextArea
- * - Does NOT reset or delete data in the Station.ArrayList
- *
- */
- private void clearUI()
- {
- txtFirstName.setText("");
- txtLastName.setText("");
- txtPpeCost.setText("");
- txtRadioCost.setText("");
- txtPagerCost.setText("");
- comboBox.setSelectedItem("Select..");
- textArea.setText("");
- txtFirstName.requestFocus();
- } // - END Clear UI
-
- /**
- * Method: Main
- * Launch the application.
- *
- * @param args no arguments for main method
- *
- */
- public static void main(String[] args)
- {
- EventQueue.invokeLater(new Runnable()
- {
- public void run()
- {
- try
- {
- FireFighterCostGUI frame = new FireFighterCostGUI();
- frame.setVisible(true);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- });
- }
-
-} /* END - Fire Fighter Cost Calculator */
+package beam.example.firefighter.cost;
+
+/**
+ * FireFighterCostGUI.java
+ * UI Driver for calculating Fire Fighter costs
+ * Repository git@github.com:KI7MT/java-app-examples.git
+ *
+ * @author Greg Beam
+ * @version 1.2
+ * @since 30-DEC-2017
+ *
+ */
+import java.awt.EventQueue;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JTextField;
+import javax.swing.JComboBox;
+import javax.swing.DefaultComboBoxModel;
+import java.awt.Font;
+import javax.swing.JButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public final class FireFighterCostGUI extends JFrame
+{
+ /**
+ * Class Variables
+ *
+ * - Serial Version UID
+ *
- Initializes JTextFields, JComboBox, BoxOptions, JTextArea
+ *
- Creates Station Array
+ *
- Initializes Wildland, Structure, and EMT variable names
+ *
- Sets default values for chainSaw, emtKit, and toolKit
+ *
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private JTextField txtFirstName;
+ private JTextField txtLastName;
+ private JTextField txtPpeCost;
+ private JTextField txtRadioCost;
+ private JTextField txtPagerCost;
+ private DefaultComboBoxModel comboModel;
+ private JComboBox comboBox;
+ private static JTextArea textArea;
+ private String[] boxOptions = {"Select..", "EMT", "Wildland", "Structure"};
+
+ // variables used in processing fire fighters
+ transient Station station = new Station("York Fire Rescue");
+ transient FireFighterWildland wildland;
+ transient FireFighterEmt emt;
+ transient FireFighterStructure structure;
+ private double chainSaw = 450.00;
+ private double emtKit = 1200.00;
+ private double toolKit = 175.00 ;
+
+ /**
+ * Method: Main UI Frame
+ *
+ * Provides the Main UI Frame, entry fields, and associated controls.
+ */
+ public FireFighterCostGUI()
+ {
+ setResizable(false);
+ setTitle("Fire Fighter Cost Calculator");
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ setBounds(100, 100, 450, 335);
+ getContentPane().setLayout(null);
+
+ // First Name and Label
+ JLabel lblFirstName = new JLabel("First Name");
+ lblFirstName.setFont(new Font("Tahoma", Font.BOLD, 12));
+ lblFirstName.setBounds(10, 11, 63, 14);
+ getContentPane().add(lblFirstName);
+ txtFirstName = new JTextField();
+ txtFirstName.setBounds(10, 26, 86, 20);
+ txtFirstName.setColumns(10);
+ getContentPane().add(txtFirstName);
+
+ // Last Name and Label
+ JLabel lblLastName = new JLabel("Last Name");
+ lblLastName.setFont(new Font("Tahoma", Font.BOLD, 12));
+ lblLastName.setBounds(101, 12, 63, 14);
+ getContentPane().add(lblLastName);
+ txtLastName = new JTextField();
+ txtLastName.setBounds(101, 26, 86, 20);
+ txtLastName.setColumns(10);
+ getContentPane().add(txtLastName);
+
+ // PPE Cost and Label
+ JLabel lblPpeCost = new JLabel("PPE Cost");
+ lblPpeCost.setFont(new Font("Tahoma", Font.BOLD, 12));
+ lblPpeCost.setBounds(10, 57, 86, 14);
+ getContentPane().add(lblPpeCost);
+ txtPpeCost = new JTextField();
+ txtPpeCost.setBounds(10, 71, 86, 20);
+ getContentPane().add(txtPpeCost);
+ txtPpeCost.setColumns(10);
+
+ // Radio Cost and Label
+ JLabel lblRadioCost = new JLabel("Radio Cost");
+ lblRadioCost.setFont(new Font("Tahoma", Font.BOLD, 12));
+ lblRadioCost.setBounds(10, 102, 86, 14);
+ getContentPane().add(lblRadioCost);
+ txtRadioCost = new JTextField();
+ txtRadioCost.setColumns(10);
+ txtRadioCost.setBounds(10, 118, 86, 20);
+ getContentPane().add(txtRadioCost);
+
+ // Pager Cost and Label
+ JLabel lblPagerCost = new JLabel("Pager Cost");
+ lblPagerCost.setFont(new Font("Tahoma", Font.BOLD, 12));
+ lblPagerCost.setBounds(10, 149, 86, 14);
+ getContentPane().add(lblPagerCost);
+ txtPagerCost = new JTextField();
+ txtPagerCost.setColumns(10);
+ txtPagerCost.setBounds(10, 167, 86, 20);
+ getContentPane().add(txtPagerCost);
+
+ // JComboBox and Text Label
+ JLabel lblType = new JLabel("Type");
+ lblType.setFont(new Font("Tahoma", Font.BOLD, 12));
+ lblType.setBounds(10, 198, 86, 14);
+ getContentPane().add(lblType);
+ comboModel = new DefaultComboBoxModel(boxOptions);
+ comboBox = new JComboBox(comboModel);
+ comboBox.setBounds(9, 217, 87, 20);
+ getContentPane().add(comboBox);
+
+ // JTextArea - Main Text box for UI
+ textArea = new JTextArea();
+ textArea.setFocusable(false);
+ textArea.setEditable(false);
+ textArea.setBounds(204, 26, 198, 211);
+ textArea.setText("Ready for entries ...");
+
+ /**
+ * ActionListener: ADD BUTTON
+ *
+ * - LAdds fire fighter data to Station.ArrayList responders
+ * - Clears the input boxes and the JTextArea
+ * - Displays calculations for the fire fighter being entered
+ *
+ *
+ * @throws IllegalArgumentException for empty names
+ * @throws NumberFormatException for invalid cost entries
+ * @throws NumberFormatException for invalid index on combobox ~ 0
+ *
+ */
+ JButton btnAdd = new JButton("Add");
+ btnAdd.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ String fname = "";
+ String lname = "";
+ double ppeCost = 0;
+ double radioCost = 0;
+ double pagerCost = 0;
+ String fftype = "EMT";
+ boolean datavalid = false;
+
+ // first name cannot be blank
+ try
+ {
+ fname = txtFirstName.getText();
+ // check if empty
+ if(fname.trim().isEmpty())
+ {
+ throw new IllegalArgumentException();
+ }
+ datavalid = true;
+ } catch (IllegalArgumentException e1)
+ {
+ JOptionPane.showMessageDialog(null, "Please Enter A First Name", "Entry Error", JOptionPane.ERROR_MESSAGE);
+ txtFirstName.requestFocus();
+ datavalid = false;
+ }
+
+ // last name cannot be blank
+ if (datavalid)
+ {
+ try
+ {
+ lname = txtLastName.getText();
+ if(lname.trim().isEmpty())
+ {
+ throw new IllegalArgumentException();
+ }
+ datavalid = true;
+ } catch (Exception e2)
+ {
+ JOptionPane.showMessageDialog(null, "Please Enter A Last Name", "Entry Error", JOptionPane.ERROR_MESSAGE);
+ txtLastName.requestFocus();
+ datavalid = false;
+ }
+ }
+
+ // catch integer or double error
+ if (datavalid)
+ {
+ try
+ {
+ ppeCost = Double.parseDouble(txtPpeCost.getText());
+ } catch (NumberFormatException e3)
+ {
+ JOptionPane.showMessageDialog(null, "PPE Cost Error, Check Entry", "Entry Status Error", JOptionPane.ERROR_MESSAGE);
+ txtPpeCost.requestFocus();
+ datavalid = false;
+ }
+ }
+
+ // catch integer or double error
+ if (datavalid)
+ {
+ try
+ {
+ radioCost = Double.parseDouble(txtRadioCost.getText());
+ datavalid = true;
+ } catch (NumberFormatException e4)
+ {
+ JOptionPane.showMessageDialog(null, "Radio Cost Error, Check Entry", "Entry Status Error", JOptionPane.ERROR_MESSAGE);
+ txtRadioCost.requestFocus();
+ datavalid = false;
+ }
+ }
+
+ // catch integer or double error
+ if (datavalid)
+ {
+ try
+ {
+ pagerCost = Double.parseDouble(txtPagerCost.getText());
+ datavalid = true;
+ } catch (NumberFormatException e5)
+ {
+ JOptionPane.showMessageDialog(null, "Pager Cost Error, Check Entry", "Entry Status Error", JOptionPane.ERROR_MESSAGE);
+ txtPagerCost.requestFocus();
+ datavalid = false;
+ }
+ }
+
+ // check for combobox errors
+ if (datavalid)
+ {
+ try
+ {
+ fftype = comboBox.getSelectedItem().toString();
+
+ // check is the user
+ if (comboBox.getSelectedItem() == "Select..")
+ {
+ throw new NumberFormatException();
+ }
+ datavalid = true;
+ }
+ catch (NumberFormatException e6)
+ {
+ JOptionPane.showMessageDialog(null, "Please Select A Fire Fighter Type", "Type Selection Error", JOptionPane.ERROR_MESSAGE);
+ comboBox.requestFocus();
+ datavalid = false;
+ }
+ }
+
+ // only use the switch if datavalid
+ if (datavalid)
+ {
+ // clear the main text area first
+ clearUI();
+
+ // switch for EMT, Wildland, or Structure Fire Fighter
+ switch (fftype)
+ {
+ case "EMT": // Fire Fighter EMT
+ emt = new FireFighterEmt(
+ fname,
+ lname,
+ ppeCost,
+ radioCost,
+ pagerCost,
+ emtKit);
+
+ // add object to responders array list
+ station.addResponder(emt);
+ textArea.setText(station.toString() + "\n" + emt.toString());
+ break;
+
+ case "Structure": // Fire Fighter Structure
+ structure = new FireFighterStructure(
+ fname,
+ lname,
+ ppeCost,
+ radioCost,
+ pagerCost,
+ toolKit);
+
+ // add object to responders array list
+ station.addResponder(structure);
+ textArea.setText(station.toString() + "\n" + structure.toString());
+ break;
+
+ case "Wildland": // Fire Fighter Wildland
+ wildland = new FireFighterWildland(
+ fname,
+ lname,
+ ppeCost,
+ radioCost,
+ pagerCost,
+ chainSaw);
+
+ // add object to responders array list
+ station.addResponder(wildland);
+ textArea.setText(station.toString() + "\n" + wildland.toString());
+ break;
+ } // END - Case switch
+ }
+ }
+ });
+ btnAdd.setBounds(7, 259, 89, 23);
+ getContentPane().add(btnAdd);
+
+ /**
+ * ActionListener: Clear
+ *
+ * - Clears the input boxes and the JTextArea
+ *
+ *
+ */
+ JButton btnClear = new JButton("Clear");
+ btnClear.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ clearUI();
+ }
+
+ });
+ btnClear.setBounds(106, 259, 89, 23);
+ getContentPane().add(btnClear);
+
+ /**
+ * Action Event Handler: Station Cost
+ *
+ * - Loops through Station.ArrayList responders
+ * - Display data for each object (FirsrstResponders) in the array
+ * - Calculates cost for each Fire Fighters plus a summary cost
+ *
+ */
+ JButton btnStationCost = new JButton("Station Cost");
+ btnStationCost.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ // clear the screen first
+ clearUI();
+
+ // format and append Station Cost to the JTextArea
+ String s = String.format("%-14s %-20s", "Station :", station.getStationName());
+ textArea.append(s + "\n\n");
+
+ // local variable for total cost calculation
+ double grandTotal = 0;
+
+ // loop through the array to print responder data
+ for (FirstResponder respond : station.getResponders())
+ {
+ textArea.append(respond.toString());
+ textArea.append("\n\n");
+ grandTotal += respond.calculateExpense();
+ }
+
+ // format and append Station Cost to the JTextArea
+ String g = String.format("%-14s $%-20.2f", "Station Cost :", grandTotal);
+ textArea.append(g);
+ }
+ });
+ btnStationCost.setBounds(205, 259, 118, 23);
+ getContentPane().add(btnStationCost);
+
+ // ScrollPane with auto-vertical scroll bar
+ JScrollPane scrollPane = new JScrollPane(textArea);
+ scrollPane.setFocusable(false);
+ scrollPane.setBounds(205, 26, 216, 211);
+ getContentPane().add(scrollPane);
+
+ JLabel lblCostSummary = new JLabel("Cost Summary");
+ lblCostSummary.setFont(new Font("Tahoma", Font.BOLD, 12));
+ lblCostSummary.setBounds(267, 11, 103, 14);
+ getContentPane().add(lblCostSummary);
+ }
+
+ /**
+ * Method: clearUI
+ *
+ * - Clears the contents of all UI files including the JTextArea
+ * - Does NOT reset or delete data in the Station.ArrayList
+ *
+ */
+ private void clearUI()
+ {
+ txtFirstName.setText("");
+ txtLastName.setText("");
+ txtPpeCost.setText("");
+ txtRadioCost.setText("");
+ txtPagerCost.setText("");
+ comboBox.setSelectedItem("Select..");
+ textArea.setText("");
+ txtFirstName.requestFocus();
+ } // - END Clear UI
+
+ /**
+ * Method: Main
+ * Launch the application.
+ *
+ * @param args no arguments for main method
+ *
+ */
+ public static void main(String[] args)
+ {
+ EventQueue.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ FireFighterCostGUI frame = new FireFighterCostGUI();
+ frame.setVisible(true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+} /* END - Fire Fighter Cost Calculator */
diff --git a/GuiApps/src/beam/example/firefighter/cost/FireFighterEmt.java b/GuiApps/src/beam/example/firefighter/cost/FireFighterEmt.java
index 2aef579..8cc95ff 100644
--- a/GuiApps/src/beam/example/firefighter/cost/FireFighterEmt.java
+++ b/GuiApps/src/beam/example/firefighter/cost/FireFighterEmt.java
@@ -1,82 +1,82 @@
-package beam.example.firefighter.cost;
-
-/**
- * FireFighterEmt.java
- * EMT Fire Fighter Class, extends FirstResponder
- * Repository git@github.com:KI7MT/java-app-examples.git
- *
- * @author Greg Beam
- * @version 1.2
- * @since 30-DEC-2017
- *
- */
-
-public class FireFighterEmt extends FirstResponder
-{
- private double emtKitCost;
-
- /**
- * Constructor for FireFighterEmt
- *
- * @param firstName first name of fire fighter
- * @param lastName last name of fire fighter
- * @param ppeCost personal protect cost
- * @param radioCost cost of radio
- * @param pagerCost cost of pager
- * @param emtKitCost cost of EMT kit
- */
- public FireFighterEmt(
- String firstName,
- String lastName,
- double ppeCost,
- double radioCost,
- double pagerCost,
- double emtKitCost
- )
- {
- super(firstName, lastName, ppeCost, radioCost, pagerCost);
- this.emtKitCost = emtKitCost;
- }
-
- /**
- * Method: implements Interface Expense calculateExpense()
- */
- @Override
- public double calculateExpense()
- {
- double total = 0;
-
- total += getPpeCost();
- total += getRadioCost();
- total += getPagerCost();
- total += emtKitCost;
-
- return total;
- }
-
- /**
- *
- * @return EMT Kit Cost
- */
- public double getEmtKitCost()
- {
- return emtKitCost;
- }
-
- public void setEmtKitCost(double emtKitCost)
- {
- this.emtKitCost = emtKitCost;
- }
-
- /**
- * ToString method to print class data
- */
- @Override
- public String toString()
- {
- String s = String.format("%-13s $%-20.2f", "EMT Kit :", getEmtKitCost());
- String e = String.format("%-12s $%-20.2f", "SubTotal :", calculateExpense());
- return (super.toString() + "\n" + s + "\n" + e);
- }
-
-} /* END - Fire Fighter EMT Class */
+package beam.example.firefighter.cost;
+
+/**
+ * FireFighterEmt.java
+ * EMT Fire Fighter Class, extends FirstResponder
+ * Repository git@github.com:KI7MT/java-app-examples.git
+ *
+ * @author Greg Beam
+ * @version 1.2
+ * @since 30-DEC-2017
+ *
+ */
+
+public class FireFighterEmt extends FirstResponder
+{
+ private double emtKitCost;
+
+ /**
+ * Constructor for FireFighterEmt
+ *
+ * @param firstName first name of fire fighter
+ * @param lastName last name of fire fighter
+ * @param ppeCost personal protect cost
+ * @param radioCost cost of radio
+ * @param pagerCost cost of pager
+ * @param emtKitCost cost of EMT kit
+ */
+ public FireFighterEmt(
+ String firstName,
+ String lastName,
+ double ppeCost,
+ double radioCost,
+ double pagerCost,
+ double emtKitCost
+ )
+ {
+ super(firstName, lastName, ppeCost, radioCost, pagerCost);
+ this.emtKitCost = emtKitCost;
+ }
+
+ /**
+ * Method: implements Interface Expense calculateExpense()
+ */
+ @Override
+ public double calculateExpense()
+ {
+ double total = 0;
+
+ total += getPpeCost();
+ total += getRadioCost();
+ total += getPagerCost();
+ total += emtKitCost;
+
+ return total;
+ }
+
+ /**
+ *
+ * @return EMT Kit Cost
+ */
+ public double getEmtKitCost()
+ {
+ return emtKitCost;
+ }
+
+ public void setEmtKitCost(double emtKitCost)
+ {
+ this.emtKitCost = emtKitCost;
+ }
+
+ /**
+ * ToString method to print class data
+ */
+ @Override
+ public String toString()
+ {
+ String s = String.format("%-13s $%-20.2f", "EMT Kit :", getEmtKitCost());
+ String e = String.format("%-12s $%-20.2f", "SubTotal :", calculateExpense());
+ return (super.toString() + "\n" + s + "\n" + e);
+ }
+
+} /* END - Fire Fighter EMT Class */
diff --git a/GuiApps/src/beam/example/firefighter/cost/FireFighterStructure.java b/GuiApps/src/beam/example/firefighter/cost/FireFighterStructure.java
index 4a45262..a67d40b 100644
--- a/GuiApps/src/beam/example/firefighter/cost/FireFighterStructure.java
+++ b/GuiApps/src/beam/example/firefighter/cost/FireFighterStructure.java
@@ -1,93 +1,93 @@
-package beam.example.firefighter.cost;
-
-/**
- * FireFighterStructure.java
- * Structure Fire Fighter Class, extends FirstResponder
- * Repository git@github.com:KI7MT/java-app-examples.git
- *
- * @author Greg Beam
- * @version 1.2
- * @since 30-DEC-2017
- *
- */
-
-public class FireFighterStructure extends FirstResponder
-{
- private double toolKitCost;
-
- /**
- * Constructor for Structure Fire Fighter
- *
- * @param firstName first name of fire fighter
- * @param lastName last name of fire fighter
- * @param ppeCost personal protect cost
- * @param radioCost cost of radio
- * @param pagerCost cost of pager
- * @param toolKitCost cost of tool kit
- */
- public FireFighterStructure(
- String firstName,
- String lastName,
- double ppeCost,
- double radioCost,
- double pagerCost,
- double toolKitCost
- )
- {
- super(
- firstName,
- lastName,
- ppeCost,
- radioCost,
- pagerCost
- );
- this.toolKitCost = toolKitCost;
- }
-
- /**
- * Method: implements Interface Expense calculateExpense()
- */
- @Override
- public double calculateExpense()
- {
- double total = 0;
-
- total += getPpeCost();
- total += getRadioCost();
- total += getPagerCost();
- total += toolKitCost;
-
- return total;
- }
-
- /**
- *
- * @return Tool Kit Cost
- */
- public double getToolKitCost()
- {
- return toolKitCost;
- }
-
- /**
- *
- * @param toolKitCost tool kit cost
- */
- public void setToolKitCost(double toolKitCost)
- {
- this.toolKitCost = toolKitCost;
- }
-
- /**
- * ToString method to print class data
- */
- @Override
- public String toString()
- {
- String s = String.format("%-15s $%-20.2f", "Tools :", getToolKitCost());
- String e = String.format("%-12s $%-20.2f", "SubTotal :", calculateExpense());
- return (super.toString() + "\n" + s + "\n" + e);
-
- }
-
-} /* END - Fire Fighter EMT Class */
+package beam.example.firefighter.cost;
+
+/**
+ * FireFighterStructure.java
+ * Structure Fire Fighter Class, extends FirstResponder
+ * Repository git@github.com:KI7MT/java-app-examples.git
+ *
+ * @author Greg Beam
+ * @version 1.2
+ * @since 30-DEC-2017
+ *
+ */
+
+public class FireFighterStructure extends FirstResponder
+{
+ private double toolKitCost;
+
+ /**
+ * Constructor for Structure Fire Fighter
+ *
+ * @param firstName first name of fire fighter
+ * @param lastName last name of fire fighter
+ * @param ppeCost personal protect cost
+ * @param radioCost cost of radio
+ * @param pagerCost cost of pager
+ * @param toolKitCost cost of tool kit
+ */
+ public FireFighterStructure(
+ String firstName,
+ String lastName,
+ double ppeCost,
+ double radioCost,
+ double pagerCost,
+ double toolKitCost
+ )
+ {
+ super(
+ firstName,
+ lastName,
+ ppeCost,
+ radioCost,
+ pagerCost
+ );
+ this.toolKitCost = toolKitCost;
+ }
+
+ /**
+ * Method: implements Interface Expense calculateExpense()
+ */
+ @Override
+ public double calculateExpense()
+ {
+ double total = 0;
+
+ total += getPpeCost();
+ total += getRadioCost();
+ total += getPagerCost();
+ total += toolKitCost;
+
+ return total;
+ }
+
+ /**
+ *
+ * @return Tool Kit Cost
+ */
+ public double getToolKitCost()
+ {
+ return toolKitCost;
+ }
+
+ /**
+ *
+ * @param toolKitCost tool kit cost
+ */
+ public void setToolKitCost(double toolKitCost)
+ {
+ this.toolKitCost = toolKitCost;
+ }
+
+ /**
+ * ToString method to print class data
+ */
+ @Override
+ public String toString()
+ {
+ String s = String.format("%-15s $%-20.2f", "Tools :", getToolKitCost());
+ String e = String.format("%-12s $%-20.2f", "SubTotal :", calculateExpense());
+ return (super.toString() + "\n" + s + "\n" + e);
+
+ }
+
+} /* END - Fire Fighter EMT Class */
diff --git a/GuiApps/src/beam/example/firefighter/cost/FireFighterWildland.java b/GuiApps/src/beam/example/firefighter/cost/FireFighterWildland.java
index 885a633..98f7c36 100644
--- a/GuiApps/src/beam/example/firefighter/cost/FireFighterWildland.java
+++ b/GuiApps/src/beam/example/firefighter/cost/FireFighterWildland.java
@@ -1,91 +1,91 @@
-package beam.example.firefighter.cost;
-
-/**
- * FireFighterWildland.java
- * Wildland Fire Fighter Class, extends FirstResponder
- * Repository git@github.com:KI7MT/java-app-examples.git
- *
- * @author Greg Beam
- * @version 1.2
- * @since 30-DEC-2017
- *
- */
-public class FireFighterWildland extends FirstResponder
-{
- private double chainSawCost;
-
- /**
- * Constructor for FireFighterWildland
- *
- * @param firstName first name of fire fighter
- * @param lastName last name of fire fighter
- * @param ppeCost personal protect cost
- * @param radioCost cost of radio
- * @param pagerCost cost of pager
- * @param chainSawCost cost of chain saw
- */
- public FireFighterWildland(
- String firstName,
- String lastName,
- double ppeCost,
- double radioCost,
- double pagerCost,
- double chainSawCost
- )
- {
- super(
- firstName,
- lastName,
- ppeCost,
- radioCost,
- pagerCost
- );
- this.chainSawCost = chainSawCost;
- }
-
- /**
- * Method: implements Interface Expense calculateExpense()
- */
- @Override
- public double calculateExpense()
- {
- double total = 0;
-
- total += getPpeCost();
- total += getRadioCost();
- total += getPagerCost();
- total += chainSawCost;
-
- return total;
- }
-
- /**
- *
- * @return Chain Saw COst
- */
- public double getChainSawCost()
- {
- return chainSawCost;
- }
-
- /**
- *
- * @param chainSawCost cost of chain saw
- */
- public void setChainSawCost(double chainSawCost)
- {
- this.chainSawCost = chainSawCost;
- }
-
- /**
- * ToString method to print class data
- */
- @Override
- public String toString()
- {
- String s = String.format("%-15s $%-20.2f", "Saw :", getChainSawCost());
- String e = String.format("%-12s $%-20.2f", "SubTotal :", calculateExpense());
- return (super.toString() + "\n" + s + "\n" + e);
- }
-
-} /* END - Fire Fighter EMT Class */
+package beam.example.firefighter.cost;
+
+/**
+ * FireFighterWildland.java
+ * Wildland Fire Fighter Class, extends FirstResponder
+ * Repository git@github.com:KI7MT/java-app-examples.git
+ *
+ * @author Greg Beam
+ * @version 1.2
+ * @since 30-DEC-2017
+ *
+ */
+public class FireFighterWildland extends FirstResponder
+{
+ private double chainSawCost;
+
+ /**
+ * Constructor for FireFighterWildland
+ *
+ * @param firstName first name of fire fighter
+ * @param lastName last name of fire fighter
+ * @param ppeCost personal protect cost
+ * @param radioCost cost of radio
+ * @param pagerCost cost of pager
+ * @param chainSawCost cost of chain saw
+ */
+ public FireFighterWildland(
+ String firstName,
+ String lastName,
+ double ppeCost,
+ double radioCost,
+ double pagerCost,
+ double chainSawCost
+ )
+ {
+ super(
+ firstName,
+ lastName,
+ ppeCost,
+ radioCost,
+ pagerCost
+ );
+ this.chainSawCost = chainSawCost;
+ }
+
+ /**
+ * Method: implements Interface Expense calculateExpense()
+ */
+ @Override
+ public double calculateExpense()
+ {
+ double total = 0;
+
+ total += getPpeCost();
+ total += getRadioCost();
+ total += getPagerCost();
+ total += chainSawCost;
+
+ return total;
+ }
+
+ /**
+ *
+ * @return Chain Saw COst
+ */
+ public double getChainSawCost()
+ {
+ return chainSawCost;
+ }
+
+ /**
+ *
+ * @param chainSawCost cost of chain saw
+ */
+ public void setChainSawCost(double chainSawCost)
+ {
+ this.chainSawCost = chainSawCost;
+ }
+
+ /**
+ * ToString method to print class data
+ */
+ @Override
+ public String toString()
+ {
+ String s = String.format("%-15s $%-20.2f", "Saw :", getChainSawCost());
+ String e = String.format("%-12s $%-20.2f", "SubTotal :", calculateExpense());
+ return (super.toString() + "\n" + s + "\n" + e);
+ }
+
+} /* END - Fire Fighter EMT Class */
diff --git a/GuiApps/src/beam/example/firefighter/cost/FirstResponder.java b/GuiApps/src/beam/example/firefighter/cost/FirstResponder.java
index 276de07..f5bb66c 100644
--- a/GuiApps/src/beam/example/firefighter/cost/FirstResponder.java
+++ b/GuiApps/src/beam/example/firefighter/cost/FirstResponder.java
@@ -1,153 +1,153 @@
-package beam.example.firefighter.cost;
-
-/**
- * FirstResponderse.java
- * Abstract class for First Responders, implements Expense Interface
- * Repository git@github.com:KI7MT/java-app-examples.git
- *
- * @author Greg Beam
- * @version 1.2
- * @since 30-DEC-2017
- *
- */
-
-public abstract class FirstResponder implements Expense
-{
- private String firstName;
- private String lastName;
- private double ppeCost;
- private double radioCost;
- private double pagerCost;
-
- /**
- * Constructor for First Responder
- *
- * @param firstName first name of responder
- * @param lastName last name of responder
- * @param ppeCost personal protect cost
- * @param radioCost cost of radio
- * @param pagerCost cost of pager
- */
- public FirstResponder(
- String firstName,
- String lastName,
- double ppeCost,
- double radioCost,
- double pagerCost
- )
- {
- super();
- this.firstName = firstName;
- this.lastName = lastName;
- this.ppeCost = ppeCost;
- this.radioCost = radioCost;
- this.pagerCost = pagerCost;
- }
-
- /**
- *
- * @return first name
- */
- String getFirstName()
- {
- return firstName;
- }
-
- /**
- *
- * @param firstName first name of responder
- */
- public void setFirstName(String firstName)
- {
- this.firstName = firstName;
- }
-
- /**
- *
- * @return last name last name of responder
- */
- String getLastName()
- {
- return lastName;
- }
-
- /**
- *
- * @param lastName last name of responder
- */
- public void setLastName(String lastName)
- {
- this.lastName = lastName;
- }
-
- /**
- *
- * @return PPE cost
- */
- double getPpeCost()
- {
- return ppeCost;
- }
-
- /**
- *
- * @param ppeCost personal protection gear costs
- */
- public void setPpeCost(double ppeCost)
- {
- this.ppeCost = ppeCost;
- }
-
- /**
- *
- * @return Radio cost
- */
- double getRadioCost()
- {
- return radioCost;
- }
-
- /**
- *
- * @param radioCost cost of radio
- */
- public void setRadioCost(double radioCost)
- {
- this.radioCost = radioCost;
- }
-
- /**
- *
- * @return Pager Cost
- */
- double getPagerCost()
- {
- return pagerCost;
- }
-
- /**
- *
- * @param pagerCost cost of pager
- */
- public void setPagerCost(double pagerCost)
- {
- this.pagerCost = pagerCost;
- }
-
- /**
- * ToString override, format output
- *
- */
- @Override
- public String toString()
- {
- String t = String.format("%-15s %-20s", "Type :", getClass().getSimpleName());
- String n = String.format("%-12s %-20s", "Name :", getFirstName() + " " + getLastName());
- String p = String.format("%-15s $%-20.2f", "PPE :", getPpeCost());
- String r = String.format("%-14s $%-20.2f", "Radio :", getPpeCost());
- String g = String.format("%-14s $%-20.2f", "Pager :", getPagerCost());
-
- return String.format(t + "\n" + n + "\n" + p + "\n" + r + "\n" + g);
- }
-
+package beam.example.firefighter.cost;
+
+/**
+ * FirstResponderse.java
+ * Abstract class for First Responders, implements Expense Interface
+ * Repository git@github.com:KI7MT/java-app-examples.git
+ *
+ * @author Greg Beam
+ * @version 1.2
+ * @since 30-DEC-2017
+ *
+ */
+
+public abstract class FirstResponder implements Expense
+{
+ private String firstName;
+ private String lastName;
+ private double ppeCost;
+ private double radioCost;
+ private double pagerCost;
+
+ /**
+ * Constructor for First Responder
+ *
+ * @param firstName first name of responder
+ * @param lastName last name of responder
+ * @param ppeCost personal protect cost
+ * @param radioCost cost of radio
+ * @param pagerCost cost of pager
+ */
+ public FirstResponder(
+ String firstName,
+ String lastName,
+ double ppeCost,
+ double radioCost,
+ double pagerCost
+ )
+ {
+ super();
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.ppeCost = ppeCost;
+ this.radioCost = radioCost;
+ this.pagerCost = pagerCost;
+ }
+
+ /**
+ *
+ * @return first name
+ */
+ String getFirstName()
+ {
+ return firstName;
+ }
+
+ /**
+ *
+ * @param firstName first name of responder
+ */
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+
+ /**
+ *
+ * @return last name last name of responder
+ */
+ String getLastName()
+ {
+ return lastName;
+ }
+
+ /**
+ *
+ * @param lastName last name of responder
+ */
+ public void setLastName(String lastName)
+ {
+ this.lastName = lastName;
+ }
+
+ /**
+ *
+ * @return PPE cost
+ */
+ double getPpeCost()
+ {
+ return ppeCost;
+ }
+
+ /**
+ *
+ * @param ppeCost personal protection gear costs
+ */
+ public void setPpeCost(double ppeCost)
+ {
+ this.ppeCost = ppeCost;
+ }
+
+ /**
+ *
+ * @return Radio cost
+ */
+ double getRadioCost()
+ {
+ return radioCost;
+ }
+
+ /**
+ *
+ * @param radioCost cost of radio
+ */
+ public void setRadioCost(double radioCost)
+ {
+ this.radioCost = radioCost;
+ }
+
+ /**
+ *
+ * @return Pager Cost
+ */
+ double getPagerCost()
+ {
+ return pagerCost;
+ }
+
+ /**
+ *
+ * @param pagerCost cost of pager
+ */
+ public void setPagerCost(double pagerCost)
+ {
+ this.pagerCost = pagerCost;
+ }
+
+ /**
+ * ToString override, format output
+ *
+ */
+ @Override
+ public String toString()
+ {
+ String t = String.format("%-15s %-20s", "Type :", getClass().getSimpleName());
+ String n = String.format("%-12s %-20s", "Name :", getFirstName() + " " + getLastName());
+ String p = String.format("%-15s $%-20.2f", "PPE :", getPpeCost());
+ String r = String.format("%-14s $%-20.2f", "Radio :", getPpeCost());
+ String g = String.format("%-14s $%-20.2f", "Pager :", getPagerCost());
+
+ return String.format(t + "\n" + n + "\n" + p + "\n" + r + "\n" + g);
+ }
+
} /* END - First Responder Class */
\ No newline at end of file
diff --git a/GuiApps/src/beam/example/firefighter/cost/Station.java b/GuiApps/src/beam/example/firefighter/cost/Station.java
index 5b01351..7c2a6b4 100644
--- a/GuiApps/src/beam/example/firefighter/cost/Station.java
+++ b/GuiApps/src/beam/example/firefighter/cost/Station.java
@@ -1,88 +1,88 @@
-/**
- * Station.jaca
- * Class provides for a Station name, ArrayList, add and loop methods for responders
- * Repository git@github.com:KI7MT/java-app-examples.git
- *
- * @author Greg Beam
- * @version 1.2
- * @since 30-DEC-2017
- *
- */
-package beam.example.firefighter.cost;
-
-import java.util.ArrayList;
-
-public class Station
-{
- // class variables, responders is the array name, stationName is for the station
- private String stationName;
- private ArrayList responders = new ArrayList<>();
-
- /**
- * Constructor: sets the station name
- *
- * @param stationName name of the fire station
- */
- Station(String stationName)
- {
- this.stationName = stationName;
- }
-
- /**
- * Method: Add a FirstResponder to the responders array list
- *
- * @param responder name of the array list
- */
- void addResponder(FirstResponder responder)
- {
- responders.add(responder);
- }
-
- /**
- *
- * @return the responders ArrayList
- */
- ArrayList getResponders()
- {
- return responders;
- }
-
- /**
- *
- * @return Station Name
- */
- String getStationName()
- {
- return stationName;
- }
-
- /**
- * Method: Loop through the responders array list and print Objects ToStrings
- * for each FirstResponder
- */
- void loopResponder()
- {
- double grandTotal = 0;
-
- // loop through array list of responders
- for (FirstResponder responder : responders)
- {
- System.out.println("Station Name..: " + stationName);
- System.out.println(responder.toString());
- grandTotal += responder.calculateExpense();
- System.out.println();
- }
-
- // print the summary for all added Fire Fighters
- System.out.printf("Grand Total....: %.2f", grandTotal);
-
- } /* END - Loop for Responders Array */
-
- @Override
- public String toString()
- {
- String s = String.format("%-14s %-20s", "Station :", stationName);
- return (s);
- }
-
-} /* END - Station Class */
+/**
+ * Station.jaca
+ * Class provides for a Station name, ArrayList, add and loop methods for responders
+ * Repository git@github.com:KI7MT/java-app-examples.git
+ *
+ * @author Greg Beam
+ * @version 1.2
+ * @since 30-DEC-2017
+ *
+ */
+package beam.example.firefighter.cost;
+
+import java.util.ArrayList;
+
+public class Station
+{
+ // class variables, responders is the array name, stationName is for the station
+ private String stationName;
+ private ArrayList responders = new ArrayList<>();
+
+ /**
+ * Constructor: sets the station name
+ *
+ * @param stationName name of the fire station
+ */
+ Station(String stationName)
+ {
+ this.stationName = stationName;
+ }
+
+ /**
+ * Method: Add a FirstResponder to the responders array list
+ *
+ * @param responder name of the array list
+ */
+ void addResponder(FirstResponder responder)
+ {
+ responders.add(responder);
+ }
+
+ /**
+ *
+ * @return the responders ArrayList
+ */
+ ArrayList getResponders()
+ {
+ return responders;
+ }
+
+ /**
+ *
+ * @return Station Name
+ */
+ String getStationName()
+ {
+ return stationName;
+ }
+
+ /**
+ * Method: Loop through the responders array list and print Objects ToStrings
+ * for each FirstResponder
+ */
+ void loopResponder()
+ {
+ double grandTotal = 0;
+
+ // loop through array list of responders
+ for (FirstResponder responder : responders)
+ {
+ System.out.println("Station Name..: " + stationName);
+ System.out.println(responder.toString());
+ grandTotal += responder.calculateExpense();
+ System.out.println();
+ }
+
+ // print the summary for all added Fire Fighters
+ System.out.printf("Grand Total....: %.2f", grandTotal);
+
+ } /* END - Loop for Responders Array */
+
+ @Override
+ public String toString()
+ {
+ String s = String.format("%-14s %-20s", "Station :", stationName);
+ return (s);
+ }
+
+} /* END - Station Class */
diff --git a/GuiApps/src/beam/example/redux/game/ApplicationGUI.java b/GuiApps/src/beam/example/redux/game/ApplicationGUI.java
index 1593986..0b4766d 100644
--- a/GuiApps/src/beam/example/redux/game/ApplicationGUI.java
+++ b/GuiApps/src/beam/example/redux/game/ApplicationGUI.java
@@ -1,25 +1,25 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java GUI Application
- * Description..: JFrame for Hi-Low Redux Game GUI
- *
- */
-package beam.example.redux.game;
-
-import javax.swing.JFrame;
-
-public class ApplicationGUI
-{
- // Method: Main
- public static void main(String[] args)
- {
- // call the button frame class
- ButtonFrame buttonFrame = new ButtonFrame();
- buttonFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- buttonFrame.setSize(375, 80);
- buttonFrame.setVisible(true);
- }
-
-} /* END Application GUI Class */
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java GUI Application
+ * Description..: JFrame for Hi-Low Redux Game GUI
+ *
+ */
+package beam.example.redux.game;
+
+import javax.swing.JFrame;
+
+public class ApplicationGUI
+{
+ // Method: Main
+ public static void main(String[] args)
+ {
+ // call the button frame class
+ ButtonFrame buttonFrame = new ButtonFrame();
+ buttonFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ buttonFrame.setSize(375, 80);
+ buttonFrame.setVisible(true);
+ }
+
+} /* END Application GUI Class */
diff --git a/GuiApps/src/beam/example/redux/game/ButtonFrame.java b/GuiApps/src/beam/example/redux/game/ButtonFrame.java
index 9db408e..a603223 100644
--- a/GuiApps/src/beam/example/redux/game/ButtonFrame.java
+++ b/GuiApps/src/beam/example/redux/game/ButtonFrame.java
@@ -1,60 +1,60 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java GUI Application
- * Description..: JFrame for Hi-Low Redux Game GUI
- *
- */
-package beam.example.redux.game;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JButton;
-import javax.swing.JTextField;
-
-public class ButtonFrame extends JFrame
-{
- private static final long serialVersionUID = 1L;
- private final JButton plainJButton;
- private final JTextField textBox;
- HighLowGame game = new HighLowGame(10);
-
- // button frame adds JButtons to JFrame
- public ButtonFrame()
- {
- // set the layout
- super("High Low Game ( 0 to 10 )");
- setLayout(new FlowLayout());
-
- // text box entry field
- textBox = new JTextField("", 4);
- textBox.setHorizontalAlignment(JTextField.CENTER);
- add(textBox);
-
- // just plain old button
- plainJButton = new JButton("Enter");
- add(plainJButton);
-
- // create new button handler for button events
- ButtonHandler handler = new ButtonHandler();
- plainJButton.addActionListener(handler);
- }
-
- // inner class for button event handling
- private class ButtonHandler implements ActionListener
- {
- // handle button event
- @Override
- public void actionPerformed(ActionEvent event)
- {
- // send dialog message
- String message = String.format("%s", game.guess(Integer.parseInt(textBox.getText())));
- JOptionPane.showMessageDialog (null, message, "Guess Status", JOptionPane.INFORMATION_MESSAGE);
- }
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java GUI Application
+ * Description..: JFrame for Hi-Low Redux Game GUI
+ *
+ */
+package beam.example.redux.game;
+
+import java.awt.FlowLayout;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JButton;
+import javax.swing.JTextField;
+
+public final class ButtonFrame extends JFrame
+{
+ private static final long serialVersionUID = 1L;
+ private final JButton plainJButton;
+ private final JTextField textBox;
+ transient HighLowGame game = new HighLowGame(10);
+
+ // button frame adds JButtons to JFrame
+ public ButtonFrame()
+ {
+ // set the layout
+ super("High Low Game ( 0 to 10 )");
+ setLayout(new FlowLayout());
+
+ // text box entry field
+ textBox = new JTextField("", 4);
+ textBox.setHorizontalAlignment(JTextField.CENTER);
+ add(textBox);
+
+ // just plain old button
+ plainJButton = new JButton("Enter");
+ add(plainJButton);
+
+ // create new button handler for button events
+ ButtonHandler handler = new ButtonHandler();
+ plainJButton.addActionListener(handler);
+ }
+
+ // inner class for button event handling
+ private class ButtonHandler implements ActionListener
+ {
+ // handle button event
+ @Override
+ public void actionPerformed(ActionEvent event)
+ {
+ // send dialog message
+ String message = String.format("%s", game.guess(Integer.parseInt(textBox.getText())));
+ JOptionPane.showMessageDialog (null, message, "Guess Status", JOptionPane.INFORMATION_MESSAGE);
+ }
+ }
+
} /* END - Button Frame Class */
\ No newline at end of file
diff --git a/GuiApps/src/beam/example/redux/game/HighLowGame.java b/GuiApps/src/beam/example/redux/game/HighLowGame.java
index 1fb52b2..b13f40a 100644
--- a/GuiApps/src/beam/example/redux/game/HighLowGame.java
+++ b/GuiApps/src/beam/example/redux/game/HighLowGame.java
@@ -1,85 +1,85 @@
-/*
- * Author ......: Greg, Beam, KI7MT,
- * Copyright ...: Copyright (C) 2017 GPLv3
- * Level .......: Intermediate
- * Target ......: Java GUI Application
- * Description..: JFrame for Hi-Low Redux Game GUI
- *
- *
- */
-package beam.example.redux.game;
-
-import java.util.Random;
-
-public class HighLowGame
-{
- // class variables
- private int secretNumber;
- private int counter;
-
- // Constructor
- public HighLowGame(int numberOfNumbers)
- {
- super();
- this.secretNumber = ranInt(0, numberOfNumbers);
- }
-
- // return results based on GUI Guess
- public String guess(int numberGuess)
-
- {
- counter++;
- String message = "";
-
- if (numberGuess < getSecretNumber())
- {
-
- message = " Wrong, Guess Higher";
-
- }
-
- if (numberGuess > getSecretNumber())
- {
-
- message = " Wrong, Guess Lower";
- }
-
- if (numberGuess == getSecretNumber())
- {
-
- message = String.format("Correct after ( %s ) guesses", getCounter());
- }
-
- return message;
-
- }
-
- // generate a secret number ( integer )
- private static int ranInt(int min, int max)
- {
- Random rand = new Random();
-
- int number = rand.nextInt((max - min) +1);
-
- return number;
- }
-
- // get counter value
- private int getCounter()
- {
- return counter;
- }
-
- // get secret number
- private int getSecretNumber()
- {
- return secretNumber;
- }
-
- // set secret number
- public void setSecretNumber(int secretNumber)
- {
- this.secretNumber = secretNumber;
- }
-
+/*
+ * Author ......: Greg, Beam, KI7MT,
+ * Copyright ...: Copyright (C) 2017 GPLv3
+ * Level .......: Intermediate
+ * Target ......: Java GUI Application
+ * Description..: JFrame for Hi-Low Redux Game GUI
+ *
+ *
+ */
+package beam.example.redux.game;
+
+import java.util.Random;
+
+public class HighLowGame
+{
+ // class variables
+ private int secretNumber;
+ private int counter;
+
+ // Constructor
+ public HighLowGame(int numberOfNumbers)
+ {
+ super();
+ this.secretNumber = ranInt(0, numberOfNumbers);
+ }
+
+ // return results based on GUI Guess
+ public String guess(int numberGuess)
+
+ {
+ counter++;
+ String message = "";
+
+ if (numberGuess < getSecretNumber())
+ {
+
+ message = " Wrong, Guess Higher";
+
+ }
+
+ if (numberGuess > getSecretNumber())
+ {
+
+ message = " Wrong, Guess Lower";
+ }
+
+ if (numberGuess == getSecretNumber())
+ {
+
+ message = String.format("Correct after ( %s ) guesses", getCounter());
+ }
+
+ return message;
+
+ }
+
+ // generate a secret number ( integer )
+ private static int ranInt(int min, int max)
+ {
+ Random rand = new Random();
+
+ int number = rand.nextInt((max - min) +1);
+
+ return number;
+ }
+
+ // get counter value
+ private int getCounter()
+ {
+ return counter;
+ }
+
+ // get secret number
+ private int getSecretNumber()
+ {
+ return secretNumber;
+ }
+
+ // set secret number
+ public void setSecretNumber(int secretNumber)
+ {
+ this.secretNumber = secretNumber;
+ }
+
} /* END High Low Game Class */
\ No newline at end of file
diff --git a/README.md b/README.md
index 1673e10..b061241 100644
--- a/README.md
+++ b/README.md
@@ -12,9 +12,11 @@ All of the examples are either labs, dev-book problems, or common application
needs I've run across. While the problem source may differ, I wrote all of the solutions as presented in the repository. As time allows, more advanced topics will be added.
## Required Tools
-All of the applications were written using [Eclipse Oxygen](https://www.eclipse.org/), [IntelliJ IDEA](https://www.jetbrains.com/idea/) or [NetBeans](https://netbeans.org/).
+Any IDE will open these: [IntelliJ IDEA](https://www.jetbrains.com/idea/), [Eclipse](https://www.eclipse.org/), [NetBeans](https://netbeans.org/) or [VS Code](https://code.visualstudio.com/). They were originally written in Eclipse Oxygen.
-The [Java](https://java.com/en/) version used for both Windows and Linux (at the time of testing) was Version 8 Update 151. No external libraries are needed nor used unless otherwise noted.
+**[JDK 25](https://adoptium.net/) (LTS)** or newer. The examples were written against Java 8 in 2017 and
+still compile unchanged — the Java version is declared once, in the root `pom.xml`.
+No external libraries are needed nor used unless otherwise noted.
## Classification
Unlike my [dotnet-core-example](https://github.com/KI7MT/dotnet-core-examples) respository, the [Java](https://java.com/en/) examples provide both Console and Graphical examples.
@@ -37,6 +39,19 @@ For easy separation of classes, each application has its own package. Each progr
The easiest way to run the applications is from an IDE. Simply import
the projects (ConsoleApps and GuiApps) into your IDE, browse to the **src/** folder, then expand the package you want to test. This is true for both console and UI packages.
+To build everything from the command line instead:
+
+```bash
+mvn clean compile
+```
+
+Then run any example by its package and driver class:
+
+```bash
+java -cp ConsoleApps/target/classes beam.example.radio.station.RadioStationDriver
+java -cp GuiApps/target/classes beam.example.redux.game.ApplicationGUI
+```
+
## Example List
**Graphical Interface Examples**
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..850946b
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,45 @@
+
+
+
+ 4.0.0
+
+ beam.example
+ java-app-examples
+ 1.2.0
+ pom
+
+ Java Application Examples
+ Intermediate and Advanced Java Console and UI application examples
+ https://github.com/KI7MT/java-app-examples
+
+
+
+ MIT License
+ https://github.com/KI7MT/java-app-examples/blob/master/LICENSE
+
+
+
+
+
+ KI7MT
+ Greg Beam
+
+
+
+
+
+ 25
+ UTF-8
+
+
+
+ ConsoleApps
+ GuiApps
+
+
+