PLEASE NOTE : FEEL FREE TO ASK ANY DOUBTS by COMMENTING
Language : C++ Programming
IDE : Dev C++
:::::::::::::::::::::::::::::::::::::::::::: CODE ::::::::::::::::::::::::::::::::::::::::
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main(){
// seed random
srand(time(0));
// no of branches, categories
int count = 5;
int cat = 3;
// 2d array
int sales[count][cat];
// loop to create random sales
for(int i=0; i<count; i++){
for(int j=0; j<cat; j++){
// create random
number in range 300-1000
sales[i][j] =
rand()%701+300;
}
}
// highest sale, lowest sale
int highest = sales[0][0];
int lowest = sales[0][0];
// print sales data
cout << "SaleID Morning Afternoon
Evening\n\n";
for(int i=0; i<count; i++){
cout << i+1 <<
"\t";
for(int j=0; j<cat; j++){
cout <<
sales[i][j] << "\t";
// check
lowest and highest values and update
if(highest<sales[i][j]){
highest = sales[i][j];
}
if(lowest>sales[i][j]){
lowest = sales[i][j];
}
}
cout << endl;
}
// print highest and lowest sales amount
cout << "\nHighest Sale Amount : " <<
highest << endl;
cout << "\nLowest Sale Amount : " <<
lowest << endl;
// find average of sales of shopID 3 and
print
double avg_of_id3 = 0;
for(int i=0; i<cat; i++){
avg_of_id3 =
avg_of_id3+sales[2][i];
}
avg_of_id3 = avg_of_id3/cat;
cout << "\nAverage of sales amount done by shop
ID: 3 = " << avg_of_id3 << endl;
// assign first sale of evening as highest sale in
the evening
int highest_sale_in_evening = sales[0][2];
int shop_id = 0;
// loop to find highest sale id in evening
for(int i=1; i<count; i++){
// update highest evening amount
and shopID
if(sales[i][2] >
highest_sale_in_evening){
highest_sale_in_evening = sales[i][2];
shop_id =
i;
}
}
// print shop ID for highest sale in evening
cout << "\nHighest sale in the evening done by
Shop ID: " << shop_id+1 << endl;
// total of morning and afternoon sales
int morning_total = 0;
int afternoon_total = 0;
for(int i=0; i<count; i++){
morning_total =
morning_total+sales[i][0];
afternoon_total =
afternoon_total+sales[i][1];
}
// if morning greater than afternoon sales, print
"Yes" else "No"
cout << "\nMorning sales total are Higher than
Afternoon sales: ";
if(morning_total>afternoon_total){
cout << "Yes\n";
}
else{
cout << "No\n";
}
return 0;
}
:::::::::::::::::::::::::::::::::::::::::::: OUTPUT ::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::: CODE in EDITOR ::::::::::::::::::::::::::::::::::
_________________________________________________________________
Dear Friend, Feel Free to Ask Any Doubts by Commenting. ASAP i'll respond when i'm available.
I'm on a critical Situation. Please Do Not Forget To Give A Thumbs UP +1. It will Helps me A Lot.
Thank YOU :-)
Write c++ program In this assignment, you need to complete following tasks on 2D array of...
Write c++ program
In this assignment, you need to complete following tasks on 2D array of randomly sales figures. Assume that you are the manager of coffee shop chain, and oversee 5 branches. ID of branches are 1 to 5. You already collected sales data for yesterday from each branch, in three categories: morning, afternoon, and evening. First, you need to create a 2D array (5x3) with random numbers between 300 and 1000 (including 300 and 1000), i.e., from $300...
c++ please
Instructions In this assignment, you need to complete following tasks on 2D array of randomly sales figures. Assume that you are the manager of coffee shop chain, and oversee 5 branches. ID of branches are 1 to 5. You already collected sales data for yesterday from each branch, in three categories: morning, afternoon, and evening. First, you need to create a 2D array (5x3) with random numbers between 300 and 1000 (including 300 and 1000), i.e., from $300...
Write a Java program that does the following. a. Declare an integer 2D array with 5 rows and 5 columns. b. Initialize the array's elements to random integers between 1 and 10 (inclusive). c. Display all the elements in the 2D array as a table of rows and columns. d. Display the row index and column index of all the even integers in the 2D array. e. Display the sum of first row's elements.
In C++ for 2D Array:
Write a program that uses a function that manipulates a 2D array of integers as follows: 1. Fill the first row and column in the array with random bits 2. Every subsequent cell should be filled as follows: 1. If the cells that are to the left and top of it are equal, then you should store their sum in it b. Otherwise, your program should store the highest among them. Test your function using...
Use C++ (2D Array) Write a program which: 1. Assigns data given below into the 2D array of integers which is 10x10. 2. Prints out the contents of the 2D array after assigning the data to make sure correct data was assigned. 3. Figures out and prints out the square root of the sum of ALL the elements in the 2D array. 4. Figures out and prints out the average of ALL THE ELEMENTS in the 2D array. 5. Figures...
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...
write c++ program
This assignment is about array operations. You need to count a specific items in an array. Steps to follow are here: . Create an array with 1000 items and fill it with random numbers from the range of -100, 100 (including -100 and 100). In your program asks user to enter a number, K. Search this number and print the frequency (how many) of this K is found in the array. • Ask another number, and so...
Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. You should also have a parallel array to store the names of the 12 months. The program should read the Month's names, and the temperatures from a given input file called temperature.txt. The program should output the highest and lowest temperatures for the year, and the months that correspond to those temperatures. The program must use the following functions:...
Write SQL statements to answer the following questions using Assignment 3’s schema (tables from part 1). 1- Find how many branches had have loans over $2000.00. 2- For each branch, find the most expensive loan. Your output should include Branch Id, loan amount for the highest loan for that Branch. 3- Find how many accounts there are for each customer. The output should include customer id and number of accounts for that customer. 4- Find the total balance amount of...
using java
Program: Please read the complete prompt before going into coding. Write a program that handles the gradebook for the instructor. You must use a 2D array when storing the gradebook. The student ID as well as all grades should be of type int. To make the test process easy, generate the grade with random numbers. For this purpose, create a method that asks the user to enter how many students there are in the classroom. Then, in each...