UGH1: The use of String
Assume the format of all phone numbers has to be 999-9999999. Please finish the checkPhone method. The checkPhone method will check whether a string is a valid telephone number. If the string is a valid phone, checkPhone method will return true. If the string is NOT a valid phone, checkPhone method will return false.
public class Phone {
public boolean checkPhone(String phone) {
} // checkPhone
public static void main(String agrs[]) {
Phone myApp = new Phone();
System.out.println(myApp.checkPhone("123-1234567"));
System.out.println(myApp.checkPhone("123.1234567"));
System.out.println(myApp.checkPhone("123-123456"));
System.out.println(myApp.checkPhone("123-12345O"));
}
UGH2: The use of Card and CardDeck
Let us draw cards from two decks. We want to keep track of the number of times the cards drawn are the same in 50 tries.
Hints:
Please use TestCardDeck as a reference.
How many CardDecks ?
How do you get cards?
How do you decide if the Cards are equal?