Question

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

c#

Programming Exercise 5-5 Instructions E l.nl 7 8 9 10 11 Danielle, Edward, and Francis are three salespeople at Holiday Homes

Programming Exercise 5-5 Instructions An example of the program is shown below: will Enter a salesperson initial >> D Enter a

In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCulture Info method. In order t

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

Short Summary:

  • Provided the source code and sample output as per the requirements

Source Code:

using System;
using System.Globalization;

class HomeSales {
static void Main() {
string initial = "";
int dSale = 0;
int eSale = 0;
int fSale = 0;
int total = 0;
  
// iterates till the user entered initial is z
while (initial != "z")
{
// get user input
Console.WriteLine("Enter a salesperson initial:");
initial = Console.ReadLine().ToLower();
//check for the initial
if(initial == "d" || initial == "e" || initial == "f"){
// get sale amount from user
Console.WriteLine("Enter amount of sale:");
// converting the inlut to int
int amount = Convert.ToInt32(Console.ReadLine());
// based on the initial adding it to repecitive variable
if (initial == "d")
dSale += amount;
else if (initial == "e")
eSale += amount;
else if (initial == "f")
fSale += amount;

}else{
// error message for wron initial
if(initial != "z"){
Console.WriteLine("Sorry - invalid salesperson");
}
}
}
// calculationg total amount
total = dSale + eSale + fSale;
  
// displaying the result using currency symbol
Console.WriteLine("Danielle sold: {0}", dSale.ToString("C", CultureInfo.GetCultureInfo("en-US")));
Console.WriteLine("Edward sold: {0}", eSale.ToString("C", CultureInfo.GetCultureInfo("en-US")));
Console.WriteLine("Francis sold: {0}", fSale.ToString("C", CultureInfo.GetCultureInfo("en-US")));
Console.WriteLine("Total sales were: {0}", total.ToString("C", CultureInfo.GetCultureInfo("en-US")));
  
  
// finding the most sold
if(dSale > eSale && dSale > fSale){
Console.WriteLine("Danielle sold the most");
}else if(eSale > dSale && eSale > fSale){
Console.WriteLine("Edward sold the most");
}else if(fSale > dSale && fSale > eSale){
Console.WriteLine("Francis sold the most");
}else {
Console.WriteLine("There was a tie");
}
}
}

Refer the following screenshots for code indentation:

main.cs 1- using System; 2 using System. Globalization; 3 4. class HomeSales { 5 static void Main() { 6 string initial 7 int48 49 50 51 52 53 54 - 55 56 57 58 59 60 } 61 // finding the most sold if(dSale > eSale && dSale > fSale){ Console.WriteLine(

Sample Run:

Enter a salesperson initial: D Enter amount of sale: 10 Enter a salesperson initial: D Enter amount of sale: 2 Enter a salesp

**************************************************************************************

Feel free to rate the answer and comment your questions, if you have any.

Please upvote the answer and appreciate our time.

Happy Studying!!!

**************************************************************************************

Add a comment
Know the answer?
Add Answer to:
c# Instructions In Chapter 5, you wrote a HomeSales application for three salespeople: 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
  • 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...

  • 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...

  • 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...

  • Need help with this programming please this is the instruction my teacher provided Write a C++...

    Need help with this programming please this is the instruction my teacher provided Write a C++ class called "Sales" and a main( ) function that uses the class. Also, write documentation of your project. Below is a specification of the class. . INTRODUCTION A company has four salespeople (1 to 4) who sell five different products ( to 5)1. Once a day each salesperson passes in a slip for each different type of product sold. Each slip contains: The salesperson...

  • Sales Data Analysis A company has multiple salespeople. Every month, they go on road trips to sel...

    Sales Data Analysis A company has multiple salespeople. Every month, they go on road trips to sell the company's product. At the end of each month, the total sales for each sales person, together with that salesperson's ID and the month, is recorded in a file. At the end of each year, the manager of the company wants to see an Annual Sales Report in the format illustrated in the sample execution below. Your report should look substantially similar to...

  • 1. You are given a C file which contains a partially completed program. Follow the instructions...

    1. You are given a C file which contains a partially completed program. Follow the instructions contained in comments and complete the required functions. You will be rewriting four functions from HW03 (initializeStrings, printStrings, encryptStrings, decryptStrings) using only pointer operations instead of using array operations. In addition to this, you will be writing two new functions (printReversedString, isValidPassword). You should not be using any array operations in any of functions for this assignment. You may use only the strlen() function...

  • Lab 6 Instructions Objectives: • Executing and experimenting with programs that handle array related topics such...

    Lab 6 Instructions Objectives: • Executing and experimenting with programs that handle array related topics such as declaration, initialization, storing, retrieving, and processing elements. • Effectively manipulating and using ArrayList objects. • Becoming familiar with the use of arrays as method arguments and how array elements are passed to and returned from the called method. • Mastering the use of various debugging tools available on the Eclipse IDU. Important: EVERY one of the following Activities MUST be in a separate...

  • For Java Program In this lab you will gain experience using all the concepts we learned...

    For Java Program In this lab you will gain experience using all the concepts we learned to this point, which include classes, methods, collections, and file input/output. Also, you will gain experience in team programming. This assignment will be completed by teams of 2. Each member must complete an equal amount of the work in order to receive credit for this assignment. You must write the programmer’s name in a comment for each method you write. You need to create...

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