Docsity

Elementary programming java code, Assignments of Local Area Network (LAN)

Partial preview of the text

Download Elementary programming java code and more Assignments Local Area Network (LAN) in PDF only on Docsity!

class Time{ int hours; int minutes; int seconds; public Time(){ hours=0; minutes=0; seconds=0; } public Time(int h, int m, int s){ hours = h; minutes = m; seconds = s; } void normalize(){ minutes+=seconds/60; seconds%=60; hours+=minutes/60; minutes%=60; hours%=24; } void advance(int h, int m, int s){ hours+=h; minutes+=m; seconds+=s;

normalize(); } void reset(int h, int m, int s){ hours = h; minutes = m; seconds = s; } void print(){ System.out.println(hours+":"+minutes+":"+seconds); } } public class welome { public static void main(String[] args) { Time t = new Time(12,38,20); t.advance(6,30,60); t.print(); } }