70 lines
4.0 KiB
HTML
70 lines
4.0 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Vehicle.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}
|
||
|
.ST2 {color: #9876aa}
|
||
|
.ST3 {color: #ffc66d}
|
||
|
.string {color: #6a8759}
|
||
|
.comment {color: #808080}
|
||
|
.whitespace {color: #505050}
|
||
|
.ST1 {color: #808080; font-family: monospace; font-weight: bold}
|
||
|
.ST0 {color: #287bde}
|
||
|
.literal {color: #cc7832}
|
||
|
.ST4 {font-family: monospace; font-style: italic}
|
||
|
-->
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/Exam2-Practice2_CalebFontenot/src/main/java/com/calebfontenot/exam2/practice2_calebfontenot/Vehicle.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.exam2.practice2_calebfontenot;
|
||
|
|
||
|
<span class="literal">import</span> java.util.Objects;
|
||
|
|
||
|
<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">abstract</span> <span class="literal">public</span> <span class="literal">class</span> Vehicle <span class="literal">implements</span> Cloneable, Comparable<Vehicle> {
|
||
|
|
||
|
<span class="literal">private</span> String <span class="ST2">vin</span>;
|
||
|
<span class="literal">public</span> Vehicle(){}
|
||
|
<span class="literal">public</span> Vehicle(String vin) {<span class="literal">this</span>.<span class="ST2">vin</span> = vin;}
|
||
|
<span class="literal">public</span> String <span class="ST3">getVin</span>() { <span class="literal">return</span> <span class="ST2">vin</span>; }
|
||
|
<span class="literal">public</span> <span class="literal">void</span> <span class="ST3">setVin</span>(String vin) { <span class="literal">this</span>.<span class="ST2">vin</span> = vin; }
|
||
|
|
||
|
@Override
|
||
|
<span class="literal">public</span> String <span class="ST3">toString</span>()
|
||
|
{ <span class="literal">return</span> <span class="string">"</span><span class="string">Vehicle{</span><span class="string">"</span> + <span class="string">"</span><span class="string">vin=</span><span class="string">"</span> + <span class="ST2">vin</span> + <span class="string">'</span><span class="string">}</span><span class="string">'</span>; }
|
||
|
|
||
|
@Override
|
||
|
<span class="literal">public</span> <span class="literal">boolean</span> <span class="ST3">equals</span>(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> Vehicle other = (Vehicle) obj;
|
||
|
<span class="literal">return</span> Objects.<span class="ST4">equals</span>(<span class="literal">t</span><span class="literal">his</span>.<span class="ST2">vin</span>, other.<span class="ST2">vin</span>);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
</pre></body>
|
||
|
</html>
|