ASDV-Java/Assignments/lab9_CalebFontenot/MinimumOf4ConditionalOperat...

71 lines
3.2 KiB
HTML

2022-09-21 20:40:27 +07:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>MinimumOf4ConditionalOperator.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
table {color: #888888; background-color: #313335; font-family: monospace}
.ST0 {color: #808080; font-family: monospace; font-weight: bold}
.comment {color: #808080}
.whitespace {color: #505050}
.string {color: #6a8759}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/NetBeansProjects/ADSV Java/lab9_CalebFontenot/src/main/java/com/calebfontenot/lab9_calebfontenot/MinimumOf4ConditionalOperator.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * To change this license header, choose License Headers in Project Properties.</span>
<span class="comment"> * To change this template file, choose Tools | Templates</span>
<span class="comment"> * and open the template in the editor.</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab9_calebfontenot;
<span class="literal">import</span> java.util.Scanner;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST0">@author</span> <span class="comment">ASDV2</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> MinimumOf4ConditionalOperator {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
{
Scanner scan = <span class="literal">new</span> Scanner(System.in);
<span class="literal">while</span> (<span class="literal">true</span>) {
System.out.println(<span class="string">&quot;</span><span class="string">Please enter 4 numbers to find the minimum of the 4: </span><span class="string">&quot;</span>);
<span class="literal">int</span> _1 = scan.nextInt();
<span class="literal">int</span> _2 = scan.nextInt();
<span class="literal">int</span> _3 = scan.nextInt();
<span class="literal">int</span> _4 = scan.nextInt();
System.out.println(<span class="string">&quot;</span><span class="string">minimum= </span><span class="string">&quot;</span>
+ ((_1 &lt; _4)
? (_1 &lt; _3)
? (_1 &lt; _2)
? _1
: _2
: (_3 &lt; _2)
? _3
: _2
: (_4 &lt; _3)
? (_4 &lt; _2)
? _4
: _2
: (_3 &lt; _2)
? _3
: _2)
);
scan.next();
}
}
}
</pre></body>
</html>