Write a program that stores the weekly (Monday thru Friday) sales totals for three salespersons. Your program should allow the user to enter the sales amounts and print a sales report with headings, the daily totals for each salesperson (your two-dimensional array), the calculated weekly totals for each sales person and the calculated totals for the day of each salesperson. In addition, create a single-dimensional array of Strings representing the days of the week (Monday-Friday) using an initializer list. Your program output should look like the following:
Input Screen
Enter Monday Totals for Salesperson 1: 10.00
Enter Tuesday Totals for Salesperson 1: 20.00
Enter Wednesday Totals for Salesperson 1: 30.00
(etc.)
Enter Monday Totals for Salesperson 2: 60.00
(etc.)
Output Screen
Weekly Sales Report
Mon Tue Wed Thurs Fri Total
1 10.00 20.00
30.00 40.00 50.00
150.00
2 60.00 70.00 80.00
90.00 10.00 310.00
3 20.00 30.00 40.00
50.00 60.00 200.00
--------------------------------------------------------------
90.00 120.00 150.00
180.00 120.00
660.00
Computer Programming 2
Java coding
code:
import java.lang.*;
import java.io.*;
import java.util.*;
class Test{
public static void main(String[] args){
String week_names[] =
{"Monday","Tuesday","Wednesday","Thursday","Friday"};
int list[][] = new int[3][5];
int i,j;
int mon_s = 0, tue_s = 0, wed_s =
0, thu_s = 0, fri_s = 0, sat_s = 0, sun_s = 0;
int sales_sum[] = {0,0,0};
Scanner sc = new
Scanner(System.in);
for(i=0;i<3;i++){
for(j=0;j<5;j++){
System.out.print("Enter " + week_names[j] + "
for Salesperson " + (i+1) + " : " );
list[i][j] = sc.nextInt();
}
}
// for monday total
for(i=0;i<3;i++){
mon_s = mon_s +
list[i][0];
}
// for tuesday total
for(i=0;i<3;i++){
tue_s = tue_s +
list[i][1];
}
// for wednesday total
for(i=0;i<3;i++){
wed_s = wed_s +
list[i][2];
}
// for thursday total
for(i=0;i<3;i++){
thu_s = thu_s +
list[i][3];
}
// for firday total
for(i=0;i<3;i++){
fri_s = fri_s +
list[i][4];
}
// for salesperson1 total
for(i=0;i<5;i++){
sales_sum[0] +=
list[0][i];
}
// for salesperson2 total
for(i=0;i<5;i++){
sales_sum[1] +=
list[1][i];
}
// for salesperson3 total
for(i=0;i<5;i++){
sales_sum[2] +=
list[2][i];
}
// printing the whole things
System.out.println("Weekly Sales
Report");
System.out.println("\tMon\tTue\tWed\tThurs\tFri\tTotal");
for(i=0;i<3;i++){
System.out.print("" + (i+1) + "\t");
for(j=0;j<5;j++){
System.out.print(list[i][j] + "\t");
}
System.out.print("" + sales_sum[i]);
System.out.println();
}
System.out.println("---------------------------------------------------");
System.out.println("\t"+mon_s +
"\t"+tue_s+"\t"+wed_s+"\t"+thu_s+"\t"+fri_s+"\t"+(sales_sum[0] +
sales_sum[1] + sales_sum[2]));
}
}
output:
Write a program that stores the weekly (Monday thru Friday) sales totals for three salespersons. Your...
C++ Objective: Write a program to read a pre-specified file containing salespersons' names and daily sales for some number of weeks. It will create an output file with a file name you have gotten from the user that will hold a summary of sales data. Specifications: 1. You should do a functional decomposition to identify the functions that you will use in the program. These should include reading and writing the files, tallying and showing statistics, etc. 2. The program...
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, 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...