Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaz1_6;
- public class JavaZ1_6 {
- public static void main(String[] args) {
- Iloczyn obiekt = new Iloczyn(1, 5, 1);
- System.out.println("Wynik iloczynu: " + obiekt.Oblicz());
- }
- }
- // --------------------------------------------------------------------
- package javaz1_6;
- public class Iloczyn {
- private int a, b;
- private double x;
- public int getA() {
- return a;
- }
- public void setA(int a) {
- this.a = a;
- }
- public int getB() {
- return b;
- }
- public void setB(int b) {
- this.b = b;
- }
- public double getX() {
- return x;
- }
- public void setX(double x) {
- this.x = x;
- }
- public double Oblicz() {
- double iloczyn = 1;
- for(int m=this.a; m<=this.b; m++) {
- iloczyn *= Math.sin(m*x);
- }
- return iloczyn;
- }
- public Iloczyn(int a, int b, int x) {
- this.a = a;
- this.b = b;
- this.x = x;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement