/*** Clock **/public class clock {private int hour; private int minute; private int second; Public clock () {calendar ar Cal = calendar. getinstance (); hour = Cal. get (11); minute = Cal. get (12); Second = Cal. get (13);} public clock (INT hour, int minute, int second) {This. hour = hour; this. minute = minute; this. second = Second;} public void go () {second ++; If (second = 60) {minute ++; second = 0; If (minute = 60) {hour ++; minute = 0; If (hour = 24) {hour = 0 ;}}} Public String Showtime () {string time = ""; if (hour <10) {time + = "0";} Time + = minute + ":"; if (minute <10) {time + = "0 ";} time + = hour + ":"; if (second <10) {time + = "0";} Time + = Second; return time ;}} // implement public static void main (string [] ARGs) throws exception {clock C1 = new clock (0, 0, 0); For (;) {c1.go (); system. out. println (c1.showtime (); thread. sleep (1000 );}}
/*** Circle class * @ author administrator **/public class round {private double r; Final Double P = 3.14; Public double perimeter (Double R) {return 2 * p * r;} public double area (double r) {return p * r ;}// implement public static void main (string [] ARGs) {pipeline SC = new pipeline (system. in); Round round = new round (); system. out. print ("Enter the swimming pool radius:"); double radii = SC. nextdouble (); double brick = (round. area (radii + 3)-round. area (radii) * 10; double wall = round. perimeter (radii + 3) * 8; system. out. printf ("the wall cost is %. the cost of 0f RMB \ n floor tiles is %. 0f RMB ", wall, Brick );}
Clock, Swimming Pool