if you make a flow chart it would be to read each of 3 sensors.

determine the highest value, ignore the others

compare the highest to the pre-set ranges

report digit from 0 to 6 based on above.

since this is theoretical, does the program have to work ?

will you get sensors for this ?

are you allowed to pick and choose things ?

the ultrasonic sensors that measure distance from about 2cm to 400cm are common, cheap and have lots of references. ie: easy to use. resolution of something like 0.5cm

if you are after the the thickness of a plate of sheet metal, then fractions of a mm resolution would be needed.

much less frequently discussed and a bit harder.

you could use blocks or shoe boxes or some such as your obstacles.

I imagine a conveyor belt with envelopes, small boxes of candy, shoe boxes… etc

if you need the program to look like a beginner wrote it you could

read sensor1

read sensor2

read sensor3

if sensor1 > sensor2 then max_distance = sensor1 else max_distance=sensor2

if sensor3 > max_distance then max_distance = sensor3 // only change if higher

now you know the longest distance.

if max_distance < 0.1 then digit=0

if max_distance > 0.1 then digit=1

if max_distance > 3 then digit=2

if max_distance > 5 then digit=3

if max_distance > 7 then digit=4

if max_distance > 9 then digit=5

if max_distance > 11 then digit=6

display ( digit )

this crude way, the software would pick the largest of the 3 readings.

then change the value of ‘digit’ until the range is larger than the value.

then display the result

this is not an actual program, but a crude way to look at a basic way to do it.

the big fail here is that if this was an assembly line, and the sensors were above the line, the greater distance would be the smaller package. say, you mounted the sensor 1 meter over the line, then any reading over 1 meter would mean nothing there and yield 0