How to print a one hour time table?

Hi, I created the Time class along with the Ticker method; however I am having trouble trying to print out one full hour of a time table.
It has to be in this format, for example:
23:30:03
23:30:04
23:30:05
and so on....
Do I use the for loop to print the time as each second increments?
Thanks in advance!
Here is my code:
import java.text.DecimalFormat;
public class TestTime
public static void main (String[] args)
Time time = new Time(23,30,03);
System.out.println(time.toUniversalString() + "\t" + time.toString());
System.out.println();
class Time
private int hour;
private int minute;
private int second;
// Default constructor
public Time()
hour = 0;
minute = 0;
second = 0;
Time (int h, int m, int s)
hour = h;
minute = m;
second = s;
Time (Time t)
hour = t.hour;
minute = t.minute;
second = t.second;
// Set methods
public void setTime(int h, int m, int s)
this.hour = h;
this.minute = m;
this.second = s;
public void setHour(int h)
if ((h > 0) && (h <= 12))
hour = h;
else
hour = 12;
public void setMinute(int m)
if ((m > 0) && (m <= 59))
minute = m;
else
minute = 59;
public void setSecond(int s)
if ((s > 0) && (s <= 59))
second = s;
else
second = 59;
// Get methods
public int getHour()
return hour;
public int getMinute()
return minute;
public int getSecond()
return second;
// toString methods
public String toUniversalString()
DecimalFormat digits = new DecimalFormat("00");
return digits.format(hour) + ":" +
digits.format(minute) + ":" +
digits.format(second);
public String toString()
DecimalFormat digits = new DecimalFormat("00");
return ((getHour() == 12 || getHour() == 0) ? 12 : getHour() % 12) +
":" + digits.format(getMinute()) +
":" + digits.format(getSecond()) +
(getHour() < 12 ? " AM" : " PM");
// Tick method
public void tick()
second++;
if (second == 60)
second = 0;
minute++;
if (minute == 60)
minute = 0;
hour++;

It looks like your Time class already has a method you could use in the increment part of a for loop.
I'm referring to the tick() method.
If you had a method that could be used in the conditional part of the for loop, then you'd have all the parts you need. Then you could do something like this (in pseudo-code):
Time end = new Time(some-time-to-end-at);
for (Time ticker = new Time(some-time-to-start-at); ticker.before(end); ticker.tick())
  System.out.println(ticker);.
Just an idea.
BTW, when you post code, please wrap it in &#91;code&#91;/code] tags so it's easy to read.

Similar Messages

  • How can I make the hour times in the left margin in iCalendar dark enough to read

    How can I make the hour times in the left margin in iCalendar dark enough to read? (Eye transplant too expensive; couldn't schedule anyway under the circumstances

    I can't read anything on the new ical. I'm a teacher of the visually impaired and know how to access voiceover and zoom but hey, i just want to be able to open the app and visually scan a month quickly and visually.
    Never had a problem with the original ical - how to get it back?

  • One hour time difference between Palm and Exchange calendar items

    Calendar items on Exchange and Palm are off by one hour.
    Exchange server, desktop PC and Palm are all set to PST with the same time. Versamail account on Palm has been deleted and rebuilt.
    See screen shots at http://picasaweb.google.com/lh/photo/kPKBDS28rhdVsextLM1PPQ?feat=directlink
    What is interesting is the appointments entered in Outlook show up on the Palm one hour early however they show the correct time in (parenthises) so the Palm seems to be somewhat aware of the problem.
    This same issue occurs on different Palm T/X 's with different Outlook accounts.
    Any suggestions are welcome
    Post relates to: Palm TX
    This question was solved.
    View Solution.

    You need this update:
    http://www.palm.com/cgi-bin/cso_kbURL.cgi?ID=9306
    Download
    DSTUpdater.zip (0.01MB)
    Double-click the downloaded file to decompress it. Your computer will unzip the file to a folder containing several individual files.
    Message Edited by IrreducibleM31 on 03-26-2009 05:12 PM

  • OEM 10G -- how to print the output of a table in a html report

    Hi everyone,
    I am trying to print the out of a particular table from the DB using OEM but having some hard time to do so, does any one know the way. Thanks for reading.
    Oracle version: 10.2
    OS: Windows xp
    Regards,
    katheri

    after login to the OEM ,
    you want the rows of the table or structure of the table?
    you can find administration tab top of the page,
    again you database objects -> tables
    new web page will open -> there you have to enter schema name and table name -> you will get the list of table and then click to view , data types and sizes and all..

  • How to print out the Forms and Table fields relationship, data mapping?

    I create a forms and tables relationship inside the Form Developer 11g, once I created the Data relationships between the form data field and the Table column name. I don't have any command to print it out, such as Layout Wizard.
    Are there any programs on Windows platform can print it out?

    hi all,
    i have try to do this
    public static void Readbinary() throws Exception
              String file = "D:\\05-09.190501+0800";
              DataInputStream dis = new DataInputStream(new FileInputStream(file));
              //but then how to read the content ??????can you give me more hint ?????
    i have find the netflow v5 structure by C
    struct NFHeaderV5{
    uint16_t version; // flow-export version number
    uint16_t count; // number of flow entries
    uint32_t sysUptime;
    uint32_t unix_secs;
    uint32_t unix_nsecs;
    uint32_t flow_sequence; // sequence number
    uint8_t engine_type; // no VIP = 0, VIP2 = 1
    uint8_t engine_id; // VIP2 slot number
    uint16_t reserved; // reserved1,2
    struct NFV5{ 
    ipv4addr_t srcaddr; // source IP address
    ipv4addr_t dstaddr; // destination IP address
    ipv4addr_t nexthop; // next hop router's IP address
    uint16_t input; // input interface index
    uint16_t output; // output interface index
    uint32_t pkts; // packets sent in duration
    uint32_t bytes; // octets sent in duration
    uint32_t first; // SysUptime at start of flow
    uint32_t last; // and of last packet of flow
    uint16_t srcport; // TCP/UDP source port number or equivalent
    uint16_t dstport; // TCP/UDP destination port number or equivalent
    uint8_t pad;
    uint8_t tcp_flags; // bitwise OR of all TCP flags in flow; 0x10
    // for non-TCP flows
    uint8_t prot; // IP protocol, e.g., 6=TCP, 17=UDP, ...
    uint8_t tos; // IP Type-of-Service
    uint16_t src_as; // originating AS of source address
    uint16_t dst_as; // originating AS of destination address
    uint8_t src_mask; // source address prefix mask bits
    uint8_t dst_mask; // destination address prefix mask bits
    uint16_t reserved;
    but how to translate the structure to java,then get the data from the file ?
    Edited by: 903893 on Dec 21, 2011 10:52 PM

  • How to print all data in a table?

    Hello!
      I am doing report with VC. Now I want to print data ,The system action "print" can not print all data,only a page in the table  can be printed. Are there any ways to finishe the print function,Can you help me?
    Thank you very much!

    See this how to guide I put together:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/47fe4fef-0d01-0010-6f87-ed8ecb479123

  • How to colour a one Column in Table

    Hi All,
    My requirement is to <b>colour a particular column in a table</b>. Also I can specify as to which column has to be coloured at the design time itself. I tried to search on WebDynpro Forum also but could not get any related help.
    Can you guys help me in solving my problem.
    Regards

    Hi Valery,
    I have already solved the problem. I have complted this few hours before only.
    Yes you are right, I have used the same property "<b>cellDesign</b>" for adding the colour to a particular column.
    Anyways thanks for you help and suggestion. Also Valery, I have not closed the last thread which I have opened regarding the <b>"Adding of filter to table"</b>, I will do that, the delay is just because I have not tried the method you have told me. I am stuck with some urgent work. Anyways your way of getting all the records using the special character <b>"*"</b>, has worked for me...
    Hope I could get to that thread soon.
    Regards

  • Need to know how to print in one page a big block diagram from labview

    Hi!
    I wanted to know how i can print a program i made on labview. The problem is that the program is quite big and i need to print it in one page. Just the block diagram.
    Thanks!
    Meli

    Hello Meli,
    I know, normaly your VI should not be bigger as the window screnn.
    Anyway, you can use the "Print VI documentation" as explain in the following link and and choose the option "Scale block diagram to fit"
    link:
    Printing Documentation for VIs, Templates, and Objects
    Best regards,
    Nick_CH

  • How to get only one line between tables in database diagram?

    Hi!
    I'm using jdev 10.1.3. I've got a database schema with a lot of tables. I would like to have them in one database diagram in compact view with only ONE line between two tables even if there are more foreign key columns between the two tables. In the shema there are a lot of foreign keys with multiple columns and the diagram is hard to read.
    How to archieve this?
    Thanks,
    Carsten.

    hi,
    u should use the same variable across all your queries.In the WAD there is a propoerty "display same variable once". Check that.
    hope it helps,
    regards,
    Parth

  • How I can insert one row on table,  with columns settings: readonly = true

    I have a problem. (jdeveloper 11.1.1.2.0)
    How I can insert row on table (EditingMode= clickToEdit), with columns settings: ReadOnly = true.
    When I make click on button create insert, ADF create one row on the table with output text invisible ( ReadOnly = true.)
    I make double click, then output text is visible (ReadOnly = false)
    I dont want make double click. I want output text is visible (ReadOnly = false), when I make click on button create insert
    Thanks

    Hi,
    try changing the edit mode of the table when pressing the button and refresh the button. This of course turns the whole table into editable mode, but this is how it needs to work. Alternatively, you create an input form for the user to edit the new record and show the form in a popup or beneath the table. Then when the user submits the created row data, you refresh the table to shwo the new row
    Frank

  • How to print the contents of the table in new page?

    Hi,
    I want to print my table contents in the next page by clicking on a button. ie., kind of a print preview. I'm using netweaver2004s.
    Thanks & Regards,
    Suresh

    Hi,
    1)Create a new View, map the context node which is bound to the table to the context of this view.
    2) Iterate throught the element and print them to the screen.
    3) Embed this view to a window.
    4) on click of the button open the newly created window.
    Code to iterate through the nodes
    for(int x=0; x< wdContext.nodeTest().size(); x++) // Replace nodeTest with yours
    ITestElement nodeElement = wdContext.nodeTest().getElementAt(x);
    nodeElement.getAttribute("TestAttribute"); //Replace with yours
    nodeElement.getAttribute("TestAttribute"); //Replace with yours
    Regards
    Ayyapparaj

  • How to move from one SQL Server table to another

    Suppose I have two tables:
    Employee1:
    EmpName varchar(100)
    EmpAddress varchar(200)
    And
    Employee2:
    EmpID int,
    EmpName varchar(100),
    EmpAddress varchar(200)
    Note: EmpID is not an identity field
    How to move all the data from Employee1 table to Employee2 table with values of EmpID as 1, 2, 3, ....so on.
    Can anyone have any idea?

    INSERT INTO [Employee2] (EmpID, EmpName, EmpAddress)
    SELECT ROW_NUMBER() OVER (ORDER BY EmpName), EmpName, EmpAddress from Employee1
    should work

  • How to restrict only one row in Table ??.

    Hi all,
    i want to restrict no. of rows to one,
    that is not more that one row should be there in the table.
    Following trigger works well in all conditions
    except:
    insert into myTab select 'x' from emp;
    inserts 14 rows.
    Create or replace trigger one_row_myTab
    before insert on myTab
    for each row
    declare
    cnt number;
    pragma AUTONOMOUS_TRANSACTION;
    Begin
    select count(*) into cnt from mydual;
    if cnt=1 then
    raise_application_error(-20001,'MyDual Can have only one Row');
    end if;
    end;
    i think with trigger it w't be possible because,
    same transaction triggers c't query the table (Mutating Table),
    Autonomus trans ca't identify uncommited changes.
    pls add your suggestions.
    Thanks for Reading the Post.
    Rajashekhar Ganga,
    mail : [email protected]

    nice try Mulder ! it doesn't work everywhere...
    SQL> connect scott/tiger@lsc69
    Connected to:
    Oracle7 Server Release 7.3.4.5.0 - Production
    With the distributed and parallel query options
    PL/SQL Release 2.3.4.5.0 - Production
    SQL>  create table d as select * from dual;
    Table created.
    SQL> create index i on d(1);         
    create index i on d(1)
    ERROR at line 1:
    ORA-00904: invalid column name
    SQL> connect scott/tiger@lsc65
    Connected to:
    Oracle8i Enterprise Edition Release 8.1.7.4.0 - 64bit Production
    JServer Release 8.1.7.4.0 - 64bit Production
    SQL> create table d as select * from dual;
    Table created.
    SQL> create index i on d(1);         
    Index created.
    SQL> connect scott/tiger@lsc68
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - 64bit Production
    With the Partitioning and Data Mining options
    SQL> create table d as select * from dual
    Table created.
    SQL> CREATE UNIQUE INDEX i on d(1);                  
    CREATE UNIQUE INDEX i on d(1)
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel

  • How to print a one-off book

    I need to create a photo book for my dad's 80th birthday. I am currently using an online program called "Mixbook" and it's driving me insane. I am a graphic designer and very familiar with InDesign. I'm finding Mixbook to be too inflexible and difficult to use. I have tons of photos and lots of text and it's just too imprecise and clumsy. (I don't mean to dis Mixbook. It's great if you don't want to customize too much).
    Is there any way to make the book in Indesign and have a single book published somewhere? Has anyone done this?

    If you're "very familiar with InDesign," why are you using "Mixbook"?
    You're confusing the program to create the project, and the printing process you want to use.
    I'd use InDesign because it gives you the power to create a file the way you like. Ask in the InDesign Forum if people know of publishers of what you call a "one-off book."

  • How to print Current date and time

    In my program I put in
    java util.Date now = new java.util(Date);
    the next line is:
    System.out.println("Today's Date is = " + Date);
    when I try to compile it, I get "1 Error"
    what do I do wrong?
    Thank you for your help: Charles.

    You should read a tutorial on Java to learn the basic concepts and syntax.
    java.util.Date now = new java.util.Date();
    System.out.println("It is now " + now); // this will include the time. You can format it using java.text.SimpleDateFormat.

Maybe you are looking for