|
|
@ -75,6 +75,8 @@ public class TasksFrame extends JFrame { |
|
|
|
|
|
|
|
setupArea(); |
|
|
|
|
|
|
|
setupFakultaet(); |
|
|
|
|
|
|
|
setupSumFromTo(); |
|
|
|
|
|
|
|
setup5ModList(1, 20); |
|
|
@ -655,6 +657,55 @@ public class TasksFrame extends JFrame { |
|
|
|
return a-b; |
|
|
|
} |
|
|
|
|
|
|
|
public int Fakultaet(int a){ |
|
|
|
int sum = 0; |
|
|
|
int faku=1; |
|
|
|
while ( sum <a ) { |
|
|
|
sum = sum + 1 ; |
|
|
|
faku = faku * sum ; |
|
|
|
} |
|
|
|
if(sum == 0){ |
|
|
|
faku = 0; |
|
|
|
} |
|
|
|
return faku; |
|
|
|
} |
|
|
|
|
|
|
|
private void setupFakultaet() |
|
|
|
{ |
|
|
|
JPanel jPanel = setupPanel("Berechnen Sie die Fakultaet einer Zahl:"); |
|
|
|
|
|
|
|
JTextField a = new JTextField(); |
|
|
|
a.setVisible(true); |
|
|
|
a.setBounds(50,25,35,30); |
|
|
|
a.setFont(new java.awt.Font("Arial", Font.BOLD, 12)); |
|
|
|
|
|
|
|
JButton faku = new JButton("Calculate Fakultaet"); |
|
|
|
faku.setVisible(true); |
|
|
|
faku.setBounds(0, 60, 180,30); |
|
|
|
faku.setBackground(Color.BLUE); |
|
|
|
|
|
|
|
JTextField res = new JTextField(); |
|
|
|
res.setVisible(true); |
|
|
|
res.setBounds(50,100,35,30); |
|
|
|
res.setFont(new java.awt.Font("Arial", Font.BOLD, 12)); |
|
|
|
|
|
|
|
faku.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
String texta = a.getText(); |
|
|
|
Integer val_a = Integer.valueOf(texta); |
|
|
|
Integer res1 = Fakultaet(val_a); |
|
|
|
res.setText(String.valueOf(res1)); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
jPanel.add(a); |
|
|
|
jPanel.add(faku); |
|
|
|
jPanel.add(res); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setupArea() |
|
|
|
{ |
|
|
|
JPanel jPanel = setupPanel("Area and perimeter of a Rectangle:"); |
|
|
@ -800,20 +851,6 @@ public class TasksFrame extends JFrame { |
|
|
|
return sum+to; |
|
|
|
} |
|
|
|
|
|
|
|
public int Fakultaet(int a){ |
|
|
|
int sum = 0; |
|
|
|
int faku=1; |
|
|
|
while ( sum <a ) { |
|
|
|
sum = sum + 1 ; |
|
|
|
faku = faku * sum ; |
|
|
|
} |
|
|
|
if(sum == 0){ |
|
|
|
faku = 0; |
|
|
|
} |
|
|
|
return faku; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ArrayList<Integer> setup5ModList(int from, int to) { |
|
|
|
|
|
|
|