In C create a console application for this challenge Daniell

In C# create a console application for this challenge, Danielle, Edward, and Francis are three salespeople at Holiday Homes. Write an application named HomeSales that prompts the user for a salesperson initial (D, E, or F). Either uppercase or lowercase initials are valid. While the user does not type Z, continue by prompting for the amount of a sale. Issue an error message for any invalid initials entered. Keep a running tool of the amounts sold by each salesperson. After the user types Z or z for an initial, display each salesperson’s total, a grand total for all sales, and the name of the salesperson with the highest total. Format the output to up to two decimal places.

Solution

HomeSales.cs

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

namespace _5HomeSalesConsole
{
    class HomeSales
    {
        static void Main(string[] args)
        {

//initial == \"D\" || initial == \"d\" || initial == \"E\" || initial == \"e\" || initial == \"F\" || initial == \"f\"

            WriteLine(\"Holiday Homes Salespeople include:\ Danielle\ Edward\ Francis\");
            string initial = \"\";
            //WriteLine(\"initial={0}\" ,initial);

            double dAmount = 0.00;
            double eAmount = 0.00;
            double fAmount = 0.00;
            double grandTotal = 0.00;

            while (initial != \"z\")
            {
                Write(\"\ Enter a salesperson\'s first initial: \");
                initial = ReadLine().ToLower();

                if (initial == \"d\" || initial == \"e\" || initial == \"f\")
                {
                    Write(\"Enter sales amount: \");
                    double salesAmount = Convert.ToDouble(ReadLine());

                    if (initial == \"d\")
                        dAmount += salesAmount;
                    else if (initial == \"e\")
                        eAmount += salesAmount;
                    else if (initial == \"f\")
                        fAmount += salesAmount;

                    grandTotal = dAmount + eAmount + fAmount;
                }
              
            }

            WriteLine(\"\ Danielle\'s Amount: {0:c}\"
                    + \"\ Edward\'s Amount: {1:c}\"
                    + \"\ Francis\' Amount: {2:c}\"
                    + \"\ \ Grand Total: {3:c}\", dAmount, eAmount, fAmount, grandTotal);

        }
    }
}

In C# create a console application for this challenge, Danielle, Edward, and Francis are three salespeople at Holiday Homes. Write an application named HomeSale
In C# create a console application for this challenge, Danielle, Edward, and Francis are three salespeople at Holiday Homes. Write an application named HomeSale

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site