From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,5b528da331e8df66,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.219.146 with SMTP id hu18mr9457580qab.3.1364861353216; Mon, 01 Apr 2013 17:09:13 -0700 (PDT) X-Received: by 10.49.72.194 with SMTP id f2mr1054334qev.34.1364861353199; Mon, 01 Apr 2013 17:09:13 -0700 (PDT) Path: v17ni6816qad.0!nntp.google.com!ca1no20220858qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 1 Apr 2013 17:09:13 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=152.15.9.249; posting-account=OorKfwoAAAAEG64-jj7QakHqbp6ymd2J NNTP-Posting-Host: 152.15.9.249 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7075541f-01b7-4cd4-997f-b0b8048f067d@googlegroups.com> Subject: Marble Clock From: gattamaneni abhiram Injection-Date: Tue, 02 Apr 2013 00:09:13 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2013-04-01T17:09:13-07:00 List-Id: A marble clock is a clock that indicates the current time in a 24-hour day = using marbles to represent portions of the hour and day. There are many different= kinds of marble clocks, distinguished by variations in the way the marbles= represent portions of the day. Our marble clock consists of five shallow "= trays" arranged one above the other. The bottom tray (the fifth tray) serve= s as a marble "reservoir." Every minute, a winding mechanism picks up one m= arble from the bottom tray, carries it to the top of the clock and drops it= into the top tray of the clock. As a tray fills up, marbles fall through t= o lower level trays, as described below. The current state of the marbles i= n the upper four trays tells the current time. Each marble in the top tray (first tray) represents a single minute. This f= irst tray has room for four marbles. These marbles all enter from the same = end and roll down to the other end of the tray. When the first tray is full= , the next marble drops to the second tray (the second tray represents 5 mi= nute intervals) and, in the process, trips a latch that tilts the top tray = causing the marbles there to exit the same end that they entered and return= to the end of the line in the reservoir (bottom) tray. The second tray hol= ds a maximum of two marbles, and when a third marble arrives, it drops to t= he next tray (representing 15 minute intervals). Then, the second tray is e= mptied in a manner analogous to the first. Finally, the third (15-minute) t= ray can hold three marbles and a fourth marble drops into the hours tray (f= ourth tray), causing the 15 minute tray to be emptied back into the reservo= ir. The hours tray holds 11 marbles, when a twelfth marble arrives, it trip= s the tray which empties into the reservoir. The tripping marble then also = drops into the reservoir, completing the cycle. Thus, a complete cycle is 1= 2 hours. Above behaviour of the clock is to be implemented using stacks and queues. The initial number of marbles to be taken is the user input. Can anyone please help me with the logic in the program?