Name : Shreyal Mandot
Title : Assignment2b1.Create a package named Maths. Define class MathsOperations with static methods to find the maximum and minimum of three numbers. Create another package Stats. Define class StatsOperations with methods to find the average and median of three numbers. Use these methods in main to perform operations on three integers accepted using command line arguments.
import maths.*;
import stat.*;
import java.io.*;
public class ass2b1
{
public static void main(String args[])
{
int a,b,c;
a=Integer.parseInt(args[0]);
b=Integer.parseInt(args[1]);
c=Integer.parseInt(args[2]);
mathoperation.max_min(a,b,c);
statoperation.average(a,b,c);
}
}
/*
Output-
[prady@localhost setB]$ javac ass2b1.java
[prady@localhost setB]$ java ass2b1 1 3 4
Maximum No : 4
Minimum No : 1
Average Of Three Nos : 2
Median : 3
*/
No comments:
Post a Comment