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
What e-mail protocol does Marina and Rita’s Cupcakes use and why is it important?
Taya2010 [7]

Marina and Rita’s Cupcakes use the IMAP email protocol. It is important since it stores copies of all the emails stored on the server.

 

To add, IMAP<span> (Internet Message Access Protocol) is a standard email protocol that stores email messages on a mail server, but allows the end user to view and manipulate the messages,</span>

8 0
3 years ago
If Carly wants to add wind belts for the part of the Atlantic just south of the equator, how should she draw the arrows?The arro
AnnyKZ [126]

If Carly wants to add wind belts for the part of the Atlantic just south of the equator, she should draw the arrows upward to the left. <span> At the South of the equator are trade winds which blow wind from the northeast toward the equator. </span>

4 0
3 years ago
Describe one way that cells use water
antiseptic1488 [7]
In chemical reactions, as a carrier of materials or keeping the temperature of cells from quickly changing.
8 0
3 years ago
Calculate the wait time and turnaround time for FCFS, shortest remaining time, and round-robin by drawing a diagram or chart. As
lidiya [134]

Answer:

id id d

Explanation:

4 0
2 years ago
Read 2 more answers
What is the answer ?? plz help
Morgarella [4.7K]
3rd: A force applied to a body to propel it in a desired direction.
5 0
2 years ago
Other questions:
  • Catherine wants to search online for fruit juices. She is fine with aerated or fresh fruit juices. Which Boolean operator will e
    12·2 answers
  • A raised dot (ú) shows where the ENTER key was pressed. <br> a. True<br> b. False
    15·1 answer
  • In the early part of labor, contractions come every
    6·1 answer
  • C - Language Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. E
    12·1 answer
  • What is the HIPAA Privacy rule, and why does it affect IT professionals?
    5·1 answer
  • Melanie needs to ensure that readers are able to locate specific sections within a document easily. What should she include in
    8·1 answer
  • 14. Which of the following is NOT likely to be one of the future development gaming industry?
    7·1 answer
  • I have a Dell laptop and last night it said that it needed to repair it self and asked me to restart it. So I did but every time
    11·1 answer
  • Kylee needs to ensure that if a particular client sends her an email while she is on vacation, the email is forwarded to a cowor
    7·1 answer
  • Chức năng của hàm MOD(number, divisor)?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!