Question: Write a C++ program using arrays that accepts sales amount of the day for six days. The program will compute total sales and will display

Write a C++ program using arrays that accepts sales amount of the day for six days. The program will compute total sales and will display it.

PSUEDOCODE:

// Main module

Module Main()

// Create an array to hold the sales for six days.

Constant Integer SIZE = 6

Declare Real sales[SIZE]

// Get the sales.

Call getSales(sales, SIZE)

// Display the total sales.

Call showTotal(sales, SIZE)

End Module

// getSales module

Module getSales(Real Ref sales[], Integer size)

Declare Integer index // Loop counter

// Get the sales for a week.

For index = 0 To size - 1

Display "Enter the sales for day #", index + 1

Input sales[index]

End For

End Module

// showTotal module

Module showTotal(Real sales[], Integer size)

Declare Integer index // Loop counter

Declare Real total = 0 // Accumulator

// Calculate the total.

For index = 0 To size - 1

total = total + sales[index]

End For

// Display the total.

Display "The total sales are ", total

End Module

Write a C++ program using arrays that accepts sales amount of theday for six days. The program will compute total sales and will

Flowchart of the Sales Problem: getSales Real Ref sales0, Integer size) main0 Constant Integer SIZE 6 Declare Integer sales[SIZE] Declare Integerindex Call getSales sales, SIZE) Set index = 0 Call showTotal sales, SIZE) False index True size-1 End Display "Enter the sales for day #", index + 1 " Return Input sales[index]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!