Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: David Mustakim
  Where is David Mustakim?
 Jakarta
 Indonesia
 David Mustakim
 To: Vilhelm-Ion Praisach
  Where is Vilhelm-Ion Praisach?
 Resita
 Romania
 Vilhelm-Ion Praisach
 Tags
Subject: RE: Educational problem
Thread ID: 395984 Message ID: 395997 # Views: 69 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Wednesday, January 22, 2014 8:11:58 AM         
   


> > Hi experts,
> >
> > How to solve this problem through programing
> >
> > Two taps A and B together filled a swimming pool in
> > 15 hours. Tap A & B are kept open for 12 hours and
> > then the tap B is closed. It takes another 8 hours
> > to fill swimming pool. How may hours does each tap
> > required to fill swimming pool ?.
> >
> > Thanks in advance.
>
>
PUBLIC oFrm
> oFrm=CREATEOBJECT("MyForm")
> oFrm.Show
> 
> DEFINE CLASS MyForm as Form
> 	width=600
> 	ADD OBJECT lbl1 as Label WITH Caption="Two taps A and B together filled a swimming pool in",autosize=.T.
> 	ADD OBJECT txt1 as TextBox WITH left=285,value=15
> 	ADD OBJECT lbl1_1 as Label WITH Caption="hours",left=400,autosize=.T.
> 
> 	ADD OBJECT lbl2 as Label WITH Caption="Tap A & B are kept open for",top=50,autosize=.T.
> 	ADD OBJECT txt2 as TextBox WITH left=150,value=12,top=50
> 	ADD OBJECT lbl2_1 as Label WITH Caption="hours and then the tap",top=50,autosize=.T.,left=265
> 	ADD OBJECT opt1 as OptionGroup WITH left=400,value=2,top=50,ButtonCount=2,width=40,height=50
> 	ADD OBJECT lbl2_2 as Label WITH Caption="is closed.",top=50,left=450,autosize=.T.
> 	
> 	ADD OBJECT lbl3 as Label WITH Caption="It takes another",top=100,autosize=.T.
> 	ADD OBJECT txt3 as TextBox WITH left=90,value=8,top=100
> 	ADD OBJECT lbl3_1 as Label WITH Caption="hours to fill swimming pool.",top=100,left=200,autosize=.T.
> 
> 	ADD OBJECT lbl4 as Label WITH Caption="How may hours does each tap required to fill swimming pool ?",top=150,autosize=.T.
> 	
> 	ADD OBJECT lbl4_1 as Label WITH Caption="Tap A does",top=200,autosize=.T.
> 	ADD OBJECT txt4_1 as TextBox WITH value=0,top=200,left=70,ReadOnly=.T.
> 	ADD OBJECT lbl4_2 as Label WITH Caption="Tap B does",top=200,autosize=.T.,left=200
> 	ADD OBJECT txt4_2 as TextBox WITH value=0,top=200,left=270,ReadOnly=.T.
> 	PROCEDURE Init
> 		LOCAL lni
> 		FOR lni=1 TO This.opt1.ButtonCount
> 			This.opt1.Buttons[m.lni].Caption=CHR(64+m.lni)
> 			This.opt1.Buttons[m.lni].AutoSize=.T.
> 			This.opt1.Buttons[m.lni].Left=5
> 		NEXT
> 		This.Solve
> 	ENDPROC
> 	PROCEDURE Solve
> 		LOCAL lnA,lnB,lnTA,lnTB
> 		lnA=-This.txt1.Value+This.txt2.Value+IIF(This.opt1.Value=1,0,This.txt3.Value)
> 		lnB=This.txt1.Value-This.txt2.Value-IIF(This.opt1.Value=1,This.txt3.Value,0)
> 		This.txt4_1.Value=This.txt1.Value*(m.lnB+m.lnA)/m.lnB
> 		This.txt4_2.Value=This.txt1.Value*(m.lnB+m.lnA)/m.lnA
> *!*			15(A+B)=12(A+B)+8A=X
> 
> *!*			15A+15B-12A-12B-8A=0
> *!*			3B-5A=0 **********  lnA=5, lnB=3
> 
> *!*			B=5A/3
> *!*			A=3B/5
> 
> *!*			15(A+5A/3)=X
> *!*			15(3A+5A)/3=X
> *!*			40A=X
> *!*			A need 40 h
> 
> *!*			15(3B/5+B)=X
> *!*			15(3B+5B)/5=X
> *!*			24B=X
> *!*			B need 24 h
> 	ENDPROC
> 	PROCEDURE txt1.InterActiveChange
> 		ThisForm.Solve
> 	ENDPROC
> 	PROCEDURE txt2.InterActiveChange
> 		ThisForm.Solve
> 	ENDPROC
> 	PROCEDURE txt3.InterActiveChange
> 		ThisForm.Solve
> 	ENDPROC
> 	PROCEDURE opt1.InterActiveChange
> 		ThisForm.Solve
> 	ENDPROC
> ENDDEFINE

>
>
> My respects


You should first check if there is a leak in the swimming pool, may also need to find out if anyone is swimming while the pool is being filled. Water volume in pool is always affected by leak you know, its own leak and swimmers/human leak !

.

ENTIRE THREAD

Educational problem Posted by Jayant Mahajan @ 1/22/2014 5:57:34 AM
RE: Educational problem Posted by Rahul Moudgill @ 1/22/2014 6:43:07 AM
RE: Educational problem Posted by Vilhelm-Ion Praisach @ 1/22/2014 8:01:30 AM
RE: Educational problem Posted by David Mustakim @ 1/22/2014 8:11:58 AM
RE: Educational problem Posted by Vilhelm-Ion Praisach @ 1/22/2014 8:26:15 AM
RE: Educational problem Posted by Pete Sass @ 1/22/2014 7:29:20 PM
RE: Educational problem Posted by Vilhelm-Ion Praisach @ 1/22/2014 7:57:44 PM
RE: Educational problem Posted by Pete Sass @ 1/22/2014 9:55:03 PM
RE: Educational problem Posted by Tore Bleken @ 1/22/2014 10:02:23 PM
RE: Educational problem Posted by Raju Shrestha @ 1/23/2014 5:21:38 AM
RE: Educational problem Posted by David Mustakim @ 1/23/2014 7:11:38 AM
RE: Educational problem Posted by Jayant Mahajan @ 1/23/2014 4:40:39 AM
RE: Educational problem Posted by Vilhelm-Ion Praisach @ 1/23/2014 6:43:08 AM
RE: Educational problem Posted by tom knauf @ 1/23/2014 1:31:41 PM
RE: Educational problem Posted by Vilhelm-Ion Praisach @ 1/23/2014 5:15:28 PM
RE: Educational problem Posted by David Mustakim @ 1/22/2014 8:04:29 AM
RE: Educational problem Posted by Tom Saddul @ 1/22/2014 8:27:57 AM
RE: Educational problem Posted by David Mustakim @ 1/22/2014 8:35:18 AM
RE: Educational problem Posted by Tom Saddul @ 1/22/2014 3:27:01 PM
RE: Educational problem Posted by Tony Vignone @ 1/22/2014 5:09:25 PM