Java Reference
In-Depth Information
Please enter the second time: 0900
15 hours 30 minutes
Implement a class TimeInterval whose constructor takes two
military times. The class should have two methods getHours and
getMinutes .
΢ Exercise P4.15. Writing large letters. A large letter H can be produced like
this:
* *
* *
*****
* *
* *
Use the class
public class LetterH
{
public String toString()
{
return
"* *\n* *\n*****\n* *\n* *\n";
}
}
Define similar classes for the letters E , L , and O . Then write the message
H
E
L
L
0
in large letters.
Your main class should be called HelloPrinter .
΢΢Exercise P4.16. Write a class ChristmasTree whose toString
method yields a string depicting a Christmas tree:
Search WWH ::




Custom Search