
Nya H.
asked 09/10/22Write codes for the following two functions
Write codes for the following two functions and upload them as a single pdf file.
- Write the function add-coins which consumes a number of pennies, nickels, dimes, and quarters and produces the amount of money.
- Write the function bologna-latin which consumes a string and returns a string with the first letter moved to the end of the string with “ay”. For example, “computer” would become “omputercay” and “example” would become “xampleeay”.
1 Expert Answer

Kevin C. answered 12/21/22
Experienced Computer Programmer Looking to Share Knowledge
private double addcoins(Coins objCoins)
{
double total = 0;
foreach(Coins c in objCoins)
{
switch(c.Type)
{
case "quarter":
total += .25;
break;
case "dime":
total += .10;
break;
case "nickel":
total += .05;
break;
case "penny":
total += .01;
break;
}
}
return total;
}
private string bolognalatin(string input)
{
var strFirstLetter = input.Substring(0, 1);
return input.Substring(1) + strFirstLetter + "ay";
}
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Gregory R.
09/12/22