Skip to content

Instantly share code, notes, and snippets.

@wende
Forked from anonymous/gist:895043f5b77982e0513a
Last active March 25, 2016 11:34
Show Gist options
  • Save wende/be8770f43ffae05a6de9 to your computer and use it in GitHub Desktop.
Save wende/be8770f43ffae05a6de9 to your computer and use it in GitHub Desktop.
public static void main(String[] args)
{
PunktMaterialny pkt = new PunktMaterialny(); //klasa z konstruktorem domyślnym
pkt.setMasa(5);
pkt.mombez();
pkt.opis();
PunktMaterialny pkt2 = new PunktMaterialny(8); //klasa z konstruktorem z parametrem
pkt2.opis();
pkt.setMasa(3); //zmiana masy w pierwszym obiekcie
pkt.opis();
int[] tab= new int[3];
for(int j=0; j<3; j++) //wypelnienie tablicy
tab[j]=j+1;
for(int i=0; i<tab.length; i++)//petla do tworzenia tablicy obiektow !!!!!!!!!!!!!!!!!!!!!to
{
PunktMaterialny punkt = new PunktMaterialny();
punkt.setMasa(tab[i]);
System.out.println("Parametry punktu materialnego nr"+ (i+1));
System.out.println("masa="+punkt.getMasa()+" Moment bezwladnosci="+punkt.mombez()+" Moment Steinera="+punkt.steiner(4));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment