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
Coordinate with
Lunna [17]

Answer:

First blank: producer

Second blank: Hairdressers

5 0
3 years ago
Using a conversation voice is part of:
MaRussiya [10]
Need more information
4 0
3 years ago
Students can use eNotes to type notes directly on screen and
zalisa [80]
A. review or print them later
6 0
3 years ago
Read 2 more answers
What are some differences between CUI and GUI ?
ollegr [7]

Answer:

Even though both are interfaces and serve its purpose of attempting to run the strategies, their components as well as the manipulate they will get from the patient differ.

Explanation:

CUI (Character User Interface) :-

  • It's a sort of user interface that only uses binary data and pseudographics for interface-output and data sessions.
  • That's characterized by low availability for operating systems I / O resources (act with integrity) and high speed with a display of data.

GUI (Graphical User Interface (GUI):-

  • Using graphical elements such as windows, icons, menus helps the user to communicate with the program.
  • It is a kind of user interface along which people interact with electronic equipment through characterizations of visual indicators.
3 0
3 years ago
Describe a situation involving making a copy of a computer program or an entertainment file of some sort for which you think it
Margaret [11]

Answer:

Copying anything may be the computer program or an entertainment file, it is not a good thing as the original developers or the writers are going to feel bad since their hard work is being used by others without letting them know. However, if you are using it for academic purposes, or give them credit in your work, then the original writer will not feel that bad as he is being credited, and hence you can reuse in that case definitely, but always ensure to give the credit to the original writer.

As an example, if a film is copied like many in the past the Directors always feel bad, and they have the reason for feeling bad. The same thing is to technology.

Explanation:

The answer is self explanatory.

8 0
3 years ago
Other questions:
  • When seeking information on the internet about a variety of subjects, the most useful place to look would be
    8·2 answers
  • Why are video texts an example of multimedia? A. They use audio and visual elements together. B. They use one type of medium to
    13·2 answers
  • Why is there a need to compare and align one's PECs of a successful entrepreneur?
    5·1 answer
  • What do we call a subset of new media in which groups and their fans can interact directly?
    14·1 answer
  • Create a dictionary named letter_counts that contains each letter and the number of times it occurs in string1. Challenge: Lette
    14·1 answer
  • Cn someone help me plz
    11·1 answer
  • For a parking application that lets you pay for parking via your phone, which of these is an example of a functional requirement
    8·1 answer
  • Which statement correctly differentiates how to use list and table styles?
    12·2 answers
  • I came here for a answer so why did i get a pep talk
    7·2 answers
  • The unit we use to measure bending moment is...<br> A kg<br> B N<br> C Nm<br> D MPa
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!