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.

Answers

Answer 1

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;}  


Related Questions

***ASAP***
OpenOffice.org software is what type of software?

A. Event planning software

B. Productivity software

C. Internet software

D. Collaboration software

Answers

An internet software im guessing

Answer:

im guessing A. event planning software...

Explanation:

Apache OpenOffice is the leading open-source office software suite for word processing, spreadsheets, presentations, graphics, databases, and more. It is available in many languages and works on all common computers.

You develop an app, and you don't want anyone to resell it or modify it. This is an example of: A an operating system. B open source software. C proprietary software.

Answers

The answer is C. Proprietary software is when the publisher reserves rights from licensees to modify or share the software.
C: property software
I think because I’m pretty sure if you develop the app its your property

Does anyone know how to do Python Essentials 5.7.1.6 because i am completely lost

Answers

Answer:

create a 2d array of "#" for each letter, and use string manipulation or regular expressions to print each letter

Explanation:

What is the other name of iterative staatement ​

Answers

Answer:

An loop statement

Explanation:

An iteration statement, loop, repeatedly executes a statement, know as a loop body,until the controlling expression is false

Other Questions
Which part of DNA is the actual genetic code? * 5+ 2 1/2 + 7 1/2 + 2 1/2+ 7 1/2 +5= Read the artide "Challenging Explorations."The 19th century to the 19th century was an age of exploration. Many people in Europe were searching for a better life with greater opportunities. The desire for a better life led many to journeyacross the wear to find new and to see. Many European explorers landed in what they called the New World, which would later be called North America. These explorations were filled withThe first challenge faced by many explorers was money. They needed financial bacing to find the ships, cargo, and crew required to make such a long journey. The solution was royalty, andexplorers would approach wings and Queens to convince them to invest in their voyages. If the king and queen agreed, then the explorer would have the money needed to fund an expedition inreturn any and discovered during the voyage were claimed by that countryThe next to was to in seaworthy ship. Many ships were built during the age of exploration, but not all could handle a trip across the Atlantic Ocean. Now ship designs were created to suitSong voyages. One such type was called a caravel, which was a small ship created for exploration in the 1400. This type of ship was equipped with cargo space for voyages up to a year long.Caravels were also on tieted seawathy because they could travel to 90-100 miles in a dayGre, the exponers set sail and used maps to sangue though known terrey. The maps were no seu once saters were out of sight et land or in unknown territory How would theyFIGUE er tre vu, news and matters to guide them? This pretter ved to the invention of rangation equcrnent. Companies have a magnetised metal reede tratwarts sort. Stors use them as a point of reference to the ship is in the night position to move forward. In order to find their location, sufors used astrolates, sextanto, crossstaffs, or Quadrants to find out with these tools, explorers were able to sell on to discover new landsThe finder moont-challenge for many explorers was survival, as voyages could be long and tense. Maintaining supplies and finding and were important to prevent mutinesfrom Song Unterne, bringing supplies that words at the entire voyage led to another problem scurvy. Many suitors died from the disease, as they are preserved food at sea. ToSurvive, stor need to stand eat fresh vegetables and fruitswhen stor anderers are on and they had to overcome may contades. While more challenges awaited them, explorers were able to embark and realize that had reached thew WorldWhat is the overall structure of this text ?A-cause and effect. B-chronological order. C-compare and contrast. D- problem and solution A ________ force is when two forces cancel each other out and do not affect the motion of an object. Does axons have insulation The practice of using musical material to represent a specific character or object in an opera:impressionismexpressionismdadaismleitmotif In honor of Youth Art Month, imagine that you have created a fantastic work of art which is going to be displayed in a local art gallery. Write the description that would be displayed next to your work of art. A characteristic is a feature or quality belonging typically to a person, place, or thing andserving to identify it. In Homer's epic poem, The Od ssey, Odysseus shows many heroiccharacteristics throughout his journey home to Ith.ca. A hero from the times of Odysseuswas quite different from heroes of our time. Explo:Lhow Odysseus would be considered ahero in 2021. You may write about one characteristic or three characteristics. The choice isyours.Characteristic Choices: Bravery, Leadership, Determination, Loyalty, Selflessness or Courage PLS HELP (AGAIN) ILL MARK BRAINLIEST. I HAVE TO TURN THIS IS ASAP giving brainliest for corect answer :) A single 250 gramserving of one sports drink contains0.055 grams of sodium ions. What is theconcentration of sodium ions expressedas % by mass?2.2 x 10-42.2 x 1022.2 x 10-22.2 x 10-4 Mike is catering a party. He plans on having 4 trays of 5 appetizers each on the buffet at the beginning of the party and will rotate in new trays as those become empty. To ensure that he does not run out of appetizers during the party, he is going to make 2 appetizers per person in addition to the initial number put out on the buffet. Which of the following represents A, the amount of appetizers Mike needs to make, in terms of p, the amount of people attending the party? May anyone help me till I get to an 80 please? Ive been struggling for 3 days now. Simplify (y+1)+4Help Please give me the correct answers what is the sum of 4 and the product of 9 and 5 is swarms of alligators a literary device Please help me answer this question Divide Decimals127.610 with the power of 5 Please help me! It's due today and I have a lot of other stuff to do!! Anything is appreciated! If the opposite of g(x) is g(x),then g(x) =