1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Tatiana [17]
3 years ago
6

KDS Company has 3 departments: 1. Dept X 2. Dept Y 3. Dept Z. Design a program that will read as input each department's sales f

or each quarter of the year, and display the result for all divisions.
Computers and Technology
1 answer:
stiv31 [10]3 years ago
6 0

Complete Question:

Design a program that will use a pair of nested loops to read the company's sales amounts. The details are as follows: -

KDS Company has 3 departments: 1. Dept X 2. Dept Y 3. Dept Z. Design a program that will read as input each department's sales for each quarter of the year and display the result for all divisions. Use a two-dimensional array that will have 3 rows and 4 columns

Answer:

In C++:

#include<iostream>  

using namespace std;  

int main() {  

   int depts[3][4];

   char dptcod [3] ={'X','Y','Z'};

   for (int rrw = 0; rrw < 3; rrw++) {  

       for (int cll = 0; cll < 4; cll++) {  

           cout<<"Dept "<<dptcod[rrw]<<" Q"<<(cll+1)<<": ";

           cin>>depts[rrw][cll];  }  }  

       for (int rrw = 0; rrw < 3; rrw++) {  

           int total = 0;

           for (int cll = 0; cll < 4; cll++) {  

               total+=depts[rrw][cll]; }

               cout<<"Dept "<<dptcod[rrw]<<" Total Sales: "<<total<<endl;}  

   return 0; }

Explanation:

This declares the 3 by 4 array which represents the sales of the 3 departments

   int depts[3][4];

This declares a character array which represents the character code of each array

   char dptcod [3] ={'X','Y','Z'};

This iterates through the row of the 2d array

   for (int rrw = 0; rrw < 3; rrw++) {  

This iterates through the column

       for (int cll = 0; cll < 4; cll++) {

This prompts the user for input

           cout<<"Dept "<<dptcod[rrw]<<" Q"<<(cll+1)<<": ";

This gets the input

           cin>>depts[rrw][cll];  }  }  

This iterates through the row of the array

       for (int rrw = 0; rrw < 3; rrw++) {

This initializes total sum to 0

           int total = 0;

This iterates through the column

           for (int cll = 0; cll < 4; cll++) {

This calculates the total sales of each department

               total+=depts[rrw][cll]; }

This prints the total sales of each department

               cout<<"Dept "<<dptcod[rrw]<<" Total Sales: "<<total<<endl;}  

You might be interested in
A(n) __________ is a recording of a motion picture, or television program for playing through a television.
lisabon 2012 [21]
A video is a recording of a motion, or television program for playing through a television. A camcorder is a device or gadget that is used to record a video. audio is the sounds that we hear and mix media is a tool used to edit the video.
3 0
3 years ago
Read 2 more answers
During the name resolution process, which technique is used to avoid congestion when querying a server
vekshin1

Answer:

"NOT lookup " is the correct approach.

Explanation:

  • This methodology significantly reduces the quantity of congestion of DNS messages on a certain file. The application establishes that whenever a question reaches if it is processed. Unless the file is loaded, then perhaps the response is returned with the cached cache.
  • Typically the name resolution occurs in something like a DNS File. The conversion usually occurs throughout this cycle from Username to IP, including IP via Username.
8 0
3 years ago
Where does gateway antivirus scan for viruses
Serggg [28]
Gateway antivirus scan for viruses at the application level. Gateway antivirus allows for the checking of files for viruses by providing a web-based scanning service. It provides integrated antivirus security on the system which block the potential threat before reaching the network.
7 0
4 years ago
Where can the slide layout be changed?
max2010maxim [7]
Slide layout can be changed from the edit menu :)
6 0
3 years ago
Read 2 more answers
Por que es importante el audlamiento social en una pandemia por virus biológico
a_sh-v [17]

Answer:.

Explanation:

7 0
3 years ago
Other questions:
  • Which answer best describes an unsubsidized federal loan
    9·1 answer
  • Add is a function that accepts two int parameters and returns their sum.
    8·1 answer
  • Write a c++ function, largestnum, that takes as parameters a double array and its size and returns the index of the last occurre
    14·1 answer
  • Can a computer will work more efficiently if you perform disk optimization
    9·1 answer
  • Assume that input file references a Scanner object that was used to open a file. Which of the following while loops shows the co
    6·1 answer
  • What is the real meaning of hack and crack?
    6·1 answer
  • All living organisms make up the (4 points)
    8·1 answer
  • PLEASE VERY IMPORTANT Conduct research on graphic design skills in your area and explore the different courses that they offer l
    12·1 answer
  • Most printers are plug and play compatible and must be manually configured when they are plugged into the system.
    14·2 answers
  • Write a script that will read from a file x and y data points in thefollowing format:
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!