All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Butcher and Baker Puzzle (Posted on 2022-12-14)
Exactly one of Mr. Jankowski, Mrs. Jankowski, their son Nate, and their daughter Mabel is a butcher.

Five facts relating to their occupation are furnished hereunder as follows:

1. If the butcher and the baker belong to the same sex, then the baker is older than the butcher.
2. There is exactly one butcher and one baker.
3. If neither the butcher nor the baker is the parent of the other, then the butcher is older than the baker.
4. If the butcher is a man, then he and the baker are the same age.
5. If the butcher and the baker belong to the opposite sex, then the man is older than the woman.
Whose occupation can be determined with certainty? Provide valid reasoning for your conclusion.

 See The Solution Submitted by K Sengupta Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 different coding | Comment 5 of 30 |
I did first solve the problem with a computer code, which I then :-) ignored and concluded the wrong answer with
mistaken logic. I should have checked with the code....

some output...

father   age=           4 baker
mother   age=           4
son      age=           4
daughter age=           3 butcher

father   age=           1
mother   age=           2 baker
son      age=           1
daughter age=           1 butcher

etc...

program fam
implicit none
integer f(4,2),role,irole,agef,agem,ageb,ages,bak,fambak
character rol(4)*8, job(3)*7
data rol/'father','mother','son','daughter'/,job/'butcher','baker',' '/

c         (i,*): i=1,2,3,4     role:   father, mother, son, daughter
c         (*,1):  =1,2,3,4     age:    any of 4 relative possibilities
c         (*,2):  =1,2,3       job:    butcher, baker, none
c
f(4,2)=1 ! daughter is butcher
do fambak=1,3  ! who is the baker?
f(1,2)=3
f(2,2)=3
f(3,2)=3
f(fambak,2)=2   ! ** 2 ** there is now a baker, and it is not Mabel
bak=fambak
do agef=1,4
f(1,1)=agef
do agem=1,4
f(2,1)=agem
do ageb=1,4
f(3,1)=ageb
do 1 ages=1,4
f(4,1)=ages
if(bak.eq.2.and.f(2,1).le.f(4,1))go to 1 ! ** 1 **
if(bak.eq.3.and.f(4,1).le.f(3,1))go to 1 ! ** 3 **
c
c ** 4 ** is false already
c
if((bak.eq.1.or.bak.eq.3).and.f(bak,1).le.f(4,1)) go to 1 ! ** 5 **
print*
do irole=1,4
print*,rol(irole),' age=',f(irole,1),job(f(irole,2))
enddo
1                  enddo
enddo
enddo
enddo
enddo
end

 Posted by Steven Lord on 2022-12-14 10:24:46

 Search: Search body:
Forums (0)