I have a programming assignment that asks me to create a block that is built off of components a, b, c, d, and e. The ideal block will have:
- Equals amounts of "a" and "b".
- Equal amounts of "c" and "d".
- When "c" and "e" are added together, they will equal "a".
I must create a function that forces inputs a, b, c, d, e to follow the constraints above. So, for example, if the inputs to my function were: 20a, 25b, 10c, 15d, 3e...
Then, one of the possible output would be: 20a, 20b, 10c, 10d, 10e.
Another possible output would be: 25a, 25b, 10c, 10d, 15e.
What do you think is the best formula or general strategy I could employ to make this work? Think of edge-cases. For example, what is the best thing to do if "c" was larger than "a"? Since "c" and "e", when added, need to make up "a", this is important (assume no negative numbers allowed... there needs to be "something" of "e").
Keep in mind this is a programming project.
Thank you.