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

95 lines
4.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>SpeedBike.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}
.string {color: #6a8759}
.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/SpeedBike.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> SpeedBike <span class="literal">extends</span> Bicycle
{
@Override
<span class="literal">public</span> <span class="literal">int</span> hashCode()
{
<span class="literal">int</span> hash = <span class="number">5</span>;
<span class="literal">return</span> hash;
}
@Override
<span class="literal">public</span> <span class="literal">boolean</span> equals(Object obj)
{
<span class="literal">if</span> (<span class="literal">this</span> == obj) {
<span class="literal">return</span> <span class="literal">true</span>;
}
<span class="literal">if</span> (obj == <span class="literal">null</span>) {
<span class="literal">return</span> <span class="literal">false</span>;
}
<span class="literal">if</span> (getClass() != obj.getClass()) {
<span class="literal">return</span> <span class="literal">false</span>;
}
<span class="literal">final</span> SpeedBike other = (SpeedBike) obj;
System.out.println(<span class="string">&quot;</span><span class="string">Super returns: </span><span class="string">&quot;</span> + <span class="literal">super</span>.equals(obj));
<span class="literal">return</span> Double.doubleToLongBits(<span class="literal">this</span>.weight) == Double.doubleToLongBits(other.weight) &amp;&amp; <span class="literal">super</span>.equals(obj);
}
<span class="literal">private</span> <span class="literal">double</span> weight;
<span class="literal">public</span> SpeedBike(<span class="literal">double</span> weight, <span class="literal">int</span> cadence, <span class="literal">int</span> gear, <span class="literal">int</span> speed)
{
<span class="literal">super</span>(cadence, gear, speed);
<span class="literal">this</span>.weight = weight;
}
<span class="literal">public</span> <span class="literal">double</span> getWeight()
{
<span class="literal">return</span> weight;
}
<span class="literal">public</span> <span class="literal">void</span> setWeight(<span class="literal">double</span> weight)
{
<span class="literal">this</span>.weight = weight;
}
@Override
<span class="literal">public</span> String toString()
{
<span class="literal">return</span> <span class="literal">super</span>.toString() + <span class="string">&quot;</span><span class="string"> SpeedBike{</span><span class="string">&quot;</span> + <span class="string">&quot;</span><span class="string">weight=</span><span class="string">&quot;</span> + weight + <span class="string">&#39;</span><span class="string">}</span><span class="string">&#39;</span>;
}
@Override
Details calculatedDetails()
{
<span class="literal">return</span> Details.getDetails(<span class="literal">this</span>);
}
}
</pre></body>
</html>