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:
- If the butcher and the baker belong to the same sex, then the baker is older than the butcher.
- There is exactly one butcher and one baker.
- If neither the butcher nor the baker is the parent of the other, then the butcher is older than the baker.
- If the butcher is a man, then he and the baker are the same age.
- 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.
We can know only the occupation of the daughter: she is the butcher. But the baker can be either the mother or the father.
Here's a summary of the possibilities:
"daughter" "mother"
SDMF
1122
"daughter" "mother"
SDMF
1233
"daughter" "mother"
SDMF
2133
"daughter" "mother"
SDMF
1123
"daughter" "mother"
SDMF
1234
"daughter" "mother"
SDMF
1243
"daughter" "father"
SDMF
1122
"daughter" "father"
SDMF
1233
"daughter" "father"
SDMF
2133
"daughter" "father"
SDMF
1123
"daughter" "father"
SDMF
1234
"daughter" "father"
SDMF
1243
Each possibility shows the butcher and the baker's ID's.
The two lines show the relative ages of
S = son
D = daughter
M = mother
F = father
clearvars ,clc
id='sdmf';
sex='mffm';
rel=["son"; "daughter"; "mother" ;"father"];
i=1;
ages0= ['1122'
'1233'
'2133'
'1123'
'1234'
'1243']
for butcher=1:4;
for baker=1:4
if butcher~=baker
for a=1:size(ages0,1)
age=ages0(a,:);
if age(baker)>age(butcher)||sex(butcher)~=sex(baker)
if age(butcher)>age(baker)|| ...
(butcher<3 && baker>2) || (butcher>2 && baker<3)
if age(butcher)==age(baker) || sex(butcher)=='f'
if sex(butcher)=='m' && sex(baker)=='f'
s1=butcher;s2=baker;
else
s1=baker;s2=butcher;
end
if age(s1)>age(s2) || sex(butcher)==sex(baker)
disp([rel(butcher) rel(baker)])
disp('SDMF')
disp(age)
disp(' ')
end
end
end
end
end
end
end
end
|
Posted by Charlie
on 2022-12-14 09:45:54 |