Created
March 24, 2016 22:24
-
-
Save anonymous/895043f5b77982e0513a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) | |
{ | |
punkt_materialny pkt = new punkt_materialny(); //klasa z konstruktorem domyślnym | |
pkt.setMasa(5); | |
pkt.Mombez(); | |
pkt.Opis(); | |
punkt_materialny pkt2 = new punkt_materialny(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 | |
{ | |
punkt_materialny punkt = new punkt_materialny(); | |
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