class Earthquake
{
double rate;
String reading;
Earthquake(double r)
{
rate = r;
}
public String toString()
{
if ( rate > 6.0)
reading = "Most structures will fall";
if ( rate > 4.5)
reading = "Many buildings will fall";
if ( rate > 3.0)
reading = "Many buildings will be slightly damaged";
if ( rate > 1.5)
reading = "Many people will feel the quake";
if ( rate > 0.5)
reading = "Most people will not feel the quake";
return reading;
}
}
class TestQuake
{
public static void main(String arg[])
{
Earthquake e = new Earthquake(8.0);
System.out.println(e.toString(
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |