ASDV-Java/Semester 2/Assignments/MP4_CalebFontenot/Printed HTMLs/Details.html
2023-03-21 06:50:57 -05:00

82 lines
3.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Details.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}
.literal {color: #cc7832}
.number {color: #6897bb}
.comment {color: #808080}
.whitespace {color: #505050}
.ST0 {color: #808080; font-family: monospace; font-weight: bold}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/MP4_CalebFontenot/src/main/java/com/calebfontenot/mp4_calebfontenot/Details.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> com.calebfontenot.mp4_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST0">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> Details {
<span class="literal">private</span> <span class="literal">int</span> rank;
<span class="literal">private</span> String info;
<span class="literal">public</span> <span class="literal">int</span> getRank()
{
<span class="literal">return</span> rank;
}
<span class="literal">public</span> String getInfo()
{
<span class="literal">return</span> info;
}
<span class="literal">public</span> <span class="literal">static</span> Details getDetails(Bicycle b)
{
Details d = <span class="literal">new</span> Details();
<span class="literal">if</span> (b <span class="literal">instanceof</span> SpeedBike) {
<span class="literal">if</span> (((SpeedBike) b).getWeight() &lt; <span class="number">1</span>) {
d.rank = <span class="number">10</span>;
} <span class="literal">else</span> <span class="literal">if</span> (((SpeedBike) b).getWeight() &gt; <span class="number">1</span> &amp;&amp; ((SpeedBike) b).getWeight() &lt; <span class="number">8</span>) {
d.rank = <span class="number">9</span>;
} <span class="literal">else</span> {
d.rank = <span class="number">0</span>;
}
} <span class="literal">else</span> <span class="literal">if</span> (b <span class="literal">instanceof</span> MountainBike) {
<span class="literal">if</span> (((MountainBike) b).getSeatHeight() &gt; <span class="number">2</span>) {
d.rank = <span class="number">10</span>;
} <span class="literal">else</span> {
d.rank = <span class="number">0</span>;
}
} <span class="literal">else</span> <span class="literal">if</span> (b <span class="literal">instanceof</span> ChildBike) {
<span class="literal">if</span> (((ChildBike) b).isHelpWheels()) {
d.rank = <span class="number">10</span>;
} <span class="literal">else</span> {
d.rank = <span class="number">0</span>;
}
} <span class="literal">else</span> {
<span class="literal">return</span> <span class="literal">null</span>;
}
d.info = b.toString();
<span class="literal">return</span> d;
}
}
</pre></body>
</html>