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:// | ||
+ | |||
+ | <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(" | ||
+ | " | ||
+ | |||
+ | int a = readInt(" | ||
+ | int b = readInt(" | ||
+ | |||
+ | double result = Math.sqrt( (a*a) + (b*b) ); | ||
+ | |||
+ | println(" | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | --- // | ||
+ | |||
+ | {{tag> | ||