Untitled
unknown
plain_text
a year ago
2.3 kB
6
Indexable
/**
* A demo class to test the functionality of the WISH system.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Demo {
public static void main(String[] args) {
// Create a Resort instance
WISH resort = new Resort("Wayward Worlds");
// Display all world details
System.out.println("=== Resort Details ===");
System.out.println(resort.toString());
System.out.println();
// Test finding cards
System.out.println("=== Test: Find Cards ===");
int[] cardIdsToFind = {1001, 1012, 9999}; // Includes a valid and an invalid card ID
for (int cardId : cardIdsToFind) {
String location = resort.findCard(cardId);
System.out.println("Card ID: " + cardId + ", Location: " + (location != null ? location : "Not Found"));
}
System.out.println();
// Test listing all cards on specific worlds
System.out.println("=== Test: List Cards on Worlds ===");
String[] worldNames = {"Home", "Sprite", "Tropicana", "Fantasia", "Solo", "NonExistent"};
for (String worldName : worldNames) {
System.out.println("Cards on World '" + worldName + "':");
System.out.println(resort.getAllCardsOnOneWorld(worldName));
System.out.println();
}
// Test travel
System.out.println("=== Test: Travel ===");
String[][] travelRequests = {
{"1001", "ABC1"}, // Valid travel
{"1012", "CDE3"}, // Invalid travel due to luxury rating
{"9999", "ABC1"}, // Invalid travel due to non-existent card
{"1001", "XYZ"} // Invalid travel due to non-existent shuttle
};
for (String[] request : travelRequests) {
int cardId = Integer.parseInt(request[0]);
String shuttleCode = request[1];
System.out.println("Travel Request: Card ID " + cardId + " via Shuttle '" + shuttleCode + "'");
System.out.println(resort.travel(cardId, shuttleCode));
System.out.println();
}
// Recheck worlds after travel
System.out.println("=== Updated Resort Details After Travel ===");
System.out.println(resort.toString());
}
}
Editor is loading...
Leave a Comment