212k views
2 votes
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 z for an initial, display each salesperson’s total and a grand total for all sales.

User Arnaud H
by
3.0k points

2 Answers

4 votes

Final answer:

The question is about developing a 'HomeSales' application for tracking individual and total sales by salespeople, continuing input until 'Z' is entered, and providing an error message for invalid inputs.

Step-by-step explanation:

The student's question revolves around creating an application named HomeSales which is focused on tracking sales data for a group of salespeople. When prompted, a user can enter either 'D', 'E', or 'F' to represent sales made by Danielle, Edward, or Francis respectively. The application continues to ask for sales amounts until the user enters 'Z' to terminate data entry. Invalid initials would trigger an error message. In the end, the application must display a total for each salesperson, as well as a grand total of all sales combined.

User LukasNeugebauer
by
3.7k points
3 votes

Answer:

See explaination

Step-by-step explanation:

Program source code

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);

}

}

}

User ElJackiste
by
3.3k points