Use vi and the command-line to complete this program. Only use the syntax we have covered as of P11; this is meant
to be a simple program to solidify the basic steps to code and use a class.
You shuld also practice using the online documentation for the new class that your class should use.
Write a class called TimeEntry that represents an entry in a time sheet.
Your TimeEntry class should have 3 attributes:
- timestamp - make this of class Date (what should you do to learn about the Date class?)
- hoursWorked - what datatype should this be?
- comments - what datatype should this be?
Methods:
- Write a default constructor - what should it set each attribute to?
- Write one more constructor that takes 2 arguments - what should they be and what should it set the 3rd attribute to?
- Make your instance variables private.
- Read the posting about getters and setters and see if you can figure out how to write a getter and a setter for each attribute.
- Test your getters and setters in your TestTimeEntry application (described below).
- Write a basic toString().
Write a program called TestTimeEntry to test your new class.
More Notes:
Here is the signature to use for your toString() method in the TimeEntry class:
public String toString()
Note: You should use this signature to write toString() for every helper class you ever write.
In your TestTimeEntry program, use this statement to display your TimeEntry object (called timeEntry below):
System.out.println(timeEntry);
Turn in both of your source files via Canvas.