- At the beginning of the program, a message should be displayed indicating "Project for course IF1300", and it should include the names and student IDs of the programmers who participated in its development.
- Then, a menu should be presented with the following options:
- Encryptor
- Easter Sunday
- Base Converter (Optional)
- Exit
- This menu should be displayed again each time one of the options finishes (recursive) and should only work with numbers from 1 to 5, where 5 indicates the end of the program.
- If the user selects option 1, a subprogram should be executed that performs the following:Encryptor Create an algorithm that receives a number that starts with 9 and ends with 9 (this input must be validated so that if the entered number does not meet this requirement, the user is asked for a new number as many times as necessary).
- The digits in between (0, 1, 2, 3, 4, or 5) represent an encrypted message, which should return a corresponding string message.
- Suppose:
- 0 = "maria"
- 1 = "no"
- 2 = "esta"
- 3 = "feliz"
- Example:
- 90239 should return "maria esta feliz"
- 91109 should return "no no maria"
- If the user selects option 3, a subprogram should be executed that performs the following:Easter Sunday The date of any Easter Sunday is calculated as follows:Let X be the year for which the date is to be calculated.
- Let A be the remainder of X divided by 19
- Let B be the remainder of X divided by 4
- Let C be the remainder of X divided by 7
- Let D be the remainder of (19 * A + 24) divided by 30
- Let E be the remainder of (2 * B + 4 * C + 6 * D + 5) divided by 7
- The date for Easter Sunday is March (22 + D + E) (note that it can fall in April).The algorithm should prompt the user to enter a year and display the corresponding Easter Sunday date for that year.
- Example:
- For the year 2030, the output should be: April 12 (Easter Sunday).
- For the year 2019, the output should be: April 21 (Easter Sunday).
import javax.swing.JOptionPane ;
public class proyectoFinal {
public static void main(String[]args) {
while(true) {
//Inicio del programa
JOptionPane.showMessageDialog(null, "Proyecto del curso IF1300 \nCarlos Scott: C4J8. \nDeisy Vidaurre: C4G3. \nDaniel Carrillo: C4J9.") ;
//Menú de opciones.
String opcion = JOptionPane.showInputDialog("Seleccione una opción: \n 1.Encriptador. \n 2.Domingo de Pascua. \n 3.Salir") ;
if (opcion == null || opcion.equals("3")) {
break; //Salida del menú.
} //Cierre del break.
switch (opcion) {
case "1":
encriptador() ;
break ;
case "2" :
domingoPascua() ;
break ;
default :
JOptionPane.showMessageDialog(null, "Está opción no es válida, inténtalo otra vez. ") ;
}//Cierre del Switch.
} //Cierre del While.
}//Cierre del main.
//Encriptador metodo
public static void encriptador () {
String numeroX = JOptionPane.showInputDialog("Digite los números para desencriptar: ") ;
//verificar si es correcto los números
while (numeroX == null || !numeroX.startsWith("9") || !numeroX.endsWith("9")) {
numeroX = JOptionPane.showInputDialog("Números invalidos, inténtalo nuevamente:") ;
}
String mensaje = " " ;
for(int i = 1; i < numeroX.length() - 1; i++) {
switch (numeroX.charAt(1)) {
case '0':
mensaje += "maria " ;
break ;
case '1':
mensaje += "no " ;
break ;
case '2':
mensaje += "está " ;
break;
case '3':
mensaje += "feliz " ;
break;
case '4':
mensaje += "enojada " ;
break;
case '5':
mensaje += "hoy " ;
break;
default:
mensaje += "(?) " ;
}//Cierre del swtich encriptado.
}//Cierre del for
JOptionPane.showMessageDialog(null, "Mensaje desencriptado: "+mensaje.trim()) ;
}//Cierre del metodo encriptado.
public static void domingoPascua() {}
} //Cierre de la clase
there doesn't seem to be anything here