From 479acd7bdc5e9f25c6acd0d90ebbd88870431a41 Mon Sep 17 00:00:00 2001 From: priya-arun-815 Date: Sun, 6 Oct 2024 22:53:25 -0400 Subject: [PATCH 1/4] Added minmax calculation --- MinMaxCalculation.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 MinMaxCalculation.java diff --git a/MinMaxCalculation.java b/MinMaxCalculation.java new file mode 100644 index 00000000..9db84fe2 --- /dev/null +++ b/MinMaxCalculation.java @@ -0,0 +1,25 @@ +public class MinMaxCalculation { + public static void main(String[] args) { + int[] num = {45, 23, 8, 12, 20}; + int min = num[0]; + int max = num[0]; + + for (int n : num) { + if (n < min) { + min = n; + } + if (n > max) { + max = n; + } + } + + System.out.print("The given set of numbers is: "); + for (int n : num) { + System.out.print(n + " "); + } + System.out.println(); + + System.out.println("Minimum of the numbers is : " + min); + System.out.println("Maximum of the given numbers is : " + max); + } +} \ No newline at end of file From 1db3f5b1549e28d554803a2999ff8a655b23f5b9 Mon Sep 17 00:00:00 2001 From: priya-arun-815 Date: Mon, 7 Oct 2024 12:45:12 -0400 Subject: [PATCH 2/4] Add MinMaxCalculation.class --- MinMaxCalculation.class | Bin 0 -> 1332 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 MinMaxCalculation.class diff --git a/MinMaxCalculation.class b/MinMaxCalculation.class new file mode 100644 index 0000000000000000000000000000000000000000..ae17800fc1966a28fa0732d1b1dd7aa12e1d120a GIT binary patch literal 1332 zcmaJ>&rcIU6#j;8cS>EQ)NT=_x+*9Iq5edrf<_EVLM=%NrZF)Y$_NYXZquEj+&y{n z=)sdQQIC4igc$z-{|7Jr6~q|z&6dQH5;xhIw{O1p-hAJ@*>AtMzXF)TtvI?6;V>*j zVKOAv#iqzrg}0h3F0adqVlZ#Go~x!ABE#9GZp6^d5w~yv)*g6iD^RjVD8ETT_I#Mg z^>Ygi*Hb0ckfN54;SfV+aZNg_?xysdKq|+7?0C)EvTOv78%#QJB+$!|v~UMJFq>`jqn&TuxZ^88n;^~a2R+?3zT;F3bX8aY&&@=CP@_xu` zQ7l)*?W#omI0-3ocH~WW2fv!)wMQK$WDE@#qVFHm0AM?CqcLAHkCcKcS~1FtZy-0Gn^a1_%|#{2w?wz^5n-PoiDxuF zM+z^H#w%*zcQ}GGlw}m=AL?t)ah4;?SU3Q`kY+y-+d=dR literal 0 HcmV?d00001 From 815d97237d43a10fd53dcd4e89fea5f79008b9bf Mon Sep 17 00:00:00 2001 From: Yuriy Brun Date: Sat, 28 Oct 2017 21:24:52 -0400 Subject: [PATCH 3/4] Updated the test command Updated README.md Added minmax calculation Add MinMaxCalculation.class --- MinMaxCalculation.class | Bin 0 -> 1332 bytes MinMaxCalculation.java | 25 +++++++++++++++++++++++++ README.md | 40 ++++++++++++++++++++++++++++------------ 3 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 MinMaxCalculation.class create mode 100644 MinMaxCalculation.java diff --git a/MinMaxCalculation.class b/MinMaxCalculation.class new file mode 100644 index 0000000000000000000000000000000000000000..ae17800fc1966a28fa0732d1b1dd7aa12e1d120a GIT binary patch literal 1332 zcmaJ>&rcIU6#j;8cS>EQ)NT=_x+*9Iq5edrf<_EVLM=%NrZF)Y$_NYXZquEj+&y{n z=)sdQQIC4igc$z-{|7Jr6~q|z&6dQH5;xhIw{O1p-hAJ@*>AtMzXF)TtvI?6;V>*j zVKOAv#iqzrg}0h3F0adqVlZ#Go~x!ABE#9GZp6^d5w~yv)*g6iD^RjVD8ETT_I#Mg z^>Ygi*Hb0ckfN54;SfV+aZNg_?xysdKq|+7?0C)EvTOv78%#QJB+$!|v~UMJFq>`jqn&TuxZ^88n;^~a2R+?3zT;F3bX8aY&&@=CP@_xu` zQ7l)*?W#omI0-3ocH~WW2fv!)wMQK$WDE@#qVFHm0AM?CqcLAHkCcKcS~1FtZy-0Gn^a1_%|#{2w?wz^5n-PoiDxuF zM+z^H#w%*zcQ}GGlw}m=AL?t)ah4;?SU3Q`kY+y-+d=dR literal 0 HcmV?d00001 diff --git a/MinMaxCalculation.java b/MinMaxCalculation.java new file mode 100644 index 00000000..9db84fe2 --- /dev/null +++ b/MinMaxCalculation.java @@ -0,0 +1,25 @@ +public class MinMaxCalculation { + public static void main(String[] args) { + int[] num = {45, 23, 8, 12, 20}; + int min = num[0]; + int max = num[0]; + + for (int n : num) { + if (n < min) { + min = n; + } + if (n > max) { + max = n; + } + } + + System.out.print("The given set of numbers is: "); + for (int n : num) { + System.out.print(n + " "); + } + System.out.println(); + + System.out.println("Minimum of the numbers is : " + min); + System.out.println("Maximum of the given numbers is : " + max); + } +} \ No newline at end of file diff --git a/README.md b/README.md index e9c8fbc2..ca10b1a7 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,45 @@ # Basic Statistics -A Java-based implementation for computing statistics on a set of numbers. +Basic Statistics is a Java-based implementation for computing statistics on a set of numbers. This implementation is intended to be used in software engineering courses as a subject software system. -How to build and run tests from the terminal: +Basic Statistics uses the Apache Ant build system. **Make sure that you have [Ant](https://ant.apache.org) installed.** -1. Basic Statistics uses Apache Ant. Make sure that you have Ant installed. https://ant.apache.org/ +#### How to build Basic Statistics and run its tests from the terminal: -2. cd into the Basic Statistics root directory, which contains the `build.xml` build file. +1. Change into the Basic Statistics root directory, which contains the *build.xml* build file. -3. Run `ant` to compile Basic Statistics. +2. Run `ant compile` to compile Basic Statistics. The compiled class files will be in the *bin* directory. -4. The compiled Basic Statistics class files will be in the `bin` directory. +4. Run `ant test` to run all Basic Statistics unit tests. -5. Run `ant test` to run all Basic Statistics unit tests. +5. Run `ant clean` whenever you want to clean up the project (i.e., delete all generated files). -6. Whenever you want to clean up the project, run `ant clean` +#### How to run Basic Statistics from the terminal: -How to run Basic Statistics (from the terminal): +1. After building the project (i.e., running `ant compile`), run: `java -cp bin BasicStats`. The application's GUI will show up. -1. After building the project (i.e., running `ant`), cd into the `bin` directory and run: `java BasicStats`. The application's GUI will show up. - -Program features: +#### Program features: * Displays a set of entered numbers. * Computes the mean of the set of numbers. * Computes the median of the set of numbers. * Computes the mode of the set of numbers. + +## Troubleshooting + +#### Outdated version of JUnit +If your system uses an outdated version of JUnit, you may encounter the following error: +``` +[junit] junit/framework/JUnit4TestAdapterCache +[junit] java.lang.NoClassDefFoundError: junit/framework/JUnit4TestAdapterCache +``` +Run `ant -lib lib/ ` to explicitly use JUnit4, which is provided in the *lib* directory. For example, run `ant -lib lib/ test` to run all Basic Statistics unit tests. + +#### Java JDK not installed or misconfigured +If a Java JDK is not installed or properly configured on your system, you may encounter the following error: +``` +BUILD FAILED +build.xml:17 Unable to find a javac compiler; +``` +Make sure that you have a JDK installed and that the JAVA_HOME environment variable is properly set. From 9620bedf81dbe24cae4227ce07e7518248f80318 Mon Sep 17 00:00:00 2001 From: priya-arun-815 Date: Mon, 7 Oct 2024 21:02:20 -0400 Subject: [PATCH 4/4] Further updates to README.md after first reset --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index ca10b1a7..549ac46c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +#Editing the 2nd time after git reset. +#Editing README.md file for reset exercise. + # Basic Statistics Basic Statistics is a Java-based implementation for computing statistics on a set of numbers.