# Axel Werner's OPEN SOURCE Knowledge Base

### Site Tools

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

# My Solution on Assignment 2 - Problem 4

This is my Solution of Assignment 2 - Problem 4 from the Computer Science Course CS106A of Prof. Mehran Sahami at the STANFORD University.

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 );
}
}```

Axel Werner 2012-04-02 16:05

it-artikel/java/my-solution-on-assignment-2-problem-4.txt · Last modified: 2019-05-18 14:28 by mail@awerner.myhome-server.de