Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C# Visual Studio CONSOLE GUI application: Write a program that displays the numb

ID: 3664327 • Letter: C

Question

C# Visual Studio CONSOLE

GUI application:

Write a program that displays the number of dollars, quarters, dimes, nickels, and pennies that a customer should get back as change.

There should be an input field for total due as well as an input field for currency given.

Declare and initialize all memory locations as integers.

The output fields should show the total change as a monetary amount, with two positions to the right of the decimal, and there should be output fields for the number of quarters, dimes, nickels, and pennies. Please TEST OUTPUT

a. Challenge: Have an option to choose one of 3 currencies: 1. US Dollar, 2. Chilean Peso, and 3. Euro. The appropriate fields should be altered to display the change

Explanation / Answer

Code Snippet

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace Program

{

   class Changer

   {

   static void Main(string[] args)

   {

   int totalCents, quart, dim, nic, pen;

   totalCents = GetValue();

   quart = GetTheCalculationq(totalCents);

   totalCents = totalCents - quart * 25;

   dim = GetTheCalculationd(totalCents);

   totalCents = totalCents - dim * 10;

   nic = GetTheCalculationn(totalCents);

   totalCents = totalCents - nic * 5;

   pen = totalCents;

   DisplayResults(pen, quart, dim, nic);

   Console.ReadLine();

   }

   static int GetValue()

   {

   string pen;

   int coin;

   Console.WriteLine("Enter the currency:");

   pen = Console.ReadLine();

   coin = int.Parse(pen);

   return (coin);

   }

   static int GetTheCalculationq(int totalCents)

   {

   int quarters;

   quarters = (totalCents / 25);

   return (quarters);

   }

   static int GetTheCalculationd(int totalCents)

   {

   int dimes;

   dimes = (totalCents / 10);

   return (dimes);

   }

   static int GetTheCalculationn(int totalCents)

   {

   int nickels;

   nickels = (totalCents / 5);

   return (nickels);

   }

   static void DisplayResults(int pen, int quart, int dim, int nic)

   {

   Console.Write("There are {0:F} pennies. ", pen);

   Console.Write("There are {0:F} nickels. ", nic);

   Console.Write("There are {0:F} dimes. ", dim);

   Console.Write("There are {0:F} quarters. ", quart);

   }

   }

}