Jason's fixes
This commit is contained in:
commit
56a200dd04
11 files changed
+109
-22
No files matched your search
@@ -1,3 +1,5 @@
|
||||
# Compiled files
|
||||
/out/*
|
||||
*.class
|
||||
|
||||
.idea/*
|
||||
Generated
+7
-9
@@ -6,12 +6,9 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="4481728b-524b-48ee-9d70-e414a15f05bd" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IDevice.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IDevice.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPad.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPad.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPhone.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPhone.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPhone16.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPhone16.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPod.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/IPod.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab03/Main.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/DamageException.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/DamageException.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/Dragon.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/Dragon.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/HealingException.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/code/ca/bcit/comp2522/lab02/HealingException.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -46,7 +43,7 @@
|
||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"git-widget-placeholder": "lab03",
|
||||
"git-widget-placeholder": "main",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "/home/flami/Projects/comp2522",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
@@ -89,8 +86,8 @@
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
<option value="bundled-jdk-9823dce3aa75-bf35d07a577b-intellij.indexing.shared.core-IU-252.25557.131" />
|
||||
<option value="bundled-js-predefined-d6986cc7102b-b598e85cdad2-JavaScript-IU-252.25557.131" />
|
||||
<option value="bundled-jdk-9823dce3aa75-bf35d07a577b-intellij.indexing.shared.core-IU-252.26199.169" />
|
||||
<option value="bundled-js-predefined-d6986cc7102b-9c94529fcfe0-JavaScript-IU-252.26199.169" />
|
||||
</set>
|
||||
</attachedChunks>
|
||||
</component>
|
||||
@@ -116,6 +113,7 @@
|
||||
<workItem from="1758413771974" duration="332000" />
|
||||
<workItem from="1758425336799" duration="21000" />
|
||||
<workItem from="1758473282464" duration="4563000" />
|
||||
<workItem from="1758570032207" duration="1691000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
@@ -7,7 +7,8 @@ package ca.bcit.comp2522.lab02;
|
||||
* @author Braeden Sowinski, Nicolas Agostini, Trishaan Shetty
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class Creature {
|
||||
public class Creature
|
||||
{
|
||||
private static final int MIN_HEALTH = 1;
|
||||
private static final int MAX_HEALTH = 100;
|
||||
private static final int NO_HEALTH = 0;
|
||||
@@ -158,17 +159,18 @@ public class Creature {
|
||||
*
|
||||
* @return details of the creature.
|
||||
*/
|
||||
public String getDetails() {
|
||||
public String getDetails()
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
builder = new StringBuilder();
|
||||
|
||||
builder.append("Is alive: " + this.isAlive());
|
||||
builder.append("Name: " + this.name);
|
||||
builder.append("Date of birth: " + this.dateOfBirth);
|
||||
builder.append("Age: " + this.getAgeYears());
|
||||
builder.append("Health: " + this.health);
|
||||
|
||||
|
||||
|
||||
return builder.toString();
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ package ca.bcit.comp2522.lab02;
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class DamageException extends RuntimeException {
|
||||
public DamageException(String message) {
|
||||
public DamageException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,8 @@ package ca.bcit.comp2522.lab02;
|
||||
* @author Braeden Sowinski
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class Dragon extends Creature {
|
||||
public class Dragon extends Creature
|
||||
{
|
||||
|
||||
private static final int MAX_FIRE_POWER = 100;
|
||||
private static final int MIN_FIRE_POWER = 0;
|
||||
@@ -59,7 +60,8 @@ public class Dragon extends Creature {
|
||||
* @return details of dragon
|
||||
*/
|
||||
@Override
|
||||
public String getDetails() {
|
||||
public String getDetails()
|
||||
{
|
||||
|
||||
final StringBuilder builder;
|
||||
builder = new StringBuilder();
|
||||
@@ -85,7 +87,8 @@ public class Dragon extends Creature {
|
||||
* @throws RuntimeException if the dragon is not alive to accomplish the action
|
||||
*/
|
||||
public void breatheFire(final Creature target)
|
||||
throws LowFirePowerException, RuntimeException {
|
||||
throws LowFirePowerException, RuntimeException
|
||||
{
|
||||
|
||||
if (!this.isAlive()) {
|
||||
throw new RuntimeException("The dragon is not alive.");
|
||||
@@ -107,7 +110,8 @@ public class Dragon extends Creature {
|
||||
*
|
||||
* @param amount to increase firePower
|
||||
*/
|
||||
protected void restoreFirePower(final int amount) {
|
||||
protected void restoreFirePower(final int amount)
|
||||
{
|
||||
this.firePower += amount;
|
||||
|
||||
if (this.firePower > MAX_FIRE_POWER) {
|
||||
|
||||
@@ -7,7 +7,8 @@ package ca.bcit.comp2522.lab02;
|
||||
* @author Braeden Sowinski
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class HealingException extends RuntimeException {
|
||||
public class HealingException extends RuntimeException
|
||||
{
|
||||
public HealingException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ package ca.bcit.comp2522.lab02;
|
||||
* @author Braeden Sowinski
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class LowFirePowerException extends Exception {
|
||||
public class LowFirePowerException extends Exception
|
||||
{
|
||||
public LowFirePowerException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ package ca.bcit.comp2522.lab02;
|
||||
* @author Braeden Sowinski
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class LowRageException extends Exception {
|
||||
public class LowRageException extends Exception
|
||||
{
|
||||
public LowRageException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@@ -103,5 +103,4 @@ public class Orc extends Creature {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package ca.bcit.comp2522.project;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Country class
|
||||
*
|
||||
* @author Braeden Sowinski
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class Country {
|
||||
final String name;
|
||||
final String capitalCityName;
|
||||
final String[] facts;
|
||||
|
||||
Country(
|
||||
final String name,
|
||||
final String capitalCityName,
|
||||
final String[] facts
|
||||
) {
|
||||
this.name = name;
|
||||
this.capitalCityName = capitalCityName;
|
||||
this.facts = facts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package ca.bcit.comp2522.project;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Main program entry to access a games menu
|
||||
*
|
||||
* @author Braeden Sowinski
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class Main {
|
||||
public static void main(final String[] args) {
|
||||
final Scanner scanner;
|
||||
|
||||
scanner = new Scanner(System.in);
|
||||
|
||||
boolean run = true;
|
||||
|
||||
do {
|
||||
final String input;
|
||||
|
||||
System.out.println("Select a game: ");
|
||||
System.out.println("Word Game (W)");
|
||||
System.out.println("Number Game (N)");
|
||||
System.out.println("My Game (M)");
|
||||
System.out.println("Quit (Q)");
|
||||
System.out.print("> ");
|
||||
|
||||
input = scanner.nextLine().toUpperCase();
|
||||
|
||||
switch (input) {
|
||||
case "W":
|
||||
System.out.println("Word game...");
|
||||
break;
|
||||
case "N":
|
||||
System.out.println("Number game...");
|
||||
break;
|
||||
case "M":
|
||||
System.out.println("My game...");
|
||||
break;
|
||||
case "Q":
|
||||
System.out.println("Quitting...");
|
||||
run = false;
|
||||
break;
|
||||
default:
|
||||
System.out.println("Invalid input: " + input);
|
||||
break;
|
||||
}
|
||||
|
||||
} while (run);
|
||||
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user