Solved

need advise about this exercise

Posted on 2004-10-18
7
147 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now