[Go to site: main page, start]

0% found this document useful (0 votes)
7 views1 page

Java Math Operations Source Code

This document contains source code for a Java application that performs several math calculations: 1) Methods to calculate harmonic series and factorials. 2) A bubble sort method to sort arrays. 3) A method to convert decimals to binary. 4) The application uses JTextFields for input/output and action listeners to trigger the calculations.

Uploaded by

Raveen Vasudeva
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Java Math Operations Source Code

This document contains source code for a Java application that performs several math calculations: 1) Methods to calculate harmonic series and factorials. 2) A bubble sort method to sort arrays. 3) A method to convert decimals to binary. 4) The application uses JTextFields for input/output and action listeners to trigger the calculations.

Uploaded by

Raveen Vasudeva
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Zip file containing source code Zip file containing executable jar file

Math:
JTextField In 1-3

JTextField Out 1-3 Math calculations for: Harmonics Factorial Bubble Sort Convert Decimal to Binary

Harmonics: Methods for (int i = 1; i <= input; i++) { result += (1/(double) i); Action Listener: if ([Link]()==input){ s = [Link](); q = [Link](s); r = findHarmonic(q); s = [Link](r);

Factorial: Methods for (int i = 1; i <= input; i++) { result *= ((double)i); } Action Listener: if ([Link]()==input){ s = [Link](); q = [Link](s); r = findFactorial(q); s = [Link](r);

Bubble Sort: Methods for (int pass=1; pass<n; pass++){ for (int i=0; i<n-pass; i++){ if (a[i]>a[i+1]){ temp= a[i]; a[i]=a[i+1]; a[i+1] = temp; } } } Action Listener: s=[Link](); [Link](s); [Link]([Link]); [Link](p.int_values); out= p.convertInt_String(p.int_values); [Link](out);

Convert Decimal to Bonary: Methods while(num > 0) { rem = num % 10; num = num / 10; if(rem != 0 && rem != 1)// checks to see if input is binary { [Link]( null,"This is not a binary number. / n Please Try again"); } } int i= [Link](str,2); String s= "" +i; Action Listener: [Link](IntToBin([Link]( )));

[Link](s); }

[Link](s); }

You might also like