====== My Solution on Assignment 2 - Problem 4 ====== This is my Solution of Assignment 2 - Problem 4 from the [[http://see.stanford.edu/see/courseinfo.aspx?coll=824a47e1-135f-4508-a5aa-866adcae1111|Computer Science Course CS106A of Prof. Mehran Sahami]] at the [[http://www.stanford.edu|STANFORD University]]. /* * File: PythagoreanTheorem.java * Name: Axel Werner * Section Leader: * ----------------------------- * This file is the starter file for the PythagoreanTheorem problem. */ import acm.program.*; public class PythagoreanTheorem extends ConsoleProgram { public void run() { println("PythagoreanTheorem : c² = a² + b²\n" + "======================================\n\n"); int a = readInt("Enter a Value for 'a': "); int b = readInt("Enter a Value for 'b': "); double result = Math.sqrt( (a*a) + (b*b) ); println("The Result c = sqrt(a²+b²) is: " + result ); } } --- //[[mail@awerner.homeip.net|Axel Werner]] 2012-04-02 16:05// {{tag>java karel stanford university cs106 computer science learning programming}}