#include #include /* Homework 6, Dan Bennett Algorithm Ask for the price - pennies - flakies - buckies convert price to price in pennies Ask for the paid - pennies - flakies - buckies convert paid to paid in pennies totalPenniesPaid = penniesPaid + flakiesPaid * PENNIES_PER_FLAKIE + buckiesPaid * PENNIES_PER_BUCKIE or replace the second line with + buckiesPaid * PENNIES_PER_FLAKIE * FALKIES_PER_BUCKIE Reduice price to optimum representation buckiesPrice = totalPenniesPrice / PENNIES_PER_BUCKIE totalPenniesPrice = totalPenniesPrice % PENNIES_PER_BUCKIE flakiesPrice = totalPenniesPrice / PENNIES_PER_FLAKIE totalPenniesPrice = totalPenniesPrice % PENNIES_PER_FLAKIE Print this out Reduice paid to optimum representation Print this out find change change = painInPennies - priceInPennies reduce change to optimum representation Print this out */ using namespace std; const int PENNIES_PER_FLAKIE{11}; const int FLAKIES_PER_BUCKIE{7}; const int PENNIES_PER_BUCKIE{PENNIES_PER_FLAKIE * FLAKIES_PER_BUCKIE}; int main() { int penniesCost{0}, flakiesCost{0}, buckiesCost{0}; int totalPenniesCost{0}; // get the price cout << "Enter the pennies of the price "; cin >> penniesCost; cout << "Enter the flakies of the price "; cin >> flakiesCost; cout << "Enter the buckies of the price "; cin >> buckiesCost; // convert the price to pennies totalPenniesCost = penniesCost + flakiesCost * PENNIES_PER_FLAKIE + buckiesCost * PENNIES_PER_BUCKIE; penniesCost = totalPenniesCost; buckiesCost = penniesCost / PENNIES_PER_BUCKIE; penniesCost = penniesCost % PENNIES_PER_BUCKIE; flakiesCost = penniesCost / PENNIES_PER_FLAKIES; penniesCost = penniesCost % PENNIES_PER_FLAKIES; return 0; }