ASDV-Java/Semester 1/Exams/Exam1Practice_CalebFontenot/TrianglePerimeter.html

62 lines
3.2 KiB
HTML
Executable File

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TrianglePerimeter.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #000000; background-color: #ffffff; font-family: monospace}
pre {color: #000000; background-color: #ffffff; font-family: monospace}
table {color: #404040; background-color: #e9e8e2; font-family: monospace}
.ST1 {color: #969696; font-family: monospace; font-weight: bold}
.ST2 {font-family: monospace; font-weight: bold}
.comment {color: #969696}
.ST3 {font-family: monospace; font-weight: bold; font-style: italic}
.ST4 {color: #ce54b8; font-family: monospace; font-style: italic}
.ST0 {color: #287bde}
.string {color: #1e9347}
.literal {color: #336bdd}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\Exam1_CalebFontenot\src\main\java\com\calebfontenot\exam1_calebfontenot\TrianglePerimeter.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.exam1_calebfontenot;
<span class="literal">import</span> java.util.Scanner;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">ar114</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> <span class="ST2">TrianglePerimeter</span> {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST3">main</span>(String[] args) {
<span class="comment">// Create scanner</span>
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST4">in</span>);
<span class="comment">// Define variables</span>
<span class="literal">int</span> triEdge1, triEdge2, triEdge3;
<span class="comment">// Prompt for input</span>
System.<span class="ST4">out</span>.print(<span class="string">&quot;</span><span class="string">Enter 3 edges for a triangle: </span><span class="string">&quot;</span>);
triEdge1 = input.nextInt();
triEdge2 = input.nextInt();
triEdge3 = input.nextInt();
<span class="comment">// Compute and print output</span>
System.<span class="ST4">out</span>.println(((triEdge1 + triEdge2) &gt; triEdge3) ||
((triEdge1 + triEdge3) &gt; triEdge2) ||
((triEdge2 + triEdge3) &gt; triEdge1) ?
<span class="string">&quot;</span><span class="string">Input is valid</span><span class="string">&quot;</span> : <span class="string">&quot;</span><span class="string">Invalid Input</span><span class="string">&quot;</span>);
}
}
</pre></body>
</html>