Report a paste

Please put a quick comment for the admin.

If it looks like spam, the admin will mark it as spam so that the spam filter picks it up in the future.

If the paste contains something private or offensive, it'll probably just be deleted.

No title

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Midterm2602Solution_Methods
{
    class Program
    {
        static void Main(string[] args)
        {
            ConfingureConsole();

            double coinValue;  // hold a coins value
            double totalValue = 0;  // initialize accumulator
            int counter = 0;  // initialize accumulator

            // print title
            Console.WriteLine("\tCoin Worth Application\n");

            // prompt for name
            Console.Write("Enter your name: ");
            string name = Console.ReadLine();

            // initialize condition variable for loop
            Console.Write("Do you want to enter coin (Yes/No)");
            string choice = Console.ReadLine();

            while( choice == "Yes" ) // 2 - check the condition
            {
                // 3 - work
                Console.Write("Enter weight: ");
                double weight = double.Parse(Console.ReadLine());

                Console.Write("Is it gold? (Y/N): ");
                string isGold = Console.ReadLine();

                // conditional logic for determining coin price
                if( isGold == "Y" )
                {
                    coinValue = weight * 29.02;
                    counter++;
                }
                else
                {
                    coinValue = weight * 0.55;
                }

                // totalValue = totalValue + coinValue;
                totalValue += coinValue;

                // Display coin value
                Console.WriteLine("This coin is worth {0:C}", coinValue);

                // 4 -update the condition variable
                Console.Write("Do you want to enter coin (Yes/No)");
                choice = Console.ReadLine();
            }

            Console.WriteLine("Results for {0}", name);
            Console.WriteLine("The value of all coins is {0:C}", totalValue);
            Console.WriteLine("You entered {0} gold coins", counter);

            Console.ReadKey(); // pause the screen;
        }


        // configureconsole method -- no input parameters or return value
        static void ConfingureConsole()
        {
            Console.Title = "Midterm solution";
            Console.BackgroundColor = ConsoleColor.White;
            Console.ForegroundColor = ConsoleColor.Black;
            Console.Clear(); // flush the colors over the console
        }

        // string prompt method - takes string as parameter, returns string result
        static string StringPrompt( string s )
        {
            Console.Write(s);
            string result = Console.ReadLine();  
            return result;
            // return Console.ReadLine();  // condensed example
        }


    }
}