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]
2 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]2 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
List some of the cautions related to costume change
Volgvan

Answer:

Costume Change?

Explanation:

You might not have enough time to complete the costume and it may look a little sloppy. Also, if you are in a play, everyone must be notified of the change.

4 0
2 years ago
Assume that c is a char variable has been declared and already given a value. write an expression whose value is true if and onl
lara [203]
Return isgraph(c));
////////////////

7 0
2 years ago
........................ allows you to press a key or code for insertion of long phrases that you may require using repeatedly w
ollegr [7]

Answer:

text expander

Explanation:

5 0
2 years ago
Read 2 more answers
Juan has performed a search on his inbox and would like to ensure that the results only include those items with
kogti [31]

Answer: Refine

Explanation:

From the question, we are informed that Juan has performed a search on his inbox and would like to ensure that the results only include those items with attachments. The command group that he'll use will be the resume command group.

The refine command group help are one whereby the results include the items that have attachments. Therefore, the answer will be option C "Refine".

5 0
2 years ago
Read 2 more answers
How would you describe your experiences with social media, either for yourself or for people you know? Good, bad, or in the midd
horrorfan [7]

Answer: I would say it’s both good and bad. Firstly, it’s good because you’re able to communicate with people from all over the world, whether it’s a friend or family member. But on the other hand it’s bad too, because there are manny dangers of being online, such as having your personal information stolen, or being cyber-bullied. So while it is good for communication purposes, it does have it’s downsides.

5 0
3 years ago
Other questions:
  • Witch of the following attributes of a website indicates a more reliable source for information
    15·1 answer
  • Evidence that Social media hasn’t improved human communication.
    12·1 answer
  • A(n) ____ is the computer counterpart to an ordinary paper file you might keep in a file cabinet or an accounting ledger.a. data
    6·1 answer
  • Which of the following statements is not true? Group of answer choices
    9·1 answer
  • Write a program that prompts the user for the lengths of the two legs of a right triangle, and which reports the length of the h
    8·1 answer
  • Messages that have been accessed or viewed in the Reading pane are automatically marked in Outlook and the message subject is no
    10·2 answers
  • Write a statement to declare a variable x with data type int and initialise with the value 10​
    13·1 answer
  • The while loop and the do loop are equivalent in their expressive power; in other words, you can rewrite a while loop using a do
    6·1 answer
  • An end-user license agreement protects _____.
    11·1 answer
  • Checking for and correcting errors may need to be done numerous during which of the following phases of the software development
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!