/home/caleb/ASDV-Java/Semester 3/Assignments/MP2_Navigation_CalebFontenot/src/main/java/edu/slcc/asdv/pojo/Navigator.java |
package edu.slcc.asdv.pojo;
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java
import jakarta.inject.Named;
import jakarta.enterprise.context.RequestScoped;
@Named(value = "Navigator")
@RequestScoped
public class Navigator {
public Navigator() {
}
public String determine(String origin) {
int rand = (int) (Math.random() * 2);
System.out.println(rand);
String returnValue = "";
switch (origin) {
case "a":
if (rand == 0) {
returnValue = "b.xhtml";
} else {
returnValue = "defeat.xhtml";
}
break;
case "b":
if (rand == 0) {
returnValue = "c.xhtml";
} else {
returnValue = "defeat.xhtml";
}
break;
case "c":
if (rand == 0) {
returnValue = "victory.xhtml";
} else {
returnValue = "defeat.xhtml";
}
break;
}
System.out.println("Return value: " + returnValue);
return returnValue;
}
}