Started work on fansubbing Ore No Sora on 10/11/2011.
It takes me about 2 hours to do 5 minutes of the video with fine-timing.
May or may not finish the series as I have other commitments, however I do enjoy the drama though.
Current Status:
Episode 01: 20 minutes / 45 minutes
Episode 01 completed & discontinued as it's Egu's project and Egu is continuing with it.
Monday, 14 November 2011
Thursday, 10 November 2011
Algorithm for sorting money into $20 & $50 notes for an ATM
Precondition:
Amnt is valid. That is: Amnt > $20; Amnt != $30; Amnt % $10 = 0
The following codes uses integer division so if any numbers are of type double convert to integers where necessary.
// Referring to the table:
//amnt; numOfFifties and numOfTwenties are integer variables
// also need remainder as integer variable.
//amnt; numOfFifties and numOfTwenties are integer variables
// also need remainder as integer variable.
// pseudocode for sorting into $20 & $50
numOfFifties = amnt / 50;
remainder = amnt – numOfFifties * $50;
numOfTwenties = remainder / $20;
remainder = amnt – numOfFifties * $50;
numOfTwenties = remainder / $20;
// The above code works but not for values such as 60, 80, 110, etc.
// Because of integer division it won't give us the values we want in the table.
// So we have to test for those values and add some more codes to make it work.
// The following codes work for all values.
numOfFifties = amnt / $50;
remainder = amnt – (numOfFifties * $50);
//Here is the test for these values
if ( (remainder % $20) != 0 ) {
numOfFifties = numOfFifties – 1; // Change back to the previous $50 counter
remainder = amnt – (numOfFifties * $50);
numOfTwenties = remainder / $20;
} else { // This is where it isn't those values that sit on the border
numOfFifties = amnt / $50
remainder = amnt – (numOfFifties * $50);
numOfTwenties = remainder / $20;
} // end else
} // end if
Subscribe to:
Posts (Atom)