Initial Commit
This commit is contained in:
8
Source Code/Assignment5Q1/.idea/.gitignore
generated
vendored
Normal file
8
Source Code/Assignment5Q1/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/../../../../../:\JavaProjects\JavaYear1\Assignment5Q1\.idea/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
25
Source Code/Assignment5Q1/.idea/codeStyles/Project.xml
generated
Normal file
25
Source Code/Assignment5Q1/.idea/codeStyles/Project.xml
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
<package name="java.util" alias="false" withSubpackages="false" />
|
||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||
<value>
|
||||
<package name="" alias="false" withSubpackages="true" />
|
||||
<package name="java" alias="false" withSubpackages="true" />
|
||||
<package name="javax" alias="false" withSubpackages="true" />
|
||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||
<package name="" alias="true" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
</JetCodeStyleSettings>
|
||||
<ScalaCodeStyleSettings>
|
||||
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||
</ScalaCodeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
5
Source Code/Assignment5Q1/.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
Source Code/Assignment5Q1/.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
1
Source Code/Assignment5Q1/.idea/description.html
generated
Normal file
1
Source Code/Assignment5Q1/.idea/description.html
generated
Normal file
@@ -0,0 +1 @@
|
||||
<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html>
|
6
Source Code/Assignment5Q1/.idea/encodings.xml
generated
Normal file
6
Source Code/Assignment5Q1/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
9
Source Code/Assignment5Q1/.idea/misc.xml
generated
Normal file
9
Source Code/Assignment5Q1/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectKey">
|
||||
<option name="state" value="project://e2804f05-5315-4fc6-a121-c522a6c26470" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
Source Code/Assignment5Q1/.idea/modules.xml
generated
Normal file
8
Source Code/Assignment5Q1/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Assignment5Q1.iml" filepath="$PROJECT_DIR$/Assignment5Q1.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
3
Source Code/Assignment5Q1/.idea/project-template.xml
generated
Normal file
3
Source Code/Assignment5Q1/.idea/project-template.xml
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<input-field default="com.company">IJ_BASE_PACKAGE</input-field>
|
||||
</template>
|
12
Source Code/Assignment5Q1/Assignment5Q1.iml
Normal file
12
Source Code/Assignment5Q1/Assignment5Q1.iml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
Binary file not shown.
68
Source Code/Assignment5Q1/src/Main.java
Normal file
68
Source Code/Assignment5Q1/src/Main.java
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* @author Isaac Shoebottom (3429069)
|
||||
*/
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
|
||||
boolean gotPaid;
|
||||
boolean boughtGroceries;
|
||||
boolean leftoversAtHome;
|
||||
boolean enoughLeftoversForMeal;
|
||||
String scannerIn;
|
||||
|
||||
System.out.println("Did you get paid this week?");
|
||||
scannerIn = scanner.nextLine();
|
||||
scannerIn = scannerIn.toLowerCase();
|
||||
scannerIn = (scannerIn.equals("yes")) ? "true" : (scannerIn.equals("no")) ? "false" : "not yes or no";
|
||||
gotPaid = Boolean.parseBoolean(scannerIn);
|
||||
|
||||
if (gotPaid) {
|
||||
|
||||
System.out.println("Did you buy groceries this week?");
|
||||
scannerIn = scanner.nextLine();
|
||||
scannerIn = scannerIn.toLowerCase();
|
||||
scannerIn = (scannerIn.equals("yes")) ? "true" : (scannerIn.equals("no")) ? "no" : "not yes or no";
|
||||
boughtGroceries = Boolean.parseBoolean(scannerIn);
|
||||
|
||||
if (!boughtGroceries) {
|
||||
|
||||
System.out.println("Do you have leftovers at home?");
|
||||
scannerIn = scanner.nextLine();
|
||||
scannerIn = scannerIn.toLowerCase();
|
||||
scannerIn = (scannerIn.equals("yes")) ? "true" : (scannerIn.equals("no")) ? "no" : "not yes or no";
|
||||
leftoversAtHome = Boolean.parseBoolean(scannerIn);
|
||||
|
||||
if (leftoversAtHome) {
|
||||
|
||||
System.out.println("Are there enough leftovers for a meal?");
|
||||
scannerIn = scanner.nextLine();
|
||||
scannerIn = scannerIn.toLowerCase();
|
||||
scannerIn = (scannerIn.equals("yes")) ? "true" : (scannerIn.equals("no")) ? "no" : "not yes or no";
|
||||
enoughLeftoversForMeal = Boolean.parseBoolean(scannerIn);
|
||||
|
||||
if (!enoughLeftoversForMeal) {
|
||||
System.out.println("You should eat at a restaurant.");
|
||||
}
|
||||
else {
|
||||
System.out.println("You should eat at home.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println("You should eat at a restaurant.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println("You should eat at home.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println("You should eat at home.");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user