Commit 50399e39 by Matias Ferreira

agregando detalles aprendidos en la clase de hoy

parent f4ce1947
package com.roshka.webprojecttest.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/factorial")
public class FactorialRequestServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
// req -> datos que envia el navegador al servidor de aplicaciones
// resp -> la respuesta que envia el servidor de aplicaciones al navegador
PrintWriter pw = new PrintWriter(resp.getOutputStream());
// String s1 = req.getParameter("s1");
// String s2 = req.getParameter("s2");
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos factorializador</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un factorializador</h1>"
+ "<div>"
+ "<form action=\"factorial-response\" >"
+ "Introduzca el numero: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "</body>"
+ "</html>");
pw.close();
}
}
......@@ -10,80 +10,116 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/factorial-response")
public class FactorialResponseServlet extends HttpServlet {
@WebServlet("/factorial")
public class FactorialServlet extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
PrintWriter pw = new PrintWriter(resp.getOutputStream());
Boolean valido=true;
String parametro = req.getParameter("number");
if(parametro.length() <1)
valido=false;
for(int i = 0 ; i < parametro.length(); i++) {
if( ( !Character.isDigit(parametro.charAt(i)) && i > 0) && !(Character.isDigit(parametro.charAt(i)) && i == 0 && parametro.charAt(i) != '-' ) ) {
valido=false;
break;
}
}
if (!valido) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "No se puede generarla tabla de multiplicar. Valor del parametro \" " + parametro + " \" invalido."
+ "</body>"
+ "</html>");
if(parametro == null ) {
initForm(pw);
}
else {
Integer numero = Integer.parseInt(parametro);
if(numero > 100) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "Mi programa solo conoce el factorial de hasta el numero 100. El numero pasado fue: "+numero
+ "</body>"
+ "</html>");
if(parametro.equals(""))
valido=false;
for(int i = 0 ; i < parametro.length(); i++) {
if( ( !Character.isDigit(parametro.charAt(i)) && i > 0) && !(Character.isDigit(parametro.charAt(i)) && i == 0 && parametro.charAt(i) != '-' ) ) {
valido=false;
break;
}
}
else if(numero<0) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "Mi programa no sabe obtener el factorial de numeros negativos"
+ "</body>"
+ "</html>");
if (!valido) {
error(pw, parametro);
}
else{
long facto=1;
for (long i = 2; i <=numero;i++)
facto*=i;
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos al factorializador</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un generador de factorial de numeros</h1>"
+ "<div>"
+ "<form action=\"factorial-response\" >"
+ "Introduzca el numero: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "<div>"
+ "<p>El factorial de "+ numero+" es: " + facto +"</p>"
+ "</div>"
+ "</body>"
+ "</html>");
else {
Integer numero = Integer.parseInt(parametro);
if(numero > 100) {
greaterThan100(pw, numero);
}
else if(numero<0) {
negative(pw);
}
else{
long facto=1;
for (long i = 2; i <=numero;i++)
facto*=i;
factoDisplay(pw, numero, facto);
}
}
}
pw.close();
}
void factoDisplay(PrintWriter pw, Integer numero, Long facto) {
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos al factorializador</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un generador de factorial de numeros</h1>"
+ "<div>"
+ "<form action=\"factorial-response\" >"
+ "Introduzca el numero: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "<div>"
+ "<p>El factorial de "+ numero+" es: " + facto +"</p>"
+ "</div>"
+ "</body>"
+ "</html>");
}
void error(PrintWriter pw, String parametro) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "No se puede generarla tabla de multiplicar. Valor del parametro \" " + parametro + " \" invalido."
+ "</body>"
+ "</html>");
}
void greaterThan100(PrintWriter pw, Integer numero) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "Mi programa solo conoce el factorial de hasta el numero 100. El numero pasado fue: "+numero
+ "</body>"
+ "</html>");
}
void negative(PrintWriter pw) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "Mi programa no sabe obtener el factorial de numeros negativos"
+ "</body>"
+ "</html>");
}
void initForm(PrintWriter pw) {
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos factorializador</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un factorializador</h1>"
+ "<div>"
+ "<form action=\"factorial-response\" >"
+ "Introduzca el numero: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "</body>"
+ "</html>");
}
}
package com.roshka.webprojecttest.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/show-me-the-bits")
public class ShowMeTheBitsRequestServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
PrintWriter pw = new PrintWriter(resp.getOutputStream());
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos al show me the bits</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un conversor sistemas de numeracion</h1>"
+ "<div>"
+ "<form action=\"show-me-the-bits-response\" >"
+ "Introduzca el numero: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "</body>"
+ "</html>");
pw.close();
}
}
......@@ -11,8 +11,8 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/show-me-the-bits-response")
public class ShowMeTheBitsResponseServlet extends HttpServlet {
@WebServlet("/show-me-the-bits")
public class ShowMeTheBitsServlet extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
......@@ -20,100 +20,128 @@ public class ShowMeTheBitsResponseServlet extends HttpServlet {
Boolean valido=true;
String parametro = req.getParameter("number");
Integer [] vectorResultado = new Integer [16];
String tipo="";
if(parametro.length() < 1)
valido=false;
else if(parametro.length() >1 ) {
if(parametro.charAt(0) == '0') {
if(parametro.charAt(1) == 'x')
tipo = "hexadecimal";
else
tipo = "octal";;
}else
tipo="decimal";
}else
tipo= "decimal";;
if(tipo.equals("decimal")) {
for ( int i = 0 ; i< parametro.length(); i++)
if(!Character.isDigit(parametro.charAt(i)))
valido = false;
}
else if(tipo.equals("octal")) {
for ( int i = 1 ; i< parametro.length(); i++)
if(!Character.isDigit(parametro.charAt(i)))
valido = false;
}
else if(tipo.equals("hexadecimal")) {
for ( int i = 2 ; i < parametro.length(); i++ )
if( !isHexaDigit(parametro.charAt(i) ) )
valido = false;
}
int validAux = 0;
if(valido) {
if(tipo.equals("decimal") )
validAux = Integer.parseInt(parametro,10);
else if( tipo.equals("hexadecimal") )
validAux = Integer.parseInt(parametro.substring(2),16);
else
validAux = Integer.parseInt(parametro.substring(1),8);
}
if(validAux > 65535)
valido = false;
if (!valido) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "No se puede generarla tabla de multiplicar. Valor del parametro \"" + parametro + "\" invalido."
+ "</body>"
+ "</html>");
if(parametro == null) {
initForm(pw);
}
else {
transformacion(tipo, parametro, vectorResultado);
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos al conversor de numeros</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un conversor de sistemas de numeracion</h1>"
+ "<div>"
+ "<form action=\"show-me-the-bits-response\" >"
+ "Introduzca el numero: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "<table>"
+ "<tr>");
for(int i = 15; i >= 0 ; i--) {
if(vectorResultado[i] == 1) {
pw.write("<th style=\"color: gold ; background-color:darkblue;\">" + vectorResultado[i]+"</th>");
String tipo="";
if(parametro.length() < 1)
valido=false;
else if(parametro.length() >1 ) {
if(parametro.charAt(0) == '0') {
if(parametro.charAt(1) == 'x')
tipo = "hexadecimal";
else
tipo = "octal";;
}else
tipo="decimal";
}else
tipo= "decimal";;
if(tipo.equals("decimal")) {
for ( int i = 0 ; i< parametro.length(); i++)
if(!Character.isDigit(parametro.charAt(i)))
valido = false;
}
else {
pw.write("<th style=\"color:fuchsia ; background-color:darkblue;\">"+vectorResultado[i]+"</th>");
else if(tipo.equals("octal")) {
for ( int i = 1 ; i< parametro.length(); i++)
if(!Character.isDigit(parametro.charAt(i)))
valido = false;
}
if(i == 8) {
pw.write("<th> === </th>");
else if(tipo.equals("hexadecimal")) {
for ( int i = 2 ; i < parametro.length(); i++ )
if( !isHexaDigit(parametro.charAt(i) ) )
valido = false;
}
else if(i == 0) {
pw.write("</tr>");
int validAux = 0;
if(valido) {
if(tipo.equals("decimal") )
validAux = Integer.parseInt(parametro,10);
else if( tipo.equals("hexadecimal") )
validAux = Integer.parseInt(parametro.substring(2),16);
else
validAux = Integer.parseInt(parametro.substring(1),8);
}
if(validAux > 65535)
valido = false;
if (!valido) {
invalido(pw, parametro);
}
else {
transformacion(tipo, parametro, vectorResultado);
theTable(pw, vectorResultado);
}
else
pw.write("<th> | </th>");
}
pw.write( "</table>"
+ "</body>"
+ "</html>");
}
pw.close();
}
void initForm(PrintWriter pw) {
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos al show me the bits</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un conversor sistemas de numeracion</h1>"
+ "<div>"
+ "<form action=\"show-me-the-bits\" >"
+ "Introduzca el numero: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "</body>"
+ "</html>");
}
void theTable(PrintWriter pw, Integer [] vectorResultado) {
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos al conversor de numeros</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un conversor de sistemas de numeracion</h1>"
+ "<div>"
+ "<form action=\"show-me-the-bits\" >"
+ "Introduzca el numero: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "<table>"
+ "<tr>");
for(int i = 15; i >= 0 ; i--) {
if(vectorResultado[i] == 1) {
pw.write("<th style=\"color: gold ; background-color:darkblue;\">" + vectorResultado[i]+"</th>");
}
else {
pw.write("<th style=\"color:fuchsia ; background-color:darkblue;\">"+vectorResultado[i]+"</th>");
}
if(i == 8) {
pw.write("<th> === </th>");
}
else if(i == 0) {
pw.write("</tr>");
}
else
pw.write("<th> | </th>");
}
pw.write( "</table>"
+ "</body>"
+ "</html>");
}
void invalido(PrintWriter pw, String parametro) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "No se puede generarla tabla de bits. Valor del parametro \"" + parametro + "\" invalido."
+ "</body>"
+ "</html>");
}
public void transformacion(String tipo, String valor, Integer [] resultado) {
if(tipo.equals("decimal")) {
......
......@@ -18,22 +18,41 @@ public class SumaRequestServlet extends HttpServlet {
{
PrintWriter pw = new PrintWriter(resp.getOutputStream());
String s1 = req.getParameter("s1");
String s2 = req.getParameter("s2");
if(s1 != null && s2 != null) {
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos al sumador</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un sumador</h1>"
+ "<div>"
+ "<p>Operador s1: " + s1 + "</p>"
+ "<p>Operador s2: " + s2 + "</p>"
+ "<p>s1 + s2: " + (Double.parseDouble(s1) + Double.parseDouble(s2)) + "</p>"
+ "</div>"
+ "</body>"
+ "</html>");
}else {
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos al sumador</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un sumador</h1>"
+ "<div>"
+ "<form action=\"suma\">"
+ "Enter 1st number: <input type=\"text\" name=s1><br>"
+ "Enter 2nd number: <input type=\"text\" name=s2><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "</body>"
+ "</html>");
}
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos al sumador</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un sumador</h1>"
+ "<div>"
+ "<form action=\"suma-response\">"
+ "Enter 1st number: <input type=\"text\" name=s1><br>"
+ "Enter 2nd number: <input type=\"text\" name=s2><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "</body>"
+ "</html>");
pw.close();
......
package com.roshka.webprojecttest.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/tabla-multiplicar")
public class TablaMultiplicarRequestServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
PrintWriter pw = new PrintWriter(resp.getOutputStream());
pw.write("<html>"
+ "<head>"
+ "<title>Hola, Aqui te enseño las tablas de la multiplicacion</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un generador de tablas de multiplicar</h1>"
+ "<div>"
+ "<form action=\"tabla-multiplicar-response\">"
+ "Enter 1st number: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "</body>"
+ "</html>");
pw.close();
}
}
......@@ -10,85 +10,121 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/tabla-multiplicar-response")
public class TablaMultiplicarResponseServelet extends HttpServlet {
@WebServlet("/tabla-multiplicar")
public class TablaMultiplicarServelet extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
PrintWriter pw = new PrintWriter(resp.getOutputStream());
Boolean valido=true;
String parametro = req.getParameter("number");
if(parametro.length() <1)
valido=false;
for(int i = 0 ; i < parametro.length(); i++) {
if( ( !Character.isDigit(parametro.charAt(i)) && i > 0) && !(Character.isDigit(parametro.charAt(i)) && i == 0 && parametro.charAt(i) != '-' ) ) {
if(parametro == null) {
initForm(pw);
}else {
if(parametro.length() <1)
valido=false;
break;
for(int i = 0 ; i < parametro.length(); i++) {
if( ( !Character.isDigit(parametro.charAt(i)) && i > 0) && !(Character.isDigit(parametro.charAt(i)) && i == 0 && parametro.charAt(i) != '-' ) ) {
valido=false;
break;
}
}
}
if (!valido) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "No se puede generarla tabla de multiplicar. Valor del parametro \"" + parametro + "\" invalido."
+ "</body>"
+ "</html>");
}
else {
Integer numero = Integer.parseInt(parametro);
if(numero > 100) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "Mi programa solo conoce la tabla de multiplicar hasta el numero 100. El numero pasado fue: "+numero
+ "</body>"
+ "</html>");
if (!valido) {
invalid(pw, parametro);
}
else if(numero<0) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "Mi programa no sabe las tablas de multiplicar de numeros negativos"
+ "</body>"
+ "</html>");
}
else{
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos al multiplicador</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un generador de tablas de multiplicar</h1>"
+ "<div>"
+ "<form action=\"tabla-multiplicar-response\">"
+ "Enter 1st number: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "<table style=\"width:5%\">"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>1 </th>" +"<th>=</th>" + "<th>"+(numero*1) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>2 </th>" +"<th>=</th>" + "<th>"+(numero*2) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>3 </th>" +"<th>=</th>" + "<th>"+(numero*3) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>4 </th>" +"<th>=</th>" + "<th>"+(numero*4) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>5 </th>" +"<th>=</th>" + "<th>"+(numero*5) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>6 </th>" +"<th>=</th>" + "<th>"+(numero*6) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>7 </th>" +"<th>=</th>" + "<th>"+(numero*7) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>8 </th>" +"<th>=</th>" + "<th>"+(numero*8) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>9 </th>" +"<th>=</th>" + "<th>"+(numero*9) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>10</th>" +"<th>=</th>" + "<th>"+(numero*10)+ "</th>" + "</tr>"
+ "</tdr>"
+ "</body>"
+ "</html>");
else {
Integer numero = Integer.parseInt(parametro);
if(numero > 100) {
greaterThan100(pw, numero);
}
else if(numero<0) {
negative(pw);
}
else{
theTable(pw, numero);
}
}
}
pw.close();
}
void initForm(PrintWriter pw) {
pw.write("<html>"
+ "<head>"
+ "<title>Hola, Aqui te enseño las tablas de la multiplicacion</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un generador de tablas de multiplicar</h1>"
+ "<div>"
+ "<form action=\"tabla-multiplicar\">"
+ "Enter 1st number: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "</body>"
+ "</html>");
}
void theTable(PrintWriter pw, Integer numero) {
pw.write("<html>"
+ "<head>"
+ "<title>Hola, bienvenidos al multiplicador</title>"
+ "</head>"
+ "<body>"
+ "<h1>Soy un generador de tablas de multiplicar</h1>"
+ "<div>"
+ "<form action=\"tabla-multiplicar\">"
+ "Enter 1st number: <input type=\"text\" name=number><br>"
+ "<input type=\"submit\">"
+ "</form>"
+ "</div>"
+ "<table style=\"width:5%\">"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>1 </th>" +"<th>=</th>" + "<th>"+(numero*1) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>2 </th>" +"<th>=</th>" + "<th>"+(numero*2) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>3 </th>" +"<th>=</th>" + "<th>"+(numero*3) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>4 </th>" +"<th>=</th>" + "<th>"+(numero*4) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>5 </th>" +"<th>=</th>" + "<th>"+(numero*5) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>6 </th>" +"<th>=</th>" + "<th>"+(numero*6) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>7 </th>" +"<th>=</th>" + "<th>"+(numero*7) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>8 </th>" +"<th>=</th>" + "<th>"+(numero*8) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>9 </th>" +"<th>=</th>" + "<th>"+(numero*9) + "</th>" + "</tr>"
+ "<tr>"+ "<th>"+numero+"</th>" + "<th>*</th>"+ "<th>10</th>" +"<th>=</th>" + "<th>"+(numero*10)+ "</th>" + "</tr>"
+ "</tdr>"
+ "</body>"
+ "</html>");
}
void invalid(PrintWriter pw, String parametro) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "No se puede generarla tabla de multiplicar. Valor del parametro \"" + parametro + "\" invalido."
+ "</body>"
+ "</html>");
}
void greaterThan100(PrintWriter pw, Integer numero) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "Mi programa solo conoce la tabla de multiplicar hasta el numero 100. El numero pasado fue: "+numero
+ "</body>"
+ "</html>");
}
void negative(PrintWriter pw) {
pw.write("<html>"
+ "<head>"
+ "<title>Error de parametro</title>"
+ "</head>"
+ "<body>"
+ "Mi programa no sabe las tablas de multiplicar de numeros negativos"
+ "</body>"
+ "</html>");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment