first commit
This commit is contained in:
38
CS1322/p0/HelloWorld.java
Normal file
38
CS1322/p0/HelloWorld.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* <PRE>
|
||||
* HelloWorld.java
|
||||
* Class HelloWorld - A Class to welcome me into
|
||||
* the world of Java programming by outputting
|
||||
* HelloWorld.
|
||||
*
|
||||
* Revisions: 1.0 Aug. 26, 2002
|
||||
* Created the HelloWorld class
|
||||
* 1.1 Aug. 26, 2002
|
||||
* Finished, Compiled, Tested
|
||||
* </PRE>
|
||||
*
|
||||
* Collaboration Statement:
|
||||
* I worked on the homework assignment alone, using only
|
||||
* course materials.
|
||||
*
|
||||
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
||||
* @version Version 1.1, Aug. 26, 2002
|
||||
*/
|
||||
|
||||
public class HelloWorld {
|
||||
|
||||
|
||||
/**
|
||||
* Prints Hello World! on the screen
|
||||
*
|
||||
* <br><br>
|
||||
* @param args IGNORED
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
//Display " Hello World!"
|
||||
System.out.println("Hello World!");
|
||||
|
||||
}// end of main(String[] args)
|
||||
|
||||
}// end of class HelloWorld
|
||||
120
CS1322/p0/P0Phase3.java
Normal file
120
CS1322/p0/P0Phase3.java
Normal file
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* CS1322: Programming Assignment #0 - Fall 2002
|
||||
*
|
||||
* <PRE>
|
||||
* P0Phase3.java
|
||||
* Class P0Phase3 - A class designed to learn methods and
|
||||
* casting, as well as working with expressions.
|
||||
*
|
||||
* Revisions: 1.0 Aug. 26, 2002
|
||||
* Created the P0Phase3 class
|
||||
*
|
||||
* 1.1 Aug. 26, 2002
|
||||
* Finished, Compiled, Tested
|
||||
*
|
||||
* </PRE>
|
||||
*
|
||||
* Collaboration Statement:
|
||||
* I worked on the homework assignment alone, using only
|
||||
* course materials.
|
||||
*
|
||||
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
||||
* @version Version 1.1, Aug. 26, 2002
|
||||
*/
|
||||
|
||||
public class P0Phase3 {
|
||||
|
||||
///////////
|
||||
//Methods//
|
||||
///////////
|
||||
|
||||
/**
|
||||
* Truncate double value into an int
|
||||
*
|
||||
* <br><br>
|
||||
* @param d, value to be truncated
|
||||
* @return truncated value d
|
||||
*/
|
||||
public int roundOff(double d){
|
||||
return ((int) d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Divide dividend by divisor
|
||||
*
|
||||
* <br><br>
|
||||
* @param dividend, value to be divided
|
||||
* @param divisor, parts that the divisor will be split into
|
||||
* @return quotient of dividend and divisor
|
||||
*/
|
||||
public double divide(int dividend, int divisor){
|
||||
return (((double)dividend / divisor));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mulitply x by 2.5
|
||||
*
|
||||
* <br><br>
|
||||
* @param x value to be multiplied by 2.5
|
||||
* @return value of x*2.5
|
||||
*/
|
||||
public double twoANDAHalfTimes(int x){
|
||||
return ((double)(x*2.5));
|
||||
}
|
||||
|
||||
/**
|
||||
* Square the value x
|
||||
*
|
||||
* <BR><BR>
|
||||
* @param x value to be squared
|
||||
* @return value of the square
|
||||
*/
|
||||
public double square(double x){
|
||||
return (x*x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the value of the quadratic
|
||||
* <br><br>
|
||||
* @param x,a,b,c values to be used in quadratic
|
||||
* @return value of the equation with given values
|
||||
*/
|
||||
public double quadratic(double x, int a, int b, int c){
|
||||
//no typecasting needed, the equation is promoted
|
||||
//to double because x is a double
|
||||
return (a*(x*x) + b*x + c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Solve the Quadratic Equation with given values
|
||||
* <br><br>
|
||||
* @param a,b,c values to be used in quadratic equation
|
||||
* @return value of the quadratic
|
||||
*/
|
||||
public double solveQuadr(double a, double b, double c){
|
||||
return (-b + Math.sqrt((b*b) - (4*a*c)))/(2*a);
|
||||
}
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Debugging main for class P0Phase3.
|
||||
* This method will rigorously test my code.
|
||||
*
|
||||
* <br><br>
|
||||
* @param args IGNORED
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
//Create variable to test out class
|
||||
P0Phase3 tester = new P0Phase3();
|
||||
|
||||
//test methods
|
||||
System.out.println(tester.roundOff(5.454));
|
||||
System.out.println(tester.divide(10,3));
|
||||
System.out.println(tester.twoANDAHalfTimes(5));
|
||||
System.out.println(tester.square(2));
|
||||
System.out.println(tester.quadratic(2,2,3,4));
|
||||
System.out.println(tester.solveQuadr(1,2,1));
|
||||
|
||||
}// end of main(String[] args)
|
||||
|
||||
}// end of class P0Phase3
|
||||
378
CS1322/p0/Pet.html
Normal file
378
CS1322/p0/Pet.html
Normal file
@@ -0,0 +1,378 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<!-- Generated by javadoc on Fri Aug 30 00:36:38 EDT 2002 -->
|
||||
<TITLE>
|
||||
: Class Pet
|
||||
</TITLE>
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="white">
|
||||
|
||||
<!-- ========== START OF NAVBAR ========== -->
|
||||
<A NAME="navbar_top"><!-- --></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_top_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV CLASS
|
||||
NEXT CLASS</FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>
|
||||
<A HREF="Pet.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<!-- =========== END OF NAVBAR =========== -->
|
||||
|
||||
<HR>
|
||||
<!-- ======== START OF CLASS DATA ======== -->
|
||||
<H2>
|
||||
Class Pet</H2>
|
||||
<PRE>
|
||||
java.lang.Object
|
||||
|
|
||||
+--<B>Pet</B>
|
||||
</PRE>
|
||||
<HR>
|
||||
<DL>
|
||||
<DT>public class <B>Pet</B><DT>extends java.lang.Object</DL>
|
||||
|
||||
<P>
|
||||
CS1322: Programming Assignment #0 - Fall 2002
|
||||
|
||||
<PRE>
|
||||
Pet.java
|
||||
Class Pet - A Class designed to learn how to work with
|
||||
methods and javadoc.
|
||||
|
||||
Revisions: 1.0 Aug. 26, 2002
|
||||
Created the Pet class
|
||||
|
||||
1.1 Aug. 26, 2002
|
||||
Finished, Compiled, Tested
|
||||
</PRE>
|
||||
|
||||
Collaboration Statement:
|
||||
I worked on the homework assignment alone, using only
|
||||
course materials.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
<P>
|
||||
<!-- ======== INNER CLASS SUMMARY ======== -->
|
||||
|
||||
|
||||
<!-- =========== FIELD SUMMARY =========== -->
|
||||
|
||||
|
||||
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
||||
|
||||
<A NAME="constructor_summary"><!-- --></A>
|
||||
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TD COLSPAN=2><FONT SIZE="+2">
|
||||
<B>Constructor Summary</B></FONT></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD><CODE><B><A HREF="Pet.html#Pet()">Pet</A></B>()</CODE>
|
||||
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<!-- ========== METHOD SUMMARY =========== -->
|
||||
|
||||
<A NAME="method_summary"><!-- --></A>
|
||||
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TD COLSPAN=2><FONT SIZE="+2">
|
||||
<B>Method Summary</B></FONT></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> int</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="Pet.html#getAge()">getAge</A></B>()</CODE>
|
||||
|
||||
<BR>
|
||||
Get the value of age.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> java.lang.String</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="Pet.html#getAnimalType()">getAnimalType</A></B>()</CODE>
|
||||
|
||||
<BR>
|
||||
Get the value of animalType.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> java.lang.String</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="Pet.html#getName()">getName</A></B>()</CODE>
|
||||
|
||||
<BR>
|
||||
Get the value of name
|
||||
|
||||
<br><br></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE>static void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="Pet.html#main(java.lang.String[])">main</A></B>(java.lang.String[] args)</CODE>
|
||||
|
||||
<BR>
|
||||
Debugging main for class Pet.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="Pet.html#setAge(int)">setAge</A></B>(int v)</CODE>
|
||||
|
||||
<BR>
|
||||
Set the value of age.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="Pet.html#setAnimalType(java.lang.String)">setAnimalType</A></B>(java.lang.String v)</CODE>
|
||||
|
||||
<BR>
|
||||
Set the value of animalType.</TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> void</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="Pet.html#setName(java.lang.String)">setName</A></B>(java.lang.String n)</CODE>
|
||||
|
||||
<BR>
|
||||
Set the value of name
|
||||
|
||||
<br><br></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE> java.lang.String</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="Pet.html#toString()">toString</A></B>()</CODE>
|
||||
|
||||
<BR>
|
||||
Change standard string to output to be used for this specific program
|
||||
|
||||
<br><br></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
||||
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
|
||||
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
|
||||
<TD><B>Methods inherited from class java.lang.Object</B></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<P>
|
||||
|
||||
<!-- ============ FIELD DETAIL =========== -->
|
||||
|
||||
|
||||
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
||||
|
||||
<A NAME="constructor_detail"><!-- --></A>
|
||||
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TD COLSPAN=1><FONT SIZE="+2">
|
||||
<B>Constructor Detail</B></FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<A NAME="Pet()"><!-- --></A><H3>
|
||||
Pet</H3>
|
||||
<PRE>
|
||||
public <B>Pet</B>()</PRE>
|
||||
<DL>
|
||||
</DL>
|
||||
|
||||
<!-- ============ METHOD DETAIL ========== -->
|
||||
|
||||
<A NAME="method_detail"><!-- --></A>
|
||||
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TD COLSPAN=1><FONT SIZE="+2">
|
||||
<B>Method Detail</B></FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<A NAME="getName()"><!-- --></A><H3>
|
||||
getName</H3>
|
||||
<PRE>
|
||||
public java.lang.String <B>getName</B>()</PRE>
|
||||
<DL>
|
||||
<DD>Get the value of name
|
||||
|
||||
<br><br><DD><DL>
|
||||
<DT><B>Returns:</B><DD>value of name</DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="setName(java.lang.String)"><!-- --></A><H3>
|
||||
setName</H3>
|
||||
<PRE>
|
||||
public void <B>setName</B>(java.lang.String n)</PRE>
|
||||
<DL>
|
||||
<DD>Set the value of name
|
||||
|
||||
<br><br><DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>n</CODE> - value to assign to name</DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="getAge()"><!-- --></A><H3>
|
||||
getAge</H3>
|
||||
<PRE>
|
||||
public int <B>getAge</B>()</PRE>
|
||||
<DL>
|
||||
<DD>Get the value of age.
|
||||
|
||||
<br><br><DD><DL>
|
||||
<DT><B>Returns:</B><DD>value of age.</DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="setAge(int)"><!-- --></A><H3>
|
||||
setAge</H3>
|
||||
<PRE>
|
||||
public void <B>setAge</B>(int v)</PRE>
|
||||
<DL>
|
||||
<DD>Set the value of age.
|
||||
|
||||
<br><br><DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>v</CODE> - Value to assign to age.</DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="getAnimalType()"><!-- --></A><H3>
|
||||
getAnimalType</H3>
|
||||
<PRE>
|
||||
public java.lang.String <B>getAnimalType</B>()</PRE>
|
||||
<DL>
|
||||
<DD>Get the value of animalType.
|
||||
|
||||
<br><br><DD><DL>
|
||||
<DT><B>Returns:</B><DD>value of animalType.</DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="setAnimalType(java.lang.String)"><!-- --></A><H3>
|
||||
setAnimalType</H3>
|
||||
<PRE>
|
||||
public void <B>setAnimalType</B>(java.lang.String v)</PRE>
|
||||
<DL>
|
||||
<DD>Set the value of animalType.
|
||||
|
||||
<br><br><DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>v</CODE> - Value to assign to animalType.</DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="toString()"><!-- --></A><H3>
|
||||
toString</H3>
|
||||
<PRE>
|
||||
public java.lang.String <B>toString</B>()</PRE>
|
||||
<DL>
|
||||
<DD>Change standard string to output to be used for this specific program
|
||||
|
||||
<br><br><DD><DL>
|
||||
<DT><B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE></DL>
|
||||
</DD>
|
||||
<DD><DL>
|
||||
<DT><B>Returns:</B><DD>phrase as string</DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<A NAME="main(java.lang.String[])"><!-- --></A><H3>
|
||||
main</H3>
|
||||
<PRE>
|
||||
public static void <B>main</B>(java.lang.String[] args)</PRE>
|
||||
<DL>
|
||||
<DD>Debugging main for class Pet.
|
||||
|
||||
<br><br><DD><DL>
|
||||
<DT><B>Parameters:</B><DD><CODE>args</CODE> - IGNORED</DL>
|
||||
</DD>
|
||||
</DL>
|
||||
<!-- ========= END OF CLASS DATA ========= -->
|
||||
<HR>
|
||||
|
||||
<!-- ========== START OF NAVBAR ========== -->
|
||||
<A NAME="navbar_bottom"><!-- --></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV CLASS
|
||||
NEXT CLASS</FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>
|
||||
<A HREF="Pet.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<!-- =========== END OF NAVBAR =========== -->
|
||||
|
||||
<HR>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
157
CS1322/p0/Pet.java
Normal file
157
CS1322/p0/Pet.java
Normal file
@@ -0,0 +1,157 @@
|
||||
/**
|
||||
* CS1322: Programming Assignment #0 - Fall 2002
|
||||
*
|
||||
* <PRE>
|
||||
* Pet.java
|
||||
* Class Pet - A Class designed to learn how to work with
|
||||
* methods and javadoc.
|
||||
*
|
||||
* Revisions: 1.0 Aug. 26, 2002
|
||||
* Created the Pet class
|
||||
*
|
||||
* 1.1 Aug. 26, 2002
|
||||
* Finished, Compiled, Tested
|
||||
* </PRE>
|
||||
*
|
||||
* Collaboration Statement:
|
||||
* I worked on the homework assignment alone, using only
|
||||
* course materials.
|
||||
*
|
||||
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
||||
* @version Version 1.1, Aug. 26, 2002
|
||||
*/
|
||||
|
||||
public class Pet {
|
||||
|
||||
////////////////
|
||||
//name methods//
|
||||
////////////////
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Get the value of name
|
||||
*
|
||||
* <br><br>
|
||||
* @return value of name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of name
|
||||
*
|
||||
* <br><br>
|
||||
* @param n value to assign to name
|
||||
*/
|
||||
public void setName(String n)
|
||||
{
|
||||
name = n;
|
||||
}
|
||||
|
||||
///////////////
|
||||
//age methods//
|
||||
///////////////
|
||||
private int age;
|
||||
|
||||
/**
|
||||
* Get the value of age.
|
||||
*
|
||||
* <br><br>
|
||||
* @return value of age.
|
||||
*/
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of age.
|
||||
*
|
||||
* <br><br>
|
||||
* @param v Value to assign to age.
|
||||
*/
|
||||
public void setAge(int v) {
|
||||
this.age = v;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////
|
||||
//animalType methods//
|
||||
//////////////////////
|
||||
private String animalType;
|
||||
|
||||
/**
|
||||
* Get the value of animalType.
|
||||
*
|
||||
* <br><br>
|
||||
* @return value of animalType.
|
||||
*/
|
||||
public String getAnimalType() {
|
||||
return animalType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of animalType.
|
||||
*
|
||||
* <br><br>
|
||||
* @param v Value to assign to animalType.
|
||||
*/
|
||||
public void setAnimalType(String v) {
|
||||
this.animalType = v;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Change standard string to output to be used for this specific program
|
||||
*
|
||||
* <br><br>
|
||||
* @return phrase as string
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return "My name is "+ getName() + "\n" +
|
||||
"I am a "+getAnimalType()+" that is "+getAge()+" year"+((age>1)?"s ":" ")+
|
||||
"old.";
|
||||
}//added the plurality after seeing someone say it was fixed in the autograder
|
||||
//so no points off!!!! yay!
|
||||
|
||||
|
||||
/**
|
||||
* Debugging main for class Pet.
|
||||
*
|
||||
* <br><br>
|
||||
* @param args IGNORED
|
||||
*/
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
Pet fluffy = new Pet();
|
||||
Pet fido = new Pet();
|
||||
Pet mrBubbles = new Pet();
|
||||
|
||||
//Fluffy declarations (that sounds rather humorous doesn't it?)
|
||||
fluffy.setName("Fluffy");
|
||||
fluffy.setAge(3);
|
||||
fluffy.setAnimalType("Cat");
|
||||
|
||||
//Fido declarations
|
||||
fido.setName("Fido");
|
||||
fido.setAge(5);
|
||||
fido.setAnimalType("Dog");
|
||||
|
||||
//mrBubbles declaration
|
||||
mrBubbles.setName("Mr. Bubbles");
|
||||
mrBubbles.setAge(1); //give him another week
|
||||
mrBubbles.setAnimalType("Fish");
|
||||
|
||||
//print to screen
|
||||
System.out.println(fluffy);
|
||||
System.out.println(fido);
|
||||
System.out.println(mrBubbles);
|
||||
|
||||
}// end of main(String[] args)
|
||||
|
||||
}// end of class Pet
|
||||
BIN
CS1322/p0/cs1322-P0.zip
Normal file
BIN
CS1322/p0/cs1322-P0.zip
Normal file
Binary file not shown.
BIN
CS1322/p0/p0.zip
Normal file
BIN
CS1322/p0/p0.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user