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
Yuri [45]
3 years ago
11

Given a type Money that is a structured type with two int fields, dollars and cents. Assume that an array named monthlySales wit

h 12 elements, each of type Money has been declared and initialized. Assume that a Money variable yearlySales has also been declared. Write the necessary code that traverses the monthlySales array and adds it all up and stores the resulting total in yearlySales. Be sure make sure that yearlySales ends up with a valid value, i.e. a value of cents that is less than 100.
Computers and Technology
1 answer:
ra1l [238]3 years ago
7 0

Answer:

Attached below is the code

Explanation:

using namespace std;

struct Money

{

int dollars;

int cents;

};

int main()

{

struct Money monthlySales[12];

struct Money yearlySales = { 0,0};

for(inti=0; i<12; i++)

{

monthlySales[i].dollars = 0.0;

monthlySales[i].cents = 0.0;

}

for(int i=0; i<12; i++)

{

yearlySales.dollars = yearlySales.dollars + monthlySales[i].dollars;

yearlySales.cents = yearlySales.cents +monthlySales[i].cents;

}

return 0;

}

You might be interested in
why do programs include keyboard shortcuts for certain actions? do you prefer the mouse or the keyboard/ why?
Archy [21]
I would prefer the shortcut because it would make it easier to open tabs and close them too. but the can also help you with other stuff to .
4 0
4 years ago
What will the document.write() statement display, given the following code snippet? var scores = new Array[94, 90, 88, 82, 73, 7
astra-53 [7]

Answer:

There are 7 scores recorded. The dropped score is 75

Explanation:

The code snippet above prints through the document.write() function. the output prints the string serving as the argument, and makes use of variables (lgth) and expression also (scores [lgth -1]). what it does is. From the point where it sees +lgth+, it checks the value, which is 7. And when it sees scores [lgth-1] it evaluates it to 75. Hence, the string above is produced.

4 0
3 years ago
I hate these homework it's very hard and I need help
liubo4ka [24]
Ethics is the answer I believe
8 0
3 years ago
The four functions of a computer are
ehidna [41]
The four basic functions of a computer are input, processing, output and storage.
6 0
3 years ago
Who developed vacuum tube and when?​
aleksandrvk [35]

Answer:

In 1904, John Ambrose Fleming invented the first vacuum tube.

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Array testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full cre
    10·1 answer
  • In addition to proposing that planetary orbits are elliptical, what other modification did Kepler make to Copernicus’s model? Pl
    15·2 answers
  • A circuit has a resistance of 300 ohm and a current of 0.024 A. What is the voltage in the circuit?
    12·1 answer
  • Hey so, I was looking online how to reset my laptop and I ended up pressing load setup defaults and now I get an error saying ch
    15·2 answers
  • Robots can obtain data from the environment, store the data as knowledge, and modify their behavior
    10·1 answer
  • Dimensional arrays can be created using loops. 2 dimensional arrays can be created using:
    10·1 answer
  • Create a new method in your language called Times Print. This should be a void method. It should accept exactly two numeric valu
    12·1 answer
  • What is a foreign key and how does it provide referential integrity?
    10·1 answer
  • Which command group on the Slide Master tab is used to add headers, footers, and other placeholders to the slide
    13·2 answers
  • Despite a wide variety of workplaces for those working in Human Services, all workplaces include
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!