Hey guys, thanks a million for the hints. I really appreciate it! I was thinking that maybe it would better if I just showed you the code. That way you can see for yourself. I'm adding the output at the end ... so you can also see where my problem is.
(Thanks for time
))
==============================================================
==============================================================
/*
*Clock.java
*/
import java.io.*;
public class Clock
{
//class variables
int hour;
int minute;
int second;
//1st constructor
public Clock ()
{
}
//2nd constructor
public Clock (int hour, int minute, int second)
{
hour =0;
minute =0;
second =0;
}
//method for this class (To Calculate the equivalent in UK Time)
double difference() //equivalent UK Time
{
return (this.hour) - 1;
}
}
==============================================================
==============================================================
/*
*ClockTest.java
*/
import java.io.*;
public class ClockTest
{
public static void main(String args[]) throws IOException
{
BufferedReader key =new BufferedReader (new InputStreamReader (System.in));
//declare all needed variables for this class
int h;//hour
int m;//minute
int s;//second
String user;//user input variable
Clock firstWatch;//first object of type Clock
Clock secondWatch;//second object of type Clock
//create new object of type Class named firstWatch
firstWatch = new Clock();
//print firstWatch details to screen with NO USER INPUT
System.out.println(firstWatch);
NewLine.newLine();//method in NewLine.java
System.out.println(firstWatch.hour);
System.out.println(firstWatch.minute);
System.out.println(firstWatch.second);
NewLine.newLine();
/*
//create new object of type Class named secondWatch
secondWatch =new Clock();
*/
//print on-Screen Instructions for the users
System.out.println("You are now required to key in some values. Values required are listed below:");
System.out.println("- Hour");
System.out.println("- Minute");
System.out.println("- Second");
NewLine.newLine();//method in NewLine.java
//user will key in these values fro secondWatch
System.out.println("Please key in a value for HOURS ...");
user =key.readLine();
h =Integer.parseInt(user);//hour
NewLine.newLine();
System.out.println("Now key in a value for MINUTES ...");
user =key.readLine();
m =Integer.parseInt(user);//minute
NewLine.newLine();
System.out.println("And finally, please key in a value for SECONDS ...");
user =key.readLine();
s =Integer.parseInt(user);//second
NewLine.newLine();
NewLine.newLine();
//create new object of type Class named secondWatch
secondWatch =new Clock(h, m, s);
//after user keys in all three required values the reult screen appears
System.out.println("Thank You!");
System.out.println("===========");
//print secondWatch details to screen WITH USER INPUT
System.out.println("This is what you typed in for the secondWatch");
System.out.println("==============================================");
NewLine.newLine();
System.out.println(secondWatch.hour);
System.out.println(secondWatch.minute);
System.out.println(secondWatch.second);
System.out.println(secondWatch.difference());
NewLine.newLine();
System.out.println("THE END >>> Hit the ENTER KEY to end this program");
NewLine.newLine();
try
{
System.in.read();
}
catch (IOException x)
{
return;
}
}
}
==============================================================
==============================================================
>>>>>>> THIS IS MY OUTPUT <<<<<<<<
==============================================================
==============================================================
Clock@bd0108
0
0
0
You are now required to key in some values. Values required are listed below:
- Hour
- Minute
- Second
Please key in a value for HOURS ...
12
Now key in a value for MINUTES ...
30
And finally, please key in a value for SECONDS ...
55
Thank You!
===========
This is what you typed in for the secondWatch
==============================================
0
0
0
-1.0
THE END >>> Hit the ENTER KEY to end this program
Press any key to continue...