| @ -1 +1,259 @@ | |||||
| /.metadata/ | |||||
| # Created by https://www.toptal.com/developers/gitignore/api/eclipse,java,intellij+all,macos,windows,linux | |||||
| # Edit at https://www.toptal.com/developers/gitignore?templates=eclipse,java,intellij+all,macos,windows,linux | |||||
| ### Eclipse ### | |||||
| .metadata | |||||
| bin/ | |||||
| tmp/ | |||||
| *.tmp | |||||
| *.bak | |||||
| *.swp | |||||
| *~.nib | |||||
| local.properties | |||||
| .settings/ | |||||
| .loadpath | |||||
| .recommenders | |||||
| # External tool builders | |||||
| .externalToolBuilders/ | |||||
| # Locally stored "Eclipse launch configurations" | |||||
| *.launch | |||||
| # PyDev specific (Python IDE for Eclipse) | |||||
| *.pydevproject | |||||
| # CDT-specific (C/C++ Development Tooling) | |||||
| .cproject | |||||
| # CDT- autotools | |||||
| .autotools | |||||
| # Java annotation processor (APT) | |||||
| .factorypath | |||||
| # PDT-specific (PHP Development Tools) | |||||
| .buildpath | |||||
| # sbteclipse plugin | |||||
| .target | |||||
| # Tern plugin | |||||
| .tern-project | |||||
| # TeXlipse plugin | |||||
| .texlipse | |||||
| # STS (Spring Tool Suite) | |||||
| .springBeans | |||||
| # Code Recommenders | |||||
| .recommenders/ | |||||
| # Annotation Processing | |||||
| .apt_generated/ | |||||
| .apt_generated_test/ | |||||
| # Scala IDE specific (Scala & Java development for Eclipse) | |||||
| .cache-main | |||||
| .scala_dependencies | |||||
| .worksheet | |||||
| # Uncomment this line if you wish to ignore the project description file. | |||||
| # Typically, this file would be tracked if it contains build/dependency configurations: | |||||
| #.project | |||||
| ### Eclipse Patch ### | |||||
| # Spring Boot Tooling | |||||
| .sts4-cache/ | |||||
| ### Intellij+all ### | |||||
| # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | |||||
| # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | |||||
| # User-specific stuff | |||||
| .idea/**/workspace.xml | |||||
| .idea/**/tasks.xml | |||||
| .idea/**/usage.statistics.xml | |||||
| .idea/**/dictionaries | |||||
| .idea/**/shelf | |||||
| # AWS User-specific | |||||
| .idea/**/aws.xml | |||||
| # Generated files | |||||
| .idea/**/contentModel.xml | |||||
| # Sensitive or high-churn files | |||||
| .idea/**/dataSources/ | |||||
| .idea/**/dataSources.ids | |||||
| .idea/**/dataSources.local.xml | |||||
| .idea/**/sqlDataSources.xml | |||||
| .idea/**/dynamic.xml | |||||
| .idea/**/uiDesigner.xml | |||||
| .idea/**/dbnavigator.xml | |||||
| # Gradle | |||||
| .idea/**/gradle.xml | |||||
| .idea/**/libraries | |||||
| # Gradle and Maven with auto-import | |||||
| # When using Gradle or Maven with auto-import, you should exclude module files, | |||||
| # since they will be recreated, and may cause churn. Uncomment if using | |||||
| # auto-import. | |||||
| # .idea/artifacts | |||||
| # .idea/compiler.xml | |||||
| # .idea/jarRepositories.xml | |||||
| # .idea/modules.xml | |||||
| # .idea/*.iml | |||||
| # .idea/modules | |||||
| # *.iml | |||||
| # *.ipr | |||||
| # CMake | |||||
| cmake-build-*/ | |||||
| # Mongo Explorer plugin | |||||
| .idea/**/mongoSettings.xml | |||||
| # File-based project format | |||||
| *.iws | |||||
| # IntelliJ | |||||
| out/ | |||||
| # mpeltonen/sbt-idea plugin | |||||
| .idea_modules/ | |||||
| # JIRA plugin | |||||
| atlassian-ide-plugin.xml | |||||
| # Cursive Clojure plugin | |||||
| .idea/replstate.xml | |||||
| # SonarLint plugin | |||||
| .idea/sonarlint/ | |||||
| # Crashlytics plugin (for Android Studio and IntelliJ) | |||||
| com_crashlytics_export_strings.xml | |||||
| crashlytics.properties | |||||
| crashlytics-build.properties | |||||
| fabric.properties | |||||
| # Editor-based Rest Client | |||||
| .idea/httpRequests | |||||
| # Android studio 3.1+ serialized cache file | |||||
| .idea/caches/build_file_checksums.ser | |||||
| ### Intellij+all Patch ### | |||||
| # Ignore everything but code style settings and run configurations | |||||
| # that are supposed to be shared within teams. | |||||
| .idea/* | |||||
| !.idea/codeStyles | |||||
| !.idea/runConfigurations | |||||
| ### Java ### | |||||
| # Compiled class file | |||||
| *.class | |||||
| # Log file | |||||
| *.log | |||||
| # BlueJ files | |||||
| *.ctxt | |||||
| # Mobile Tools for Java (J2ME) | |||||
| .mtj.tmp/ | |||||
| # Package Files # | |||||
| *.jar | |||||
| *.war | |||||
| *.nar | |||||
| *.ear | |||||
| *.zip | |||||
| *.tar.gz | |||||
| *.rar | |||||
| # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | |||||
| hs_err_pid* | |||||
| replay_pid* | |||||
| ### Linux ### | |||||
| *~ | |||||
| # temporary files which can be created if a process still has a handle open of a deleted file | |||||
| .fuse_hidden* | |||||
| # KDE directory preferences | |||||
| .directory | |||||
| # Linux trash folder which might appear on any partition or disk | |||||
| .Trash-* | |||||
| # .nfs files are created when an open file is removed but is still being accessed | |||||
| .nfs* | |||||
| ### macOS ### | |||||
| # General | |||||
| .DS_Store | |||||
| .AppleDouble | |||||
| .LSOverride | |||||
| # Icon must end with two \r | |||||
| Icon | |||||
| # Thumbnails | |||||
| ._* | |||||
| # Files that might appear in the root of a volume | |||||
| .DocumentRevisions-V100 | |||||
| .fseventsd | |||||
| .Spotlight-V100 | |||||
| .TemporaryItems | |||||
| .Trashes | |||||
| .VolumeIcon.icns | |||||
| .com.apple.timemachine.donotpresent | |||||
| # Directories potentially created on remote AFP share | |||||
| .AppleDB | |||||
| .AppleDesktop | |||||
| Network Trash Folder | |||||
| Temporary Items | |||||
| .apdisk | |||||
| ### macOS Patch ### | |||||
| # iCloud generated files | |||||
| *.icloud | |||||
| ### Windows ### | |||||
| # Windows thumbnail cache files | |||||
| Thumbs.db | |||||
| Thumbs.db:encryptable | |||||
| ehthumbs.db | |||||
| ehthumbs_vista.db | |||||
| # Dump file | |||||
| *.stackdump | |||||
| # Folder config file | |||||
| [Dd]esktop.ini | |||||
| # Recycle Bin used on file shares | |||||
| $RECYCLE.BIN/ | |||||
| # Windows Installer files | |||||
| *.cab | |||||
| *.msi | |||||
| *.msix | |||||
| *.msm | |||||
| *.msp | |||||
| # Windows shortcuts | |||||
| *.lnk | |||||
| # End of https://www.toptal.com/developers/gitignore/api/eclipse,java,intellij+all,macos,windows,linux | |||||
| @ -1,8 +0,0 @@ | |||||
| # Default ignored files | |||||
| /shelf/ | |||||
| /workspace.xml | |||||
| # Editor-based HTTP Client requests | |||||
| /httpRequests/ | |||||
| # Datasource local storage ignored files | |||||
| /dataSources/ | |||||
| /dataSources.local.xml | |||||
| @ -1,2 +0,0 @@ | |||||
| eclipse.preferences.version=1 | |||||
| encoding/<project>=UTF-8 | |||||
| @ -1,14 +0,0 @@ | |||||
| eclipse.preferences.version=1 | |||||
| org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | |||||
| org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 | |||||
| org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | |||||
| org.eclipse.jdt.core.compiler.compliance=17 | |||||
| org.eclipse.jdt.core.compiler.debug.lineNumber=generate | |||||
| org.eclipse.jdt.core.compiler.debug.localVariable=generate | |||||
| org.eclipse.jdt.core.compiler.debug.sourceFile=generate | |||||
| org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | |||||
| org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | |||||
| org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | |||||
| org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | |||||
| org.eclipse.jdt.core.compiler.release=enabled | |||||
| org.eclipse.jdt.core.compiler.source=17 | |||||
| @ -1,2 +0,0 @@ | |||||
| eclipse.preferences.version=1 | |||||
| encoding/<project>=UTF-8 | |||||
| @ -1,14 +0,0 @@ | |||||
| eclipse.preferences.version=1 | |||||
| org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | |||||
| org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 | |||||
| org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | |||||
| org.eclipse.jdt.core.compiler.compliance=17 | |||||
| org.eclipse.jdt.core.compiler.debug.lineNumber=generate | |||||
| org.eclipse.jdt.core.compiler.debug.localVariable=generate | |||||
| org.eclipse.jdt.core.compiler.debug.sourceFile=generate | |||||
| org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | |||||
| org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | |||||
| org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | |||||
| org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | |||||
| org.eclipse.jdt.core.compiler.release=enabled | |||||
| org.eclipse.jdt.core.compiler.source=17 | |||||
| @ -0,0 +1,27 @@ | |||||
| package uwstout.courses.cs144.labs.lab2; | |||||
| /** | |||||
| * This outputs a message that tests your ability to escape strings. | |||||
| * | |||||
| * @author Brett Bender | |||||
| * @version 2022.09.20 | |||||
| * | |||||
| */ | |||||
| public class MessageOutput { | |||||
| /** | |||||
| * This outputs a message that tests your ability to escape strings. | |||||
| * | |||||
| * @param args The command line arguments (not used) | |||||
| */ | |||||
| public static void main(String[] args) { | |||||
| System.out.println("\tIn Windows, putting the path to a file into the code is a little"); | |||||
| System.out.println("difficult as each \"\\\" in the path must be escaped. So, if your"); | |||||
| System.out.println("file is located at C:\\temp\\data.csv, then you would need to"); | |||||
| System.out.println("escape it so that it looks like C:\\\\temp\\\\data.csv. It is also"); | |||||
| System.out.println("good practice to put \"'s around the path. This avoids problems"); | |||||
| System.out.println("with spaces in the file name or the path. The \"'s would have"); | |||||
| System.out.println("to be escaped as well."); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,57 @@ | |||||
| package uwstout.courses.cs144.labs.lab2; | |||||
| import java.util.Scanner; | |||||
| /** | |||||
| * This computes the area and perimeter of a rectangle given the rectangle's | |||||
| * length and width. | |||||
| * | |||||
| * @author turners | |||||
| * @version 1.0 | |||||
| * | |||||
| */ | |||||
| public class RectangleValues { | |||||
| /** | |||||
| * This computes the area and perimeter of a rectangle given the rectangle's | |||||
| * length and width. | |||||
| * | |||||
| * | |||||
| * @param args Command line arguments (not used) | |||||
| * | |||||
| * | |||||
| * Input: (length: 10, width: 10) Expected: (perim: 40, area: 100) | |||||
| * | |||||
| * Input: (length: 0, width: 9) Expected: (perim: 18, area: 0) | |||||
| * | |||||
| * Input: (length: -2, width: 4) Expected: (perim: 4, area: -8) | |||||
| * | |||||
| * | |||||
| * | |||||
| */ | |||||
| public static void main(String[] args) { | |||||
| double length; | |||||
| double width; | |||||
| double perimeter; | |||||
| double area; | |||||
| // Create an object to read in data from the keyboard | |||||
| Scanner scan = new Scanner(System.in); | |||||
| // prompt for and read in length and width | |||||
| System.out.println("Enter the length of the rectangle: "); | |||||
| length = scan.nextDouble(); | |||||
| System.out.println("Enter the width of the rectangle: "); | |||||
| width = scan.nextDouble(); | |||||
| // compute perimeter and area | |||||
| perimeter = 2 * (length + width); | |||||
| area = length * width; | |||||
| // output results | |||||
| System.out.println("For a " + length + " x " + width + " rectangle, the perimeter is " + perimeter | |||||
| + " and the area is " + area + "."); | |||||
| scan.close(); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,46 @@ | |||||
| package uwstout.courses.cs144.labs.lab2; | |||||
| import java.util.Scanner; | |||||
| /** | |||||
| * Reads in a value (in stones) and converts it to ounces. | |||||
| * | |||||
| * @author Brett Bender | |||||
| * @version 2022.09.20 | |||||
| */ | |||||
| public class Stones { | |||||
| private static final int STONE_POUNDS_CF = 14; | |||||
| private static final int POUNDS_OUNCES_CF = 16; | |||||
| private static final int STONE_OUNCES_CF = STONE_POUNDS_CF * POUNDS_OUNCES_CF; | |||||
| /** | |||||
| * Reads in a value (in stones) and converts it to ounces. | |||||
| * | |||||
| * @param args Command line arguments (not used) | |||||
| * | |||||
| * | |||||
| * Input: 2 stones Expected: 448 ounces | |||||
| * | |||||
| * Input: -1 stones Expected: -224 ounces | |||||
| * | |||||
| * Input: 0 stones Expected: 0 ounces | |||||
| */ | |||||
| public static void main(String[] args) { | |||||
| Scanner scan = new Scanner(System.in); | |||||
| System.out.println("How heavy is the object in stones?"); | |||||
| // Read in the weight in stones | |||||
| int stonesIn = scan.nextInt(); | |||||
| // Calculate the weight in ounces | |||||
| int ouncesOut = stonesIn * STONE_OUNCES_CF; | |||||
| // Output it to the user | |||||
| System.out.printf("%d stones in ounces is %d ounces.\n", stonesIn, ouncesOut); | |||||
| scan.close(); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,10 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <classpath> | |||||
| <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"> | |||||
| <attributes> | |||||
| <attribute name="module" value="true"/> | |||||
| </attributes> | |||||
| </classpathentry> | |||||
| <classpathentry kind="src" path="src"/> | |||||
| <classpathentry kind="output" path="bin"/> | |||||
| </classpath> | |||||
| @ -0,0 +1,17 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>LAB-3</name> | |||||
| <comment></comment> | |||||
| <projects> | |||||
| </projects> | |||||
| <buildSpec> | |||||
| <buildCommand> | |||||
| <name>org.eclipse.jdt.core.javabuilder</name> | |||||
| <arguments> | |||||
| </arguments> | |||||
| </buildCommand> | |||||
| </buildSpec> | |||||
| <natures> | |||||
| <nature>org.eclipse.jdt.core.javanature</nature> | |||||
| </natures> | |||||
| </projectDescription> | |||||
| @ -0,0 +1,3 @@ | |||||
| module uwstout.courses.cs144 { | |||||
| } | |||||
| @ -0,0 +1,58 @@ | |||||
| package uwstout.courses.cs144.labs.lab3; | |||||
| import java.util.Scanner; | |||||
| /** | |||||
| * This program converts a rectangular coordinate to a polar coordinate | |||||
| * | |||||
| * @author Brett Bender | |||||
| * @version 2022.09.27 | |||||
| */ | |||||
| public class ConvertCoordinate { | |||||
| /** | |||||
| * This program converts a rectangular coordinate to a polar coordinate | |||||
| * | |||||
| * | |||||
| * TESTS | |||||
| * | |||||
| * INPUT1: x = 5, y = 5 | |||||
| * | |||||
| * OUTPUT1: r = 7.071, theta = 45 | |||||
| * | |||||
| * | |||||
| * INPUT2: x = -2, y = -5 | |||||
| * | |||||
| * OUTPUT2: r = 5.385, theta = 248.2 | |||||
| * | |||||
| * | |||||
| * INPUT3: x = 0, y = 0 | |||||
| * | |||||
| * OUTPUT3: r = 0, theta = 0 | |||||
| * | |||||
| * | |||||
| * @param args The command line arguments (not used) | |||||
| */ | |||||
| public static void main(String[] args) { | |||||
| Scanner scan = new Scanner(System.in); | |||||
| // Input | |||||
| /// X Value | |||||
| System.out.print("Enter the X coordinate: "); | |||||
| int x = scan.nextInt(); | |||||
| /// Y Value | |||||
| System.out.print("Enter the Y coordinate: "); | |||||
| int y = scan.nextInt(); | |||||
| // Create the coordinate object | |||||
| Coordinate coord = new Coordinate(x, y); | |||||
| // Output | |||||
| /// Print (x, y) -> (r, theta\u00B0) | |||||
| System.out.printf("(%d, %d) -> (%f, %f\u00B0)", coord.getX(), coord.getY(), coord.getR(), coord.getTheta()); | |||||
| scan.close(); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,72 @@ | |||||
| package uwstout.courses.cs144.labs.lab3; | |||||
| /** | |||||
| * Represents a coordinate in geometry. It can be accessed both as a rectangular | |||||
| * (x, y) coordinate and as a polar (r, theta) coordinate. | |||||
| * | |||||
| * @author turners | |||||
| * @version 2016-09-10 | |||||
| */ | |||||
| public class Coordinate { | |||||
| private int x; | |||||
| private int y; | |||||
| private static final int PI_DEGREES = 180; | |||||
| private static final int TWO_PI_DEGREES = 360; | |||||
| /** | |||||
| * Creates a Coordinate using a rectangular (x, y) location. | |||||
| * | |||||
| * @param nx x part of the coordinate | |||||
| * @param ny y part of the coordinate | |||||
| */ | |||||
| Coordinate(int nx, int ny) { | |||||
| x = nx; | |||||
| y = ny; | |||||
| } | |||||
| /** | |||||
| * Gets the x value of a rectangular (x, y) coordinate | |||||
| * | |||||
| * @return The x coordinate | |||||
| */ | |||||
| public int getX() { | |||||
| return x; | |||||
| } | |||||
| /** | |||||
| * Gets the y value of a rectangular (x, y) coordinate | |||||
| * | |||||
| * @return The y coordinate | |||||
| */ | |||||
| public int getY() { | |||||
| return y; | |||||
| } | |||||
| /** | |||||
| * Gets the r value of a polar (r, theta) coordinate. | |||||
| * | |||||
| * @return r value of the coordinate | |||||
| */ | |||||
| public double getR() { | |||||
| return Math.sqrt(x * x + y * y); | |||||
| } | |||||
| /** | |||||
| * Gets the theta value of a polar (r, theta) coordinate. | |||||
| * | |||||
| * Theta is returned in degrees and is between 0 and 360 degrees. | |||||
| * | |||||
| * @return theta value of the coordinate | |||||
| */ | |||||
| public double getTheta() { | |||||
| double radians = Math.atan2(y, x); | |||||
| double degrees = radians * PI_DEGREES / Math.PI; | |||||
| if (degrees < 0) { | |||||
| degrees += TWO_PI_DEGREES; | |||||
| } | |||||
| return degrees; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,76 @@ | |||||
| package uwstout.courses.cs144.labs.lab3; | |||||
| /** | |||||
| * | |||||
| * An ingredient in a recipe. | |||||
| * | |||||
| * @author Brett Bender | |||||
| * @version 2022.09.27 | |||||
| */ | |||||
| public class Ingredient { | |||||
| private String name; | |||||
| private String units; | |||||
| private int amount; | |||||
| /** | |||||
| * Creates an ingredient of the given name, unit, and amount | |||||
| * | |||||
| * @param iname The name of the ingredient | |||||
| * @param iunits The unit of measurement for the ingredient | |||||
| * @param iamount The amount of the ingredient (in given unit) | |||||
| */ | |||||
| public Ingredient(String iname, int iamount, String iunits) { | |||||
| name = iname; | |||||
| amount = iamount; | |||||
| units = iunits; | |||||
| } | |||||
| /** | |||||
| * Get the name of the ingredient | |||||
| * | |||||
| * @return The name of the ingredient | |||||
| */ | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| /** | |||||
| * Get the unit of measurement for the ingredient | |||||
| * | |||||
| * @return The unit of measurement for the ingredient | |||||
| */ | |||||
| public String getUnits() { | |||||
| return units; | |||||
| } | |||||
| /** | |||||
| * Get the amount of the ingredient (in the unit) | |||||
| * | |||||
| * @return The amount of the ingredient (in the unit) | |||||
| */ | |||||
| public int getAmount() { | |||||
| return amount; | |||||
| } | |||||
| /** | |||||
| * Set the name of the ingredient. | |||||
| * | |||||
| * @param iname The new name of the ingredient | |||||
| */ | |||||
| public void setName(String iname) { | |||||
| name = iname; | |||||
| } | |||||
| /** | |||||
| * Set the amount of the ingredient. | |||||
| * | |||||
| * @param iamount The new amount of the ingredient. | |||||
| * @param iunits The new unit of measurement for the ingredient. | |||||
| */ | |||||
| public void setAmount(int iamount, String iunits) { | |||||
| amount = iamount; | |||||
| units = iunits; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,72 @@ | |||||
| package uwstout.courses.cs144.labs.lab3; | |||||
| import java.util.Scanner; | |||||
| /** | |||||
| * Gets the ingredients for a 3 ingredient recipe and prints the results. | |||||
| * | |||||
| * Gets the ingredients for a 3 ingredient recipe and prints the results. For | |||||
| * each ingredient, the user needs to specify the name, amount and units. | |||||
| * Ingredients and units can have spaces in them and the amount is a whole | |||||
| * number. | |||||
| * | |||||
| * @author turners | |||||
| * @version 2022-09-26 | |||||
| */ | |||||
| public class Recipe { | |||||
| /** | |||||
| * Gets the ingredients for a 3 ingredient recipe and prints the results. | |||||
| * | |||||
| * Gets the ingredients for a 3 ingredient recipe and prints the results. For | |||||
| * each ingredient, the user needs to specify the name, amount and units. | |||||
| * Ingredients and units can have spaces in them and the amount is a whole | |||||
| * number. | |||||
| * | |||||
| * @param args Command line arguments - not used | |||||
| */ | |||||
| public static void main(String[] args) { | |||||
| Ingredient item1 = null; | |||||
| Ingredient item2 = null; | |||||
| Ingredient item3 = null; | |||||
| String name; | |||||
| int amount; | |||||
| String units; | |||||
| Scanner scan = new Scanner(System.in); | |||||
| System.out.println("Enter the first Ingredient's name: "); | |||||
| name = scan.nextLine(); | |||||
| System.out.println("Enter the first Ingredient's amount: "); | |||||
| amount = scan.nextInt(); | |||||
| System.out.println("Enter the first Ingredient's unit: "); | |||||
| scan.skip("\\s*"); // skips spaces to get the input ready for the units | |||||
| units = scan.nextLine(); | |||||
| item1 = new Ingredient(name, amount, units); | |||||
| System.out.println("Enter the second Ingredient's name: "); | |||||
| name = scan.nextLine(); | |||||
| System.out.println("Enter the second Ingredient's amount: "); | |||||
| amount = scan.nextInt(); | |||||
| System.out.println("Enter the second Ingredient's unit: "); | |||||
| scan.skip("\\s*"); // skips spaces to get the input ready for the units | |||||
| units = scan.nextLine(); | |||||
| item2 = new Ingredient(name, amount, units); | |||||
| System.out.println("Enter the third Ingredient's name: "); | |||||
| name = scan.nextLine(); | |||||
| System.out.println("Enter the third Ingredient's amount: "); | |||||
| amount = scan.nextInt(); | |||||
| System.out.println("Enter the third Ingredient's unit: "); | |||||
| scan.skip("\\s*"); // skips spaces to get the input ready for the units | |||||
| units = scan.nextLine(); | |||||
| item3 = new Ingredient(name, amount, units); | |||||
| System.out.println("Ingredient List\n"); | |||||
| System.out.println(item1.getName() + "\t" + item1.getAmount() + "\t" + item1.getUnits()); | |||||
| System.out.println(item2.getName() + "\t" + item2.getAmount() + "\t" + item2.getUnits()); | |||||
| System.out.println(item3.getName() + "\t" + item3.getAmount() + "\t" + item3.getUnits()); | |||||
| scan.close(); | |||||
| } | |||||
| } | |||||