// 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();
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);
Console.ReadLine();
}
}
}
Comments
Leave a comment