Homework 3 Feedback/notes.

• Please provide all four requested portions of the homework.
• A high level description in ENGLISH.
• An algorithm.
• Remember, this is a set of instructions.
• It does not usually include constants or variables
• It is usually given in pseudo-code.
• A trace of the algorithm.
• This it to demonstrate that your algorithm works.
• Don't do anything that is not in your algorithm.
• The purpose is to find bugs in your algorithm.
• And also to find things that are unclear in your algorithm.
1. Description

This program will compute the total distance an object is moved. It will then compute the rewards for moving that object based on the distance moved.

2. Algorithm

Get the starting position in cubits, palms and fingers.
Get the ending position in cubits, palms and fingers.
Convert each to fingers using the ToFingers sub algorithm.
Reduce each using the Reduce sub algorithm
Print starting and ending positions.
Subtract startingFingers from endingFingers to make fingersMoved
Reduce fingersMoved
Print results.

// Sub Algorithm Reduce
// input fingers, palms, cubits
// output newFingers, newPalms, newCubits
//
// Note this is all equations, it is ok to be in c++ like code here
newFingers = fingers % FINGERS_PER_PALM
newPalms = palms + fingers/FINGERS_PER_PALM

newCubits = cubits + newPalms/PALMS_PER_CUBIT
newPalms = newPalms % PALMS_PER_CUBIT

// Sub Algorithm To Fingers
// input fingers palms and cubits
// output total fingers
totalFingers =   cubits * PALMS_PER_CUBIT * FINGERS_PER_PALM
+ palms * FINGERS_PER_PALM
+ fingers

Note: In the end, I will do all computations in fingers. This way I don't need an IF statement or a loop. Note: I really don't need to provide details on input and output. Just note that it is performed unless there is something tricky.