Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

need advise about this exercise

Posted on 2004-10-18
7
150 Views
Last Modified: 2010-03-31
CAN SOMEONE PLEASE GUIDE ME ON HOW TO DO THE FOLLOWING

MY EMAIL ADD IS:

<e-mail removed by Venabili>


When answering this question you are advised to take a look at the java.util.Date class to get some idea of the methods you may need. However DO NOT implement more methods than are necessary to meet the requirements as this will clutter your answer.

For this question you need to develop a Instant class in order to represent a particular moment in time. After creating a Instant object by supplying the time in hours, minutes and seconds we want it to be able to respond to the following:
What is the time of this Instant in seconds?
Given another Instant object, is it's time setting before, after or the same as this one?
[In other words compare object of this type]
Create an Instant 5 hours ahead of this one.
0
Comment
Question by:jaanofeastlondon
  • 4
7 Comments
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 250 total points
ID: 12340083
>>After creating a Instant object by supplying the time in hours, minutes and seconds we want it to be able to respond to the following:
 >> What is the time of this Instant in seconds?

use following methods

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html#getInstance()
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html#set(int, int, int, int, int, int)
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html#getTime()
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html#getTime()

>>Create an Instant 5 hours ahead of this one.
use following methods
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html#add(int, int)


0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12340090
let me know if  that is enough for u
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12340096
otherwise i try to give some more help
but not the code
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12340107
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question