Showing posts with label Math Cats. Show all posts
Showing posts with label Math Cats. Show all posts

Friday, September 6, 2019

ACAB.BASIC

2 REM "DADES ENTRADES A MA"
10 PRINT "Humanitat:"
20 DIM A$(4,6)
100 A$(0,0)="ESSER_HUMA"
110 A$(0,1)="Adam"
120 A$(0,2)=""
130 A$(0,3)=""
140 A$(0,4)=""
150 A$(0,5)=""

200 A$(1,0)="ESSER_HUMA"
210 A$(1,1)="Eva"
220 A$(1,2)=""
230 A$(1,3)=""
240 A$(1,4)=""
250 A$(1,5)=""

300 A$(2,0)="CIUTADA"
310 A$(2,1)="Abel"
320 A$(2,2)="Adam"
330 A$(2,3)="Eva"
340 A$(2,4)="Escola del Paradis"
350 A$(2,5)=""

400 A$(3,0)="POLI"
410 A$(3,1)="Caim"
420 A$(3,2)=""
430 A$(3,3)="Eva"
440 A$(3,4)="Escola del Paradis"
450 A$(3,5)="1"

460 REM " Bucle que no existeix a OOP:"

480 V=0
500 FOR N=0 TO 3 STEP 1
505 V=N
510 IF A$(N,0)="ESSER_HUMA" THEN GOSUB 1990
520 IF A$(N,0)="CIUTADA" THEN GOSUB 2990
530 IF A$(N,0)="POLI" THEN GOSUB 3990
540 NEXT
1000 END

1990 REM "Print EsserHuma"
2000 PRINT USING " "; A$(V,1);"  "; A$(V,2);"  "; A$(V,3)
2010 RETURN

2990 REM "Print Ciutada"
3000 PRINT USING " "; A$(V,1);"  "; A$(V,2);"  "; A$(V,3);"  "; A$(V,4)
3010 RETURN

3990 REM "Print Poli"
4000 PRINT USING " "; A$(V,2);"  ";  A$(V,5)
4010 RETURN

5000 REM "//////////////////MÓN REAL/////////////////////////////////"
5500 REM "
///////Primera referència al Twitter sobre aquest arxiu:"
5501 REM "//////https://twitter.com/macajo/status/1170044137510461441?s=20
6000 REM "///////////////////////////////////////////////////////////"

Thursday, September 5, 2019

Acab2.java

/* By: Maurici Carbó of nummolt apps Sept 2019
Convenció de Colors:
Comanaments de les Classes de Java
Classes de Java Prefabricades
@anotacions
Paraules Clau de Java
Cadenes de paraules
////Comentaris  */


//////////////////////Acab2.java////////////////  


import java.time.LocalTime;
import org.eclipse.jdt.annotation.Nullable;


public class EsserHuma {
    public LocalTime m_dataNaixement;
    public EsserHuma m_papa;
    public EsserHuma m_mama;
    public String m_nom;

    public EsserHuma(){/*buit*/}
    public EsserHuma(LocalTime datanaixement,@Nullable EsserHuma papa,
                            EsserHuma mama, @Nullable String nom){
        m_dataNaixement=datanaixement;
        m_papa=papa;
        m_mama=mama;
        m_nom=nom;
    }
    public void print() {
        if(m_papa != null || m_mama != null) {
        System.out.println(m_dataNaixement+ " nom propi: "+ m_nom +"Pare: "+ m_papa.m_nom+ " Mare: "+m_mama.m_nom);
        }
        else {
            System.out.println(m_dataNaixement+" nom propi: "+ m_nom);
        }
    }
}




public class Ciutada extends EsserHuma{
    Escola m_escola;
   
    public Ciutada(LocalTime datanaixement,@Nullable EsserHuma papa,
                EsserHuma mama, @Nullable String nom, Escola escola){
        super(datanaixement, papa, mama, nom);
        m_escola= escola;
    }
  
    static Poli nomenarPoli(Ciutada ciutada){
        return Poli.nomenarPoli(ciutada);
    }
    public void print() {
        System.out.println(m_dataNaixement+ " nom propi: "+m_nom +" Pare: "+ m_papa.m_nom+ " Mare: "+m_mama.m_nom);
    }
}


public final class Poli extends Ciutada{
    int m_numeroPlaca;

    private Poli(LocalTime datanaixement, EsserHuma mama, Escola escola){
        super(datanaixement, null, mama, "-", escola);
        Humanitat.m_darrerNumPlaca++;
        m_numeroPlaca=Humanitat.m_darrerNumPlaca;
    }      

     static Poli nomenarPoli(Ciutada ciutada){
        return new Poli(ciutada.m_dataNaixement, ciutada.m_mama, ciutada.m_escola);
    }
    
     public void print() {
         System.out.println(m_dataNaixement+ " nom propi: "+ m_nom + " Mare: "+m_mama.m_nom + " Poli num Placa: "+ m_numeroPlaca);
     }
}



public class Escola {
    String m_nomEscola;
    EsserHuma m_director;
    ArrayList<Ciutada> m_arlExAlumnes;
 
    public Escola(String nomEscola,EsserHuma director){
        m_arlExAlumnes=new ArrayList<Ciutada>();
        m_nomEscola= nomEscola;
        m_director= director;
    }

    public Ciutada ensenyar(EsserHuma esserhuma){
        Humanitat.m_arlHumanitat.remove(esserhuma);
        EsserHuma alumne=esserhuma;
        Ciutada alumneEnsenyat=new Ciutada(alumne.m_dataNaixement, alumne.m_papa,
                                        alumne.m_mama, alumne.m_nom, this);
        Humanitat.m_arlHumanitat.add(alumneEnsenyat);
        m_arlExAlumnes.add(alumneEnsenyat);
        return alumneEnsenyat;
    }
}


public class  Humanitat {
    static ArrayList<Escola> m_arlEscoles;
    static ArrayList<EsserHuma> m_arlHumanitat;
    static int m_darrerNumPlaca=0;
  
    public Humanitat() {
        m_arlEscoles = new ArrayList<Escola>();
        m_arlHumanitat= new ArrayList<EsserHuma>();
    }
  
    static public void nouMembreHumanitat(EsserHuma nouesserhuma){
        m_arlHumanitat.add(nouesserhuma);
    }

    public static void ferEscola(String nomEscola, EsserHuma director){
        m_arlEscoles.add(new Escola(nomEscola, director));
    }
  
    public static Ciutada ensenyar(EsserHuma esserhuma, Escola escola){
        return escola.ensenyar(esserhuma);
    }

    public static void nomenarPoli(Ciutada ciutada){
        m_arlHumanitat.remove(ciutada);
        Ciutada anticCiutada=ciutada;
        Poli nouPoli=Poli.nomenarPoli(anticCiutada);
        m_arlHumanitat.add(nouPoli);
    }
    public static void llistatHumanitat() {
        for(EsserHuma esserhuma: m_arlHumanitat) {
            esserhuma.print();
        }
    }
}


public class Acab {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
            new Humanitat();
            EsserHuma adam=new EsserHuma(); ////buit
            EsserHuma eva=new EsserHuma();  ////buit
            adam.m_dataNaixement= LocalTime.now();
            eva.m_dataNaixement=  LocalTime.now();
            adam.m_nom="Adam";
            eva.m_nom="Eva";
            Humanitat.nouMembreHumanitat(adam);
            Humanitat.nouMembreHumanitat(eva);
            Humanitat.ferEscola("EscolaDelParadís", adam);
            EsserHuma caim= new EsserHuma(LocalTime.now(),adam, eva, "Caim");
            EsserHuma abel= new EsserHuma(LocalTime.now(),adam, eva, "Abel");
            Humanitat.nouMembreHumanitat(caim);      
            Humanitat.nouMembreHumanitat(abel);
            Ciutada caimEnsenyat= Humanitat.ensenyar(caim, Humanitat.m_arlEscoles.get(0));
            Ciutada abelEnsenyat= Humanitat.ensenyar(abel, Humanitat.m_arlEscoles.get(0));
            Humanitat.nomenarPoli(caimEnsenyat);
            Humanitat.llistatHumanitat();
    }
}




////////////////////////////MÓN REAL/////////////////////////////////
///////Primera referència al Twitter sobre aquest arxiu:
///// https://twitter.com/macajo/status/1169660828087402498https://twitter.com/macajo/status/1169660828087402498://twitter.com/macajo/status/1169660828087402498?s=20
/////////////////////////////////////////////////////////////////////






Monday, October 17, 2016

Pan Balance 1: Cats and fractions

Usually in elementary mathematics, teaching pan scale balances are used only for display them at the time of equilibrium, to verify that two quantities are equivalent.

In this case, apart of this use, it is also useful imbalance in the balance. 


Many years ago (2003), Wendy Petti of MathCats.com and me, we developed the "MathCats Balance":


" choose from a wide range of objects to place on this scale - from electrons to galaxies!
" So how can we balance thin cats with fat cats? You might try multiplying each side by the number shown on the opposite side of the balance. Will 2 x 6 thin cats balance with 5 fat cats? Yes, 12 thin cats do balance with 5 fat cats".

MathCats Balance App (Google Play)
MathCats Balance (Amazon) 

Many years after this, I developed under the same idea a pan balance of fractions.
Inspired in a old photograph of Maria Montessori and his son Mario:

 ( from Getty Images: www.gettyimages.es/fotos/maria-montessori )

Pan balance to weigh fractions:

This imbalance, when the imbalance ratio under certain conditions is proportional to the ratio of content of the dishes, is also the result of the division. The slope of a straight line. In this case, the result of the division of fractions.

To view it, you can multiply the contents of each dish, until the balance is obtained, the numbers for which has multiplied each dish are in turn the result  fraction of the division.
The program only multiply by prime numbers, because any number can be built with them.


 This is the "Fractions Balance" Android App:


Comparing
1/2 + 1/3 + 1/6 
with: 1/3 + 1/5 + 1/6 + 1/8 + 1/10 + 1/12
And with: 1/3 + 1/4 + 1/5 + 1/8 + 1/12


I hope it helps on teaching division of fractions.