Question

In: Computer Science

Create the program using C# A business records its daily sales totals. Enter the following weekly...

Create the program using C#

A business records its daily sales totals. Enter the following weekly sales information into an array.

1245.67

1189.55

1089.72

1456.88

2109.34

1987.55

1872.36

Once, the information has been entered into the array. Access the items in the array to find and display the following:

  • Total Sales
  • Weekly Sales Average
  • Largest Daily Sales
  • Smallest Daily Sales

Solutions

Expert Solution

using System;

namespace WeeklySales
{
   class MainClass
   {
       public static void Main (string[] args)
       {
           double[] weeklySales=new double[7];
           int i;
           double totalSales=0.0,averageSales=0.0,maxDailySales=0.0,minDailySales=0.0;
           Console.WriteLine ("Enter Sales information");
           for(i=0;i<7;i++)
           weeklySales[i]=Convert.ToDouble(Console.ReadLine());
           //compute total sales
           for(i=0;i<7;++i)
           totalSales+=weeklySales[i];
           //compute average sales
           averageSales=totalSales/7;
           minDailySales=weeklySales[0];
           //compute minimum and maximum daily sales
           for(i=0;i<7;i++)
           {
               if(minDailySales>weeklySales[i])
                   minDailySales=weeklySales[i];
               if(maxDailySales<weeklySales[i])
                   maxDailySales=weeklySales[i];
           }
           Console.WriteLine("Total Sales = {0}",totalSales);
           Console.WriteLine("Weekly Sales Average = {0}",averageSales);
           Console.WriteLine("Largest Daily Sales = {0}",maxDailySales);
           Console.WriteLine("Smallest Daily Sales = {0}",minDailySales);
          
       }
   }
}

Output

Enter Sales information
1245.67
1189.55
1089.72
1456.88
2109.34
1987.55
1872.36
Total Sales = 10951.07
Weekly Sales Average = 1564.43857142857
Largest Daily Sales = 2109.34
Smallest Daily Sales = 1089.72

Press any key to continue...


Related Solutions

Create a program that: Creates a sales receipt, displays the receipt entries and totals, and saves...
Create a program that: Creates a sales receipt, displays the receipt entries and totals, and saves the receipt entries to a file Prompt the user to enter the Item Name Item Quantity Item Price Display the item name, the quantity, and item price, and the extended price (Item Quantity multiplied by Item Price) after the entry is made Save the item name, quantity, item price, and extended price to a file When you create the file, prompt the user for...
Create a Python program that: Creates a sales receipt, displays the receipt entries and totals, and...
Create a Python program that: Creates a sales receipt, displays the receipt entries and totals, and saves the receipt entries to a file Prompt the user to enter the Item Name Item Quantity Item Price Display the item name, the quantity, and item price, and the extended price (Item Quantity multiplied by Item Price) after the entry is made Save the item name, quantity, item price, and extended price to a file When you create the file, prompt the user...
Create a python program that: Creates a sales receipt, displays the receipt entries and totals, and...
Create a python program that: Creates a sales receipt, displays the receipt entries and totals, and saves the receipt entries to a file Prompt the user to enter the Item Name Item Quantity Item Price Display the item name, the quantity, and item price, and the extended price (Item Quantity multiplied by Item Price) after the entry is made Save the item name, quantity, item price, and extended price to a file When you create the file, prompt the user...
Financial Records Create a program to store weekly expenses and revenues over a period of time....
Financial Records Create a program to store weekly expenses and revenues over a period of time. The program should store the expenses and revenues in two global array variables. Values stored in the array at index k represent the total revenues/expenses recorded during the k(th) week. Assume that the maximum number of weeks tracked is 250. Add the following functions to your program: - A function that finds the total of all expenses incurred since week t for a given...
Program: Java (using eclipse) Write a program that asks the user to enter today’s sales for...
Program: Java (using eclipse) Write a program that asks the user to enter today’s sales for five stores. The program should then display a bar chart comparing each store’s sales. Create each bar in the bar chart by displaying a row or asterisks. Each asterisk should represent $100 of sales. You must use a loop to print the bar chart!!!! If the user enters a negative value for the sales amount, the program will keep asking the user to enter...
C++ Program -------------------- Project 5-1: Monthly Sales Create a program that reads the sales for 12...
C++ Program -------------------- Project 5-1: Monthly Sales Create a program that reads the sales for 12 months from a file and calculates the total yearly sales as well as the average monthly sales. Console Monthly Sales COMMAND MENU m - View monthly sales y - View yearly summary x - Exit program Command: m MONTHLY SALES Jan        14317.41 Feb         3903.32 Mar         1073.01 Apr         3463.28 May         2429.52 Jun         4324.70 Jul         9762.31 Aug        25578.39 Sep         2437.95 Oct         6735.63 Nov          288.11 Dec         2497.49...
5) Create the following in a Java program Create a scanner Prompt the user to enter...
5) Create the following in a Java program Create a scanner Prompt the user to enter the name where the box of mail is shipping from and create the variable and relate to scanner Prompt the user to enter the name of destination where the box of mail will be shipped and create the variable and relate to scanner Prompt the user to enter the weight of the package and create variable to relate to scanner Calculate cost of shipping...
Time Calculator Create a C++ program that lets the user enter a number of seconds and...
Time Calculator Create a C++ program that lets the user enter a number of seconds and produces output according to the following criteria: • There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds. • There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or...
Fat Percentage Calculator Create a C++ program that allows the user to enter the number of...
Fat Percentage Calculator Create a C++ program that allows the user to enter the number of calories and fat grams in a food. The application should display the percentage of the calories that come from fat. If the calories from fat are less than 30% of the total calories of the food, it should also display a message indicating the food is low in fat. One gram of fat has 9 calories, so: Calories from fat = fat grams *...
Use c# Create a program called ResortPrices that prompts the user to enter the number of...
Use c# Create a program called ResortPrices that prompts the user to enter the number of days for a resort stay. Then display the price per night and the total price. Nightly rates are R 500.00 for one or two nights, R 650.00 for three or four nights, R 850.00 for five, six or seven nights, and R 1500.00 for eight nights or more.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT