Hey there! Sign in to join this conversationNew here? Join for free
x Turn on thread page Beta
    • Community Assistant
    • Thread Starter
    Offline

    16
    ReputationRep:
    Community Assistant
    Ok so I've never coded java before and have very limited knowledge about it. Ive been given an assginment that asks me to "write a simple console app that accepts string from a keyboard (representing time periods in the format HH:MM) string must be decomposed into 2 integers for hours and mins before being resolved into minutes. Does anyone know how i even begin to program this?
    Offline

    14
    ReputationRep:
    use a scanner listening for input from System.in. then you have two options; you could either split the string using : or you could group it using a regex
    Offline

    19
    ReputationRep:
    (Original post by Raees_Sharif)
    use a scanner listening for input from System.in. then you have two options; you could either split the string using : or you could group it using a regex
    A regex expression is sooo overkill for this, string splitting would suffice.
    • Community Assistant
    • Thread Starter
    Offline

    16
    ReputationRep:
    Community Assistant
    Got it sorted
 
 
 
Poll
Do you agree with the proposed ban on plastic straws and cotton buds?
Useful resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.