Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Java by Hiki ( 17 years ago )
1. Zadanie 3 - klasy
2. Przelicznik java - grafika + scrollbar
// Tablice -------------------------------------------------
final int NMAX = 12;
// utwórz macierz trójkątną
int[][] abc = new int[NMAX][];
for (int n = 0; n < NMAX; n++) {
abc[n] = new int[NMAX - n];
}
System.out.println();
//wydrukuj macierz trójkątną
for (int n = 0; n < abc.length; n++) {
for (int k = 0; k < abc[n].length; k++) {
// wyniki pooddzielaj spacjami
String wyjscie = " " + abc[n][k] + " ";
// obetnij wyjściowy string do 3 znaków
wyjscie = wyjscie.substring(wyjscie.length() - 3);
System.out.print(wyjscie);
}
//Klasy ----------------------------------------------------
//Plik 1
public class Rk {
double a, b, c, delta;
public Rk(double A, double B, double C) {
this.a = A; // nadanie wartości współczynnikom równania
this.b = B;
this.c = C;
delta = b * b - 4 * a * c; // wyliczenie delty
}
}
//Plik 2
Rk r = new Rk(a,b,c);
System.out.println("ma pierwiastki: x1 = "+r.x1());
//Grafika ---------------------------------------------------
public class Logowanie extends Frame implements WindowListener, ActionListener {
public Label etykieta1, etykieta2, etykieta3;
public TextField login, haslo;
public Button Ok;
public Color ok_color = new Color(78, 212, 107);
public Font info_font = new Font("Arial", Font.BOLD, 20);
//Number format ---------------------------------------------
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(6);
wart_max = nf.format(max);
wart_min = nf.format(min);
String f;
String s1 = jTextField1.getText().toString();
f = "###.###";
DecimalFormat df = new DecimalFormat(f);
try {
liczba1 = Double.parseDouble(s1);
wynik = liczba1 * liczba1;
jLabel2.setText("Pole kwadratu wynosi " + df.format(wynik));
Revise this Paste