85 lines
4.1 KiB
HTML
85 lines
4.1 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>ChildBike.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}
|
||
|
.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/ChildBike.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> ChildBike <span class="literal">extends</span> Bicycle <span class="comment">//remove comment in front of extends</span>
|
||
|
{
|
||
|
@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> ChildBike other = (ChildBike) obj;
|
||
|
System.out.println(<span class="string">"</span><span class="string">Super returns: </span><span class="string">"</span> + <span class="literal">super</span>.equals(obj));
|
||
|
<span class="literal">return</span> <span class="literal">this</span>.helpWheels == other.helpWheels && <span class="literal">super</span>.equals(obj);
|
||
|
}
|
||
|
|
||
|
<span class="literal">private</span> <span class="literal">boolean</span> helpWheels;
|
||
|
|
||
|
<span class="literal">public</span> ChildBike(<span class="literal">boolean</span> helpWheels, <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>.helpWheels = helpWheels;
|
||
|
}
|
||
|
|
||
|
<span class="literal">public</span> <span class="literal">boolean</span> isHelpWheels()
|
||
|
{
|
||
|
<span class="literal">return</span> helpWheels;
|
||
|
}
|
||
|
|
||
|
<span class="literal">public</span> <span class="literal">void</span> setHelpWheels(<span class="literal">boolean</span> helpWheels)
|
||
|
{
|
||
|
<span class="literal">this</span>.helpWheels = helpWheels;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
Details calculatedDetails()
|
||
|
{
|
||
|
<span class="literal">return</span> Details.getDetails(<span class="literal">this</span>);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
<span class="literal">public</span> String toString()
|
||
|
{
|
||
|
<span class="literal">return</span> <span class="literal">super</span>.toString() + <span class="string">"</span><span class="string">ChildBike{</span><span class="string">"</span> + <span class="string">"</span><span class="string">helpWheels=</span><span class="string">"</span> + helpWheels + <span class="string">'</span><span class="string">}</span><span class="string">'</span>;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
</pre></body>
|
||
|
</html>
|