Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Psuedo-code:

// 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

-------------------------------------------------------------------------------------------------------------

Flowchart

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions

Question

Brief the importance of span of control and its concepts.

Answered: 1 week ago

Question

What is meant by decentralisation?

Answered: 1 week ago

Question

Write down the Limitation of Beer - Lamberts law?

Answered: 1 week ago

Question

Discuss the Hawthorne experiments in detail

Answered: 1 week ago

Question

Explain the characteristics of a good system of control

Answered: 1 week ago

Question

3. Write a policy statement to address these issues.

Answered: 1 week ago

Question

2. Why has the conflict escalated?

Answered: 1 week ago