Question

Use Microsoft Visual Studio C# only, don't need a GUI. Use Console interface Danielle, Edward, and...

Use Microsoft Visual Studio C# only, don't need a GUI. Use Console interface

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 total of the amounts sold by each salesperson. After the user types Z or zfor an initial, display each salesperson’s total, a grand total for all sales, and the name of the salesperson with the highest total.

Please use WHILE loop. Use basic programming and don't use arrays.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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

namespace HomeSales
{
class Program
{
static void Main(string[] args)
{
char initial;
int amountSale;
int totalAmtSaleD=0, totalAmtSaleE=0, totalAmtSaleF=0;


while (true)
{
Console.WriteLine(Environment.NewLine );
  
Console.Write("Enter salesperson Initial : ");
initial = Convert.ToChar(Console.ReadLine());

if (initial == 'D' || initial == 'd')
{
Console.Write("Enter the amount of salesPerson D : ");
amountSale = Convert.ToInt32(Console.ReadLine() );
totalAmtSaleD = totalAmtSaleD + amountSale;
}
else if (initial == 'E' || initial == 'e')
{
Console.Write("Enter the amount of salesPerson E : ");
amountSale = Convert.ToInt32(Console.ReadLine());
totalAmtSaleE = totalAmtSaleE + amountSale;

}
else if (initial == 'F' || initial == 'f')
{
Console.Write("Enter the amount of salesPerson F : ");
amountSale = Convert.ToInt32(Console.ReadLine());
totalAmtSaleF = totalAmtSaleF + amountSale;

}
else if (initial == 'Z' || initial == 'z')

{
break;
}
else
{
Console.WriteLine("Error Message: Invalid initial entered!!");
}
}
Console.WriteLine(Environment.NewLine);
Console.WriteLine(Environment.NewLine);

Console.WriteLine("Total amount of sale of D : "+totalAmtSaleD );
Console.WriteLine("Total amount of sale of E : " + totalAmtSaleE);
Console.WriteLine("Total amount o sale of F : " + totalAmtSaleF);


Console.WriteLine(Environment.NewLine);
Console.WriteLine(Environment.NewLine);

int grandTotal = totalAmtSaleD + totalAmtSaleE + totalAmtSaleF;


Console.WriteLine("Grand total for all the sales : "+grandTotal );

Console.WriteLine(Environment.NewLine);
Console.WriteLine(Environment.NewLine);

if (totalAmtSaleD > totalAmtSaleE && totalAmtSaleD > totalAmtSaleF)
{
Console.WriteLine("Name of the salesperson with the highest Total is D (Danielle)");

}
else if (totalAmtSaleE>totalAmtSaleD && totalAmtSaleE >totalAmtSaleF )
{

Console.WriteLine("Name of the salesperson with the highest Total is E (Edward)");

}
else
{

Console.WriteLine("Name of the salesperson with the highest Total is F (Francis)");


}

Console.ReadKey();
}
}
}

Add a comment
Know the answer?
Add Answer to:
Use Microsoft Visual Studio C# only, don't need a GUI. Use Console interface Danielle, Edward, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Danielle, Edward, and Francis are three salespeople at Holiday Homes. Write an application named HomeSales that...

    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 total of the amounts sold by each salesperson. After the user types Z or zfor an initial, display...

  • c# Instructions In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and...

    c# Instructions In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and Francis. Now, using the code you wrote in Chapter 5, Programming Exercise 5, modify the program to use arrays to store the salesperson names, allowed initials, and accumulated sales values. In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System. Globalization; at the top of your...

  • In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and Francis. Now,...

    In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and Francis. Now, using the code you wrote in Chapter 5, Programming Exercise 5, modify the program to use arrays to store the salesperson names, allowed initials, and accumulated sales values. In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format...

  • In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and Francis. Now,...

    In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and Francis. Now, using the code you wrote in Chapter 5, Programming Exercise 5, modify the program to use arrays to store the salesperson names, allowed initials, and accumulated sales values. In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT