-
-
Save wende/be8770f43ffae05a6de9 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) | |
{ | |
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