Posts

Showing posts from October, 2017
ScaleFree

MAKING A DIGITAL CLOCK IN JAVA

Image
Does making a  Digital Clock  in Java sounds cool to you? If yes then you, my friend definitely are in the place. SOURCE CODE    import java.awt.Font;  import java.awt.Color;  import java.awt.GridLayout;  import java.awt.event.ActionEvent;  import java.awt.event.ActionListener;  import javax.swing.JFrame;  import javax.swing.JLabel;  import javax.swing.Timer;  import javax.swing.SwingConstants;  import java.util.*;  import java.text.*;    public class Clock   {   public static void main(String[] args)    {        JFrame.setDefaultLookAndFeelDecorated(true);      JFrame frame = new JFrame("Digital Clock");     frame.setSize(300,150);      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);     frame.setLayout(new GridLayout(3, 1));       ClockLabel dateL = new ClockLabel("date");      ClockLabel timeL = new ClockLabel("time");      ClockLabel dayL = new ClockLabel("day");           frame.add(dateL);     f

TOWERS OF HANOI

Image
 Note - Recursive algorithm used The Towers of Hanoi is one of the most famous classic problems in Computer Science that almost every Computer Scientist has to tackle with at least once in their entire lifetime. LEGEND According to legends, In the Far East, there exists a temple where few diligent priests are trying to move a stack of golden disks from one diamond peg to another. There are three pegs in total and the stack has 64 disks threaded onto one peg arranged in increasing order of size from top to bottom. The priests are moving the stack from one peg to another under the conditions that exactly one disk is moved at a time and never should a larger disk be placed over a smaller disk. And it is said that that the world will come to an end by the time the priests complete their task. To learn more about Towers of Hanoi   CLICK HERE !!! QUESTION Write a C++ algorithm to move n number of disks from peg1 to peg2 under the given conditions : Only one disk is to be m

Share on Social Media