ASDV-Java/Assignments/Lab10_CalebFontenot/Rounding1.html

57 lines
5.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Rounding1.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; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.string {color: #6a8759}
.number {color: #6897bb}
.comment {color: #808080}
.whitespace {color: #505050}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/Rounding1.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab10_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> Rounding1 {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args) {
System.out.println(<span class="string">&quot;</span><span class="string">Math.ceil(2.1) returns </span><span class="string">&quot;</span> + Math.ceil(<span class="number">2.1</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.ceil(2.0) returns </span><span class="string">&quot;</span> + Math.ceil(<span class="number">2.0</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.ceil(-2.0) returns </span><span class="string">&quot;</span> + Math.ceil(-<span class="number">2.0</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.ceil(-2.1) returns </span><span class="string">&quot;</span> + Math.ceil(-<span class="number">2.1</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.floor(2.1) returns </span><span class="string">&quot;</span> + Math.floor(<span class="number">2.1</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.floor(2.0) returns </span><span class="string">&quot;</span> + Math.floor(<span class="number">2.0</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.floor(-2.0) returns </span><span class="string">&quot;</span> + Math.floor(-<span class="number">2.0</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.floor(-3.0) returns </span><span class="string">&quot;</span> + Math.floor(-<span class="number">3.0</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.rint(2.1) returns </span><span class="string">&quot;</span> + Math.rint(<span class="number">2.1</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.rint(2.0) returns </span><span class="string">&quot;</span> + Math.rint(<span class="number">2.0</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.rint(-2.0) returns </span><span class="string">&quot;</span> + Math.rint(-<span class="number">2.0</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.rint(-2.1) returns </span><span class="string">&quot;</span> + Math.rint(-<span class="number">2.1</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.rint(2.5) returns </span><span class="string">&quot;</span> + Math.rint(<span class="number">2.5</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.rint(-2.5) returns </span><span class="string">&quot;</span> + Math.rint(-<span class="number">2.5</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.round(-2.6f) returns </span><span class="string">&quot;</span> + Math.round(-<span class="number">2.6f</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.round(2.0) returns </span><span class="string">&quot;</span> + Math.round(<span class="number">2.0</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.round(-2.0) returns </span><span class="string">&quot;</span> + Math.round(-<span class="number">2.0</span>));
System.out.println(<span class="string">&quot;</span><span class="string">Math.round(-2.6) returns </span><span class="string">&quot;</span> + Math.round(-<span class="number">2.6</span>));
}
}
</pre></body>
</html>