Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question
  1. Write a C++ program that will read monthly sales into a dynamically allocated array. The program will input the size of the array from the user (must be less than or equal to 12). It will call a function that will find the sum of all sales. It will also call a function to find the average. It will also call a function to sort the array using either a bubble or selection sort in descending order and then display the results.
    • You must have a comment block header at the top of your program. See the Standards document in Course Content
    • You must use pointers for your arraysand dynamically allocate them based on the number of month
      • You must remove and reset the array when completed
    • You must use the correct data types for your variables
    • You must validate your input.
      • The number of months must be between 1 and 12
    • You must use a loop to read in the sales
    • You must use at least 3 functions to calculate the average, sort the array and display the sales
    • Your output should be formatted correctly
      • Sales totals, average should have two decimal places
  2. Sample Run #1:
    Please input the number of monthly sales to be input
    4
    Please input the sales for month 1:
    1290.89
    Please input the sales for month 2:
    905.95
    Please input the sales for month 3:
    1567.98
    Please input the sales for month 4:
    994.83
    The total sales for the time period is 4759ドル.65
    The average month sale is 1189ドル.91
    Sales in descending order:
    1567ドル.98
    1290ドル.89
    994ドル.83
    905ドル.95
    Sample Run #2:
    Please input the number of monthly sales to be input
    0
    You must enter a value between 1 and 12. Please reenter.
    Please input the number of monthly sales to be input
    14
    You must enter a value between 1 and 12. Please reenter.
    Please input the number of monthly sales to be input
    2
    Please input the sales for month 1:
    959.44
    Please input the sales for month 2:
    674.11
    The total sales for the time period is 1633ドル.55
    The average month sale is 816ドル.78
    Sales in descending order:
    959ドル.44
    674ドル.11
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education