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
SIZIF [17.4K]
3 years ago
5

You've been hired by Maple Marvels to write a C++ console application that displays information about the number of leaves that

fell in September, October, and November. Prompt for and get from the user three integer leaf counts, one for each month. If any value is less than zero, print an error message and do nothing else. The condition to test for negative values may be done with one compound condition. If all values are at least zero, calculate the total leaf drop, the average leaf drop per month, and the months with the highest and lowest drop counts. The conditions to test for high and low values may each be done with two compound conditions. Use formatted output manipulators (setw, left/right) to print the following rows:________.
September leaf drop
October leaf drop
November leaf drop
Total leaf drop
Average leaf drop per month
Month with highest leaf drop
Month with lowest leaf drop
And two columns:
A left-justified label.
A right-justified value.
Define constants for the number of months and column widths. Format all real numbers to three decimal places. The output should look like this for invalid and valid input:
Welcome to Maple Marvels
------------------------
Enter the leaf drop for September: 40
Enter the leaf drop for October: -100
Enter the leaf drop for November: 24
Error: all leaf counts must be at least zero.
End of Maple Marvels
Welcome to Maple Marvels
------------------------
Enter the leaf drop for September: 155
Enter the leaf drop for October: 290
Enter the leaf drop for November: 64
September leaf drop: 155
October leaf drop: 290
November leaf drop: 64
Total drop: 509
Average drop: 169.667
Highest drop: October
Lowest drop: November
End of Maple Marvels
Computers and Technology
1 answer:
ELEN [110]3 years ago
6 0

Answer:

#include <iostream>

#iclude <iomanip>

#include <algorithm>

using namespace std;

int main(){

int num1, num2, num3,

int sum, maxDrop, minDrop = 0;

float avg;

string end = "\n";

cout << " Enter the leaf drop for September: ";

cin >> num1 >> endl = end;

cout << "Enter the leaf drop for October: ";

cin >> num2 >> endl = end;

cout << "Enter the leaf drop for November: ";

cin >> num3 >> endl = end;

int numbers[3] = {num1, num2, num3} ;

string month[3] = { "September", "October", "November"}

for ( int i =0; i < 3; i++) {

 if (numbers[i] < 0) {

   cout << "Error: all leaf counts must be at least zero\n";

   cout << "End of Maple Marvels\n";

   cout << "Welcome to Maple Marvels";

   break;

 } else if (number[i] >= 0 ) {

     sum += number[i] ;

   }

}

for (int i = 0; i < 3; i++){

 cout << month[i] << " leaf drop: " << numbers[i] << endl = end;

}

cout << "Total drop: " << sum << endl = end;

cout << setprecision(3) << fixed;

cout << "Average drop: " << sum / 3<< endl = end;

maxDrop = max( num1, num2, num3);

minDrop = min(num1, num2, num3);

int n = sizeof(numbers)/sizeof(numbers[0]);

auto itr = find(number, number + n, maxDrop);

cout << "Highest drop: "<< month[ distance(numbers, itr) ] << endl = end;

auto itr1 = find(number, number + n, minDrop);

cout << "Lowest drop: " << month[ distance(numbers, itr1) ] << endl = end;

cout << "End of Maple Marvels";

Explanation:

The C++ soucre code above receives three integer user input and calculates the total number, average, minimum and maximum number of leaf drop per month, if the input isn't less than zero.

You might be interested in
Describing Work Styles for Farmworkers and Laborers, Crop
Olegator [25]

Answer:

it is A,B,E,F,G

Explanation:

can i have brainliest please.

7 0
3 years ago
Read 2 more answers
How to transfer word 2019 from one computer to another
Misha Larkins [42]

Answer:

The easiest way would be to download it on the other computer.

I'm guessing you want all of your word documents. To achieve this, simply log into your account on the other device.

4 0
3 years ago
...............is a personal computer that fits on desk.​
vesna_86 [32]

Answer:

desktop computer

Explanation:

8 0
3 years ago
Read 2 more answers
A user who bypasses the documentation to get a new hardware or software package operational as rapidly as possible is a victim o
Leya [2.2K]

A user who bypasses the documentation to get a new hardware or software package operational as rapidly as possible is a victim of quick start behavior.

<h3>What is Quick Start Behavior Guide?</h3>

The Quick Start Behavior guide is known to be a fast introduction to the use of Class Charts behavior management software.

A user who bypasses the documentation to get a new hardware or software package operational as rapidly as possible is a victim of quick start behavior as he or she is in haste and thus did a bypass.

Learn more about documentation from

brainly.com/question/25534066

5 0
3 years ago
Many application controls are useful for enhancing the reliability of both transaction data and master record data. This applica
Rzqust [24]

Answer:

True

Explanation:

In most accounting software like SAP, Application control performs what is known as validity check.

And Validity check is when this application control compares the data entered into a field for a transaction to that in a master record to verify the data entered exists.

With above definition we can infer that the question statement is true.

5 0
3 years ago
Other questions:
  • If no mode is indicated for a parameter, what mode is used?
    15·1 answer
  • When you are using inprivate browsing, the "inprivate is turned on" page displays in the browser window, the inprivate label is
    14·1 answer
  • A website that sells high-end ties notices that its ads are showing up for searches that include "cheap". Because its ties are e
    14·1 answer
  • Secure Multipurpose Internet Mail Extensions builds on the encoding format of the MIME protocol and uses digital signatures base
    15·1 answer
  • What are the disadvantages of using photo editing software in photography?
    14·1 answer
  • The SPF strategy can be proven to be optimal in the sense that it minimizes average response times. In this problem, you will de
    10·1 answer
  • In what order does the Cascade look at factors to determine which CSS rule to follow?
    14·1 answer
  • Software that allows users to use and adapt it for any purpose, often allowing the public to participate in further development
    7·2 answers
  • What are real online jobs any one of any age can get pays weekly by Pay<br> Pal
    8·1 answer
  • Global communication and transportation technologies are an example of a(n) ____
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!