update lab04 driver classes
This commit is contained in:
2 files changed
+22
-3
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package ca.bcit.comp1510.lab04;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Names test Name class.
|
||||
* @author Braeden Sowinski
|
||||
@@ -12,7 +14,16 @@ public class Names {
|
||||
* @param args cli input unused
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
Name myName = new Name("Braeden", "M", "Sowinski");
|
||||
Scanner scan = new Scanner(System.in);
|
||||
System.out.print("Enter first name: ");
|
||||
String first = scan.next();
|
||||
System.out.print("Enter middle name: ");
|
||||
String mid = scan.next();
|
||||
System.out.print("Enter last name: ");
|
||||
String last = scan.next();
|
||||
scan.close();
|
||||
|
||||
Name myName = new Name(first, mid, last);
|
||||
|
||||
System.out.println(myName.toString());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ca.bcit.comp1510.lab04;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* RollingMultiDice test the modified MultiDie class.
|
||||
*
|
||||
@@ -13,11 +15,17 @@ public class RollingMultiDice {
|
||||
* @param args cli input unused
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
final int numSides = 12;
|
||||
Scanner scan = new Scanner(System.in);
|
||||
System.out.println("Enter number of sides: ");
|
||||
int numSides = scan.nextInt();
|
||||
scan.close();
|
||||
|
||||
MultiDie die = new MultiDie(numSides);
|
||||
|
||||
System.out.println(die.max);
|
||||
System.out.println("Die Max: " + die.max);
|
||||
System.out.println("Initial Face value: " + die.getFaceValue());
|
||||
System.out.println("Random Roll: " + die.roll());
|
||||
|
||||
/*
|
||||
* 1. Do you need getters and setters for max? Should you have them?
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user