lunes, 18 de septiembre de 2023

ER 0+1+0+1*

                                 AUTOMATA



<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "https://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="800" height="600" version="1.1" xmlns="http://www.w3.org/2000/svg">
<ellipse stroke="black" stroke-width="1" fill="none" cx="165.5" cy="304.5" rx="30" ry="30"/>
<text x="157.5" y="310.5" font-family="Times New Roman" font-size="20">q&#8320;</text>
<ellipse stroke="black" stroke-width="1" fill="none" cx="312.5" cy="304.5" rx="30" ry="30"/>
<text x="304.5" y="310.5" font-family="Times New Roman" font-size="20">q&#8321;</text>
<ellipse stroke="black" stroke-width="1" fill="none" cx="545.5" cy="304.5" rx="30" ry="30"/>
<text x="537.5" y="310.5" font-family="Times New Roman" font-size="20">q&#8323;</text>
<ellipse stroke="black" stroke-width="1" fill="none" cx="545.5" cy="304.5" rx="24" ry="24"/>
<ellipse stroke="black" stroke-width="1" fill="none" cx="435.5" cy="304.5" rx="30" ry="30"/>
<text x="427.5" y="310.5" font-family="Times New Roman" font-size="20">q&#8322;</text>
<polygon stroke="black" stroke-width="1" points="152.5,323.5 148.559,329.259"/>
<polygon fill="black" stroke-width="1" points="148.559,329.259 139.915,333.038 148.169,338.685"/>
<polygon stroke="black" stroke-width="1" points="67.5,304.5 135.5,304.5"/>
<text x="15.5" y="310.5" font-family="Times New Roman" font-size="20">Inicio</text>
<polygon fill="black" stroke-width="1" points="135.5,304.5 127.5,299.5 127.5,309.5"/>
<path stroke="black" stroke-width="1" fill="none" d="M 555.366,276.293 A 22.5,22.5 0 1 1 573.89,295.173"/>
<text x="598.5" y="248.5" font-family="Times New Roman" font-size="20">1</text>
<polygon fill="black" stroke-width="1" points="573.89,295.173 582.538,298.943 581.068,289.051"/>
<polygon stroke="black" stroke-width="1" points="195.5,304.5 282.5,304.5"/>
<polygon fill="black" stroke-width="1" points="282.5,304.5 274.5,299.5 274.5,309.5"/>
<text x="234.5" y="325.5" font-family="Times New Roman" font-size="20">0</text>
<polygon stroke="black" stroke-width="1" points="342.5,304.5 405.5,304.5"/>
<polygon fill="black" stroke-width="1" points="405.5,304.5 397.5,299.5 397.5,309.5"/>
<text x="369.5" y="325.5" font-family="Times New Roman" font-size="20">1</text>
<polygon stroke="black" stroke-width="1" points="465.5,304.5 515.5,304.5"/>
<polygon fill="black" stroke-width="1" points="515.5,304.5 507.5,299.5 507.5,309.5"/>
<text x="485.5" y="325.5" font-family="Times New Roman" font-size="20">0</text>
</svg>


PAGINA PARA VER CODIGO SVG: SVG Viewer - View, edit, and optimize SVGs



                    CÓDIGO


import java.util.Scanner;


/**

 *

 * @author ulice

 */

public class RE2 {


   

   

    public static String eR(String s1,String s2,String s3, String s4){

        String resp=s1+s2+s3;

        for (int i = 0; i < 10; i++) {

            resp+=s4;

        }

        return resp;

    }

    public static void main(String[] args) {

        Scanner leer = new Scanner(System.in);

        String s1,s2,s3,s4;

        System.out.println("Ingrese el caracter 0");

        do {

            s1=leer.next();

            if (!s1.equals("0")) {

                System.out.println("Ingrese el caracter 0");

            }

            

        } while (!s1.equals("0"));

        

        

        System.out.println("Ingrese el segundo caracter 1");

          do {

            s2=leer.next();

            if (!s2.equals("1")) {

                System.out.println("Ingrese el caracter 1");

            }

            

        } while (!s2.equals("1"));

        

        System.out.println("Ingrese el caracter 0");

          do {

            s3=leer.next();

            if (!s3.equals("0")) {

                System.out.println("Ingrese el caracter 0");

            }

            

        } while (!s3.equals("0"));

        System.out.println("Ingrese el caracter 1");

          do {

            s4=leer.next();

            if (!s4.equals("1")) {

                System.out.println("Ingrese el caracter 1");

            }

            

        }while(!s4.equals("1"));

        

        System.out.println(eR(s1,s2,s3,s4));

        

        

    }

    

}




Entidad Relacion (m+n+(p+q)*)

 public class ER {


    public static String eR(String s1,String s2, String s3){

        String resp=s1+s2;

        for (int i = 0; i < 10; i++) {

            resp+=s3;

        }

        return resp;

    }

    public static void main(String[] args) {

        Scanner leer = new Scanner(System.in);

        String s1,s2,s3;

        System.out.println("Ingrese el primer caracter");

        s1=leer.next();

        System.out.println("Ingrese el segundo caracter");

        s2=leer.next();

        System.out.println("Ingrese la union repetida indefinidamente");

        s3=leer.next();

        

        System.out.println(eR(s1,s2,s3));

    }

}




Código Enigma

 /**  *  * @author ulice  */ public class Palindrome {     public static String palindrome(String palabra,int i){         if(i<0){       ...