diff --git a/files/IAthlete.java b/files/IAthlete.java new file mode 100644 index 0000000..b936a3b --- /dev/null +++ b/files/IAthlete.java @@ -0,0 +1,9 @@ +/* Interface IAthlete.java + * CS207-2 Homework 7 Fall 2018 + * An interface is a behavior that implementing classes are required to conform to. + * Do not make changes to this class. + */ +public interface IAthlete +{ + public abstract void data(); +} diff --git a/files/ITrainer.java b/files/ITrainer.java new file mode 100644 index 0000000..df44af5 --- /dev/null +++ b/files/ITrainer.java @@ -0,0 +1,9 @@ +/* Interface ITrainer.java + * CS207-2 Homework 7 Fall 2018 + * An interface is a behavior that implementing classes are required to conform to. + * Do not make changes to this class. + */ +public interface ITrainer +{ + public abstract void train( double h ); +} diff --git a/files/MathProblems.java b/files/MathProblems.java new file mode 100644 index 0000000..6972d4c --- /dev/null +++ b/files/MathProblems.java @@ -0,0 +1,38 @@ +import java.util.*; +public class MathProblems +{ + + // Implement this method, which prompts the user for a and b, then divides a by b + // and then calculates a % b. If the user enters an invalid type of input, or a + // zero for the divisor, an Exception will be thrown, both of which need to be caught + public void divide() + { + + try + { + + } + catch( ) + { + + } + catch( ) + { + + } + + } + + public static void main( String[] args ) + { + // Test it here in main, when ready + MathFunctions functions = new MathFunctions(); + + functions.divide(); + + } + + + + +} diff --git a/files/SkiJumper.java b/files/SkiJumper.java new file mode 100644 index 0000000..a523c04 --- /dev/null +++ b/files/SkiJumper.java @@ -0,0 +1,14 @@ +/* SkiJumper.java + * CS207-2 Homework 7 Fall 2018 + * This class represents a Ski Jumper in code. + * + * Add code to this class by implementing the interfaces + * ITrainer and IAthlete such that the code in main() + * executes providing the output shown in Problem 3. + */ +public class SkiJumper implements IAthlete, ITrainer +{ + + + +} // End class SkiJumper diff --git a/files/StockPrices.java b/files/StockPrices.java new file mode 100644 index 0000000..11a0922 --- /dev/null +++ b/files/StockPrices.java @@ -0,0 +1,30 @@ +import java.util.*; +import java.io.*; +public class StockPrices +{ + public static void main( String[] args ) + { + double total = 0.0; + Scanner inputFile = null; + + // Use a loop in the try block to read each line of the file. + // Lecture Slides 13 (posted on D2L) provide a good example + try + { + + + + } + catch( ) + { + // A FileNotFoundException needs to be handled here + } + finally + { + + } + System.out.println( "The total value is: $" + total ); + + } + +} diff --git a/files/TestSkiJumper.java b/files/TestSkiJumper.java new file mode 100644 index 0000000..c4f8da4 --- /dev/null +++ b/files/TestSkiJumper.java @@ -0,0 +1,28 @@ +/* TestSkiJumper.java + * CS207-2 Homework 7 Fall 2018 + * This class has main() and tests the implementation of SkiJumper.java. + * Do not make changes to this class. + */ +public class TestSkiJumper +{ + public static void main( String[] args ) + { + // Create a new Ski Jumper + SkiJumper sk1 = new SkiJumper( "John Smith" ); + sk1.train(5.2); + sk1.jump(); + sk1.train(3.2); + sk1.jump(); + sk1.data(); + + // Create another new Ski Jumper + SkiJumper sk2 = new SkiJumper( "Jenny Adam" ); + sk2.train(7.3); + sk2.jump(); + sk2.data(); + + System.out.println(sk2.equals(sk1)); + sk2.jump(); + System.out.println(sk2.equals(sk1)); + } +} diff --git a/files/portfolio.txt b/files/portfolio.txt new file mode 100644 index 0000000..a29058c --- /dev/null +++ b/files/portfolio.txt @@ -0,0 +1,6 @@ +Microsoft 31.63 +Intel 88.54 +Facebook 0.13 +Twitter 56.23 +Oracle 77.01 +Canonical 45.97