95
d.Four
score
and
seven
years
ago
7.Write the declarations and statements necessary to input a string from
System.in.
8.Write a class that represents a date, with the month, day, and year represented
by strings. The class should have a constructor that takes the three parts of the
date as parameters, and value-returning methods that return the date in
mm/dd/yyyy format and in yyyy-mm-dd format. (Hint:The general structure of
this class is very similar to Name.)
9.Enter and run the following application. Be sure to type it exactly as it appears
here.
//******************************************************************
// HelloWorld application
// This application displays two simple messages
//******************************************************************
public classHelloWorld
{
public static voidmain(String args[])
{
finalString MSG1 ="Hello world.";
String msg2;
System.out.println(MSG1);
msg2 = MSG1 +" "+ MSG1 + " "+ MSG1;
System.out.println(msg2);
}
}
Programming Problems
1.Write a Java application that displays a series of Haiku poems. A Haiku poem is
written in three phrases. The first phrase has five syllables, the second has seven
syllables, and the third phrase has five syllables. For example: