User Tools

Site Tools


it-artikel:java:my-solution-on-assignment-2-problem-4

Differences

This shows you the differences between two versions of the page.


it-artikel:java:my-solution-on-assignment-2-problem-4 [2022-08-31 12:30] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== 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]]. 
 +
 +<code java PythagoreanTheorem.java>
 +/*
 + * 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 );
 + }
 +}
 +</code>
 +
 +
 + --- //[[mail@awerner.homeip.net|Axel Werner]] 2012-04-02 16:05//
 +
 +{{tag>java karel stanford university cs106 computer science learning programming}}