From a30198e18dcc09ee0a593505961189c4226e4076 Mon Sep 17 00:00:00 2001
From: Brady James Garvin <bgarvin@cse.unl.edu>
Date: Wed, 16 Jan 2019 11:27:07 -0600
Subject: [PATCH] Converted whitespace for better display on GitLab.
---
.../TriangleClassifier.java | 50 +++++++++----------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/src/main/java/edu/unl/cse/soft160/triangle_classifier/TriangleClassifier.java b/src/main/java/edu/unl/cse/soft160/triangle_classifier/TriangleClassifier.java
index 19d0897..b2613db 100644
--- a/src/main/java/edu/unl/cse/soft160/triangle_classifier/TriangleClassifier.java
+++ b/src/main/java/edu/unl/cse/soft160/triangle_classifier/TriangleClassifier.java
@@ -6,32 +6,32 @@ public class TriangleClassifier {
public enum Classification {
INVALID, EQUILATERAL, ISOSCELES, RIGHT, SCALENE,
}
-
+
public static Classification classify(int a, int b, int c) { // buggy
- if (a * b * c < 0) {
- return Classification.INVALID;
- }
- if (a == b && b == c) {
- return Classification.EQUILATERAL;
- }
- if (a == b || b == c) {
- return Classification.ISOSCELES;
- }
- int maximum = a;
- if (b > maximum) {
- maximum = b;
- if (c > maximum) {
- maximum = c;
- }
- }
- double semiperimeter = a + b + c / 2.0;
- if (maximum > semiperimeter) {
- return Classification.INVALID;
- }
- if (a * a + b * b == c * c || b * b + a * a == c * c || c * c + b * b == a * a) {
- return Classification.RIGHT;
- }
- return Classification.SCALENE;
+ if (a * b * c < 0) {
+ return Classification.INVALID;
+ }
+ if (a == b && b == c) {
+ return Classification.EQUILATERAL;
+ }
+ if (a == b || b == c) {
+ return Classification.ISOSCELES;
+ }
+ int maximum = a;
+ if (b > maximum) {
+ maximum = b;
+ if (c > maximum) {
+ maximum = c;
+ }
+ }
+ double semiperimeter = a + b + c / 2.0;
+ if (maximum > semiperimeter) {
+ return Classification.INVALID;
+ }
+ if (a * a + b * b == c * c || b * b + a * a == c * c || c * c + b * b == a * a) {
+ return Classification.RIGHT;
+ }
+ return Classification.SCALENE;
}
public static void main(String... arguments) {
--
GitLab