3 Main
3 Main
3 Main
package package1;
int n=Integer.parseInt(args[0]);
int res=factorial(n);
System.out.println(res);
int res=1;
for(int i=x;i>1;i--) {
res=res*1;
return res;
--------------------------------------------------------------------------------------
package package1;
import java.util.Scanner;
System.out.println("value");
int n=sc.nextInt();
int res=factorial(n);
System.out.println(res);
int res=1;
for(int i=x;i>=1;i--)
res=res*i;
return res;
------------------------------------------------------------------
4)1)
Main
package Package01;
import java.util.Scanner;
class Account {
if(i>0)
id=i;
return true;
}
else
return false;
if(b>0)
balance=b;
return true;
else
return false;
return id;
return balance;
balance=balance-w;
return w;
}
public double deposite(double d)
balance=balance+d;
return d;
return balance;
--------------------------------
package Package01;
import java.util.Scanner;
int id;
double balance;
System.out.println("enter id,balance");
int i=sc.nextInt();
double b=sc.nextDouble();
if(a.setid(i)&&a.setbalance(b))
System.out.println("withdraw amount");
double w=sc.nextDouble();
a.withdraw(w);
System.out.println(a.printData());
a.deposite(b);
System.out.println(a.printData());
else
4)2)package Math;
System.out.println(p1);
System.out.println(p1.distance(10,30.5));
System.out.println(p2);
System.out.println(p1.distance(p2));
}
package Math;
public MyPoint()
this.x=0;
this.y=0;
this.x=x;
this.y=y;
}
public String toString()
String s;
s=String.format("point(%.2f,%.2f)",this.x,this.y);
return s;