107 286
Assignments Done
97.9%
Successfully Done
In March 2023

# Answer to Question #245423 in C# for Anino

Question #245423

// Compute the amount in the Piggy Bank

amtInPiggyBank = numPens * 0.01 + numNicks * 0.05 + numDimes * 0.1 + numQuarts * 0.25 + numLoons * 1 + numTwoons * 2;

// Print out the amount in the Piggy Bank

//*** Fix the following statement so it prints a $and two digits //*** after the decimal point Console.WriteLine("{0} has {1} in the Piggy Bank", name, amtInPiggyBank); Console.ReadLine(); 1 Expert's answer 2021-10-01T13:27:48-0400 using System; using System.IO; using System.Collections.Generic; namespace App { class Program { static void Main(string[] args) { // Compute the amount in the Piggy Bank double numPens = 5; double numNicks = 5; double numDimes = 5; double numQuarts = 5; double numLoons = 5; double numTwoons = 5; double amtInPiggyBank = numPens * 0.01 + numNicks * 0.05 + numDimes * 0.1 + numQuarts * 0.25 + numLoons * 1 + numTwoons * 2; string name = "Peter"; // Print out the amount in the Piggy Bank //*** Fix the following statement so it prints a$ and two digits

//*** after the decimal point

Console.WriteLine("{0} has \${1:N2} in the Piggy Bank", name, amtInPiggyBank);
}

}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!