Question: A. Draw a fully labelled control-flow graph for this method ? == == 3. 5. 6. public static void isValidMove(String from, String to) { 1.

 A. Draw a fully labelled control-flow graph for this method ?

A. Draw a fully labelled control-flow graph for this method ?

== == 3. 5. 6. public static void isValidMove(String from, String to) { 1. if ((from null || from.trim().isEmpty()) || (to null || to.tr im().isEmpty()) { // A 2. return "Invalid: and both needs to be non-empty str ings"; } 4. if (from.equals("stock") && isValidPileNumber(to)) { // B return "Valid: stock to pile" 7. } else if (from.equals("stock") && SUITS.contains(to)) { // C 8. return "Valid: stock to suit" 9. } else if (isValidPileNumber(from)) { // D 10. if (!(isValidPileNumber(to) || SUITS.contains (to))) { // E 11. return "Invalid: value is invalid"; 12. } 13. return "Valid: pile to (pile or suit)" 14. } 15. return "Invalid or value"; } // Helper variables and methods public static final Collection SUITS = Arrays.asList("s", "d", "h ", "C"); = public static boolean isValidPileNumber (String input) { try { int i Integer.parseInt(input.trim()); return i >= 1 && i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!