new semester, new repo structure
This commit is contained in:
76
Semester 1/ZIPs/Lab5/Operators.html
Normal file
76
Semester 1/ZIPs/Lab5/Operators.html
Normal file
@@ -0,0 +1,76 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Operators.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}
|
||||
.ST1 {color: #808080; font-family: monospace; font-weight: bold}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.ST2 {color: #ffc66d; font-family: monospace; font-style: italic}
|
||||
.ST3 {color: #9876aa; font-family: monospace; font-style: italic}
|
||||
.number {color: #6897bb}
|
||||
.string {color: #6a8759}
|
||||
.ST0 {color: #287bde}
|
||||
.literal {color: #cc7832}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/caleb/NetBeansProjects/ADSV Java/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Operators.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.lab5_calebfontenot;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> Operators {
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args)
|
||||
{
|
||||
<span class="literal">int</span> x = <span class="number">8</span>; <span class="literal">int</span> y = <span class="number">15</span>; <span class="literal">double</span> d = <span class="number">2</span>;
|
||||
|
||||
<span class="comment">//1. Increment x by 2;</span>
|
||||
<span class="comment">//add code here</span>
|
||||
x += <span class="number">2</span>;
|
||||
|
||||
<span class="comment">//2. Increment y by 5 using the += operator</span>
|
||||
<span class="comment">//add code here</span>
|
||||
y += <span class="number">5</span>;
|
||||
|
||||
<span class="comment">//3. Increment d by 1 using the ++ operator</span>
|
||||
<span class="comment">//add code here</span>
|
||||
d++;
|
||||
|
||||
<span class="comment">//4. Modify the expression below to print z1 = 1.5 and not 0.0</span>
|
||||
<span class="literal">double</span> z1 = ((<span class="literal">double</span>) x /(<span class="literal">double</span>) y ) * d++;
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">z1: </span><span class="string">"</span> + z1 );
|
||||
|
||||
<span class="comment">//5. Modify the expresion below the print z2 = 2.5 and not 0.0</span>
|
||||
<span class="literal">double</span> z2 = ((<span class="literal">double</span>) x /(<span class="literal">double</span>) y ) * ++d;
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">z2: </span><span class="string">"</span> + z2 );
|
||||
|
||||
<span class="comment">/* 6. Declare a variable z3 of type double and modify the </span>
|
||||
<span class="comment"> right hand side of the expression you built in step 5 for the</span>
|
||||
<span class="comment"> expression to evaluate 2.0.</span>
|
||||
<span class="comment"> Assign the evaluation to varible z3</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">double</span> z3 = ((<span class="literal">double</span>) x /(<span class="literal">double</span>) y * (d - <span class="number">1</span>));
|
||||
<span class="comment">//add code here</span>
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">z3: </span><span class="string">"</span>+ z3 );
|
||||
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">x=</span><span class="string">"</span> + x + <span class="string">"</span><span class="string"> y=</span><span class="string">"</span> + y + <span class="string">"</span><span class="string"> d=</span><span class="string">"</span> + d +
|
||||
<span class="string">"</span><span class="string"> z1=</span><span class="string">"</span>+ z1 + <span class="string">"</span><span class="string"> z2=</span><span class="string">"</span> +z2 + <span class="string">"</span><span class="string"> z3=</span><span class="string">"</span> +z3);
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
Reference in New Issue
Block a user