This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The reason I created this was two-fold. 1. To learn Java 2. To learn about numerical analysis and numerical methods of arithmetic. | |
This code shows that the Babylonian Method of computing square roots is as accurate as the Java numerical method using sqrt() after as few | |
as 10 iterations for numbers within the limits of a double. I'm certain that it can be improved (and I have no vanity of authorship i.e., I welcome | |
criticism [email protected]). I love learning and sharing what I find, if you have some math-related code you're itching to share please | |
let me know! | |
There are numerous methods for computing square roots (http://en.wikipedia.org/wiki/Methods_of_computing_square_roots). | |
"The basic idea is that if x is an overestimate to the square root of a non-negative real number S then S/x will be an underestimate and so the average | |
of these two numbers may reasonably be expected to provide a better approximation." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The reason I created this was two-fold. 1. To learn Java 2. To learn about numerical analysis and numerical methods of arithmetic. | |
This code shows that the Babylonian Method of computing square roots is as accurate as the Java numerical method using sqrt() after as few | |
as 10 iterations for numbers within the limits of a double. I'm certain that it can be improved (and I have no vanity of authorship i.e., I welcome | |
criticism [email protected]). I love learning and sharing what I find, if you have some math-related code you're itching to share please | |
let me know! | |
There are numerous methods for computing square roots (http://en.wikipedia.org/wiki/Methods_of_computing_square_roots). | |
"The basic idea is that if x is an overestimate to the square root of a non-negative real number S then S/x will be an underestimate and so the average | |
of these two numbers may reasonably be expected to provide a better approximation." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.JOptionPane; | |
import java.io.*; | |
import static java.lang.Math.*; | |
public class BabylonianSqrt6 { | |
public static void main(String[] args) { | |
String S; | |
S = JOptionPane.showInputDialog(null, "Enter a Whole Integer"); | |
int SigFigs = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! | |
! Last configuration change at 22:42:44 UTC Thu Jun 7 2012 by joe | |
upgrade fpd auto | |
version 15.1 | |
service timestamps debug datetime msec | |
service timestamps log datetime msec | |
service password-encryption | |
! | |
hostname cisco1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************** | |
* HelloGUI.java | |
* Aaron P. Clark | |
* | |
* One of the last programs of the chapter. Exhibits | |
* the use of the JOPtionPane GUI | |
***********************************************/ | |
import javax.swing.JOptionPane; | |
public class HelloGUI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************** | |
* CirclePrompt.java | |
* Aaron P. Clark | |
* | |
* Created to understand java.util.Scanner and Ch 2. | |
* shows the area of a circle if you say it's your | |
* favorite shape when prompted. See P.32 in our | |
* text for the pseudocode | |
***********************************************/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************** | |
* HappyBirthday.java | |
* Aaron P. Clark | |
* | |
* Based on the pseudocode while loop on p.37 in Ch 2. | |
* prints "Happy birthday!" 100x | |
***********************************************/ | |
public class HappyBirthday | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************** | |
* printLoop.java | |
* Aaron P. Clark | |
* | |
* Created from pseudocode in Ch. 2 of Park Univ. | |
* book. I wanted to figure out how to print something | |
* a given number of times. | |
***********************************************/ | |
// Created from pseudocode in Ch. 2 of Park University book. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************** | |
* whileLoop.java | |
* Aaron P. Clark | |
* | |
* I created this for Park programming calss to learn | |
* how to accept command-line input in a loop | |
***********************************************/ | |
import java.util.Scanner; | |
public class whileLoop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************** | |
* WhileLoopSentinalValue.java | |
* Aaron P. Clark | |
* | |
* Based on the pseudocode while loop on p.40 in Ch 2. | |
* Takes scores and computes average. | |
***********************************************/ | |
import java.util.Scanner; | |
OlderNewer