clean
This commit is contained in:
5 files changed
+83
-5
No files matched your search
@@ -160,15 +160,15 @@ public class Creature {
|
|||||||
*/
|
*/
|
||||||
public String getDetails() {
|
public String getDetails() {
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
|
||||||
builder = new StringBuilder();
|
builder = new StringBuilder();
|
||||||
|
|
||||||
builder.append("Is alive: " + this.isAlive());
|
builder.append("Is alive: " + this.isAlive());
|
||||||
builder.append("Name: " + this.name);
|
builder.append("Name: " + this.name);
|
||||||
builder.append("Date of birth: " + this.dateOfBirth);
|
builder.append("Date of birth: " + this.dateOfBirth);
|
||||||
builder.append("Age: " + this.getAgeYears());
|
builder.append("Age: " + this.getAgeYears());
|
||||||
builder.append("Health: " + this.health);
|
builder.append("Health: " + this.health);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,9 @@ public class Dragon extends Creature {
|
|||||||
@Override
|
@Override
|
||||||
public String getDetails() {
|
public String getDetails() {
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
|
||||||
builder = new StringBuilder();
|
builder = new StringBuilder();
|
||||||
|
|
||||||
builder.append("Is alive: " + this.isAlive());
|
builder.append("Is alive: " + this.isAlive());
|
||||||
builder.append(" Name: " + this.getName());
|
builder.append(" Name: " + this.getName());
|
||||||
builder.append(" Date of birth: " + (this.getDateOfBirth()).getYyyyMmDd());
|
builder.append(" Date of birth: " + (this.getDateOfBirth()).getYyyyMmDd());
|
||||||
@@ -69,8 +71,6 @@ public class Dragon extends Creature {
|
|||||||
builder.append(" Health: " + this.getHealth());
|
builder.append(" Health: " + this.getHealth());
|
||||||
builder.append(" FirePower: " + this.firePower);
|
builder.append(" FirePower: " + this.firePower);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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