Write A Program And Flowchart: The Program Should Ask The Us

Write A Program And Flowchart The Program Should Ask The User How Man

Write a program and flowchart. The program should ask the user how many customers they want to track. Then, it asks for customer numbers, and sales by customer. At the end, it prints out the customer number, the customer sales, and then the total sales and average sales. You must use two different arrays, one for customer number, and one for sales. These are, in effect, parallel arrays. You must use a "while" loop to gather customer number and sales. You must use a "for" loop to output the customer number and sales by customer.

Paper For Above instruction

Write A Program And Flowchart The Program Should Ask The User How Man

Customer Sales Tracking Program and Flowchart

This paper presents a comprehensive plan to design and implement a program and flowchart that enables users to track customer sales data effectively. The primary objectives are to prompt the user for the number of customers, gather each customer's unique identifier and sales amount, and then present a detailed summary including individual customer details, total sales, and average sales. The program emphasizes the use of parallel arrays, control flow structures such as "while" and "for" loops, and clear output formatting—all critical for robust data processing and user interaction.

Introduction

Tracking customer transactions is essential for business analytics, financial reporting, and strategic planning. Developing a program that simplifies this task involves understanding basic programming constructs such as arrays, loops, and input/output operations. In this context, the goal is to create a user-friendly application that efficiently records and summarizes sales data using two parallel arrays—one for customer numbers and another for sales figures. The use of "while" loops ensures all data is collected properly, while "for" loops facilitate a structured output of the stored information.

Program Design and Logic

The core design comprises two primary phases: data collection and data presentation. During data collection, users specify how many customers they wish to track. A "while" loop iterates to prompt for each customer's number and sales, storing these values into respective parallel arrays. This approach ensures all data entries are captured dynamically based on user input.

For data presentation, a "for" loop iterates over the arrays to display each customer's number alongside their sales. Afterward, the program calculates the total sales by summing all sales data. It also computes the average sales by dividing the total by the number of customers. The results are then displayed in a clear, tabulated format.

Flowchart Outline

The flowchart starts with the initialization of variables, prompting the user for the number of customers. It then proceeds to gather customer numbers and sales data within a "while" loop until all entries are collected. Once data gathering is complete, a "for" loop outputs customer details. Subsequently, the total and average sales are calculated, and the final results are displayed. This visual representation ensures clarity in process flow and aids in program implementation.

Sample Implementation (Python Code)

Number of customers to track

num_customers = int(input("Enter the number of customers to track: "))

Initialize parallel arrays for customer numbers and sales

customer_numbers = [0] * num_customers

sales = [0.0] * num_customers

Data collection using while loop

index = 0

while index

customer_numbers[index] = int(input(f"Enter customer number for customer {index + 1}: "))

sales[index] = float(input(f"Enter sales for customer {customer_numbers[index]}: "))

index += 1

Data presentation using for loop

print("\nCustomer Sales Report")

print("Customer Number | Sales")

print("----------------|--------------")

total_sales = 0.0

for i in range(num_customers):

print(f"{customer_numbers[i]:10.2f}")

total_sales += sales[i]

Calculate average sales

average_sales = total_sales / num_customers if num_customers > 0 else 0

Display totals and averages

print("\nSummary")

print(f"Total Sales: ${total_sales:.2f}")

print(f"Average Sales: ${average_sales:.2f}")

Conclusion

This program, supported by a detailed flowchart, provides an effective solution for tracking and analyzing customer sales data. Utilizing parallel arrays ensures data integrity, while the controlled loop structures facilitate robust user input and output management. Such an approach can be expanded for more complex data analysis and integrated into larger sales management systems.

References

  • Deitel, P. J., & Deitel, H. M. (2017). Python for Programmers. Pearson Education.
  • Laudon, K. C., & Laudon, J. P. (2018). Management Information Systems: Managing the Digital Firm. Pearson.
  • Gaddis, T. (2018). Starting out with C++: From Control Structures through Objects. Pearson.
  • Skansholm, H. (2019). Flowcharts and Algorithms. Springer.
  • Marino, J. (2018). Programming with Python. Cengage Learning.
  • VanderPlas, J. (2016). Python Data Science Handbook. O'Reilly Media.
  • Langtangen, H. P. (2016). Python Scripting for Computational Science. Springer.
  • Harvey, P. (2019). Introduction to Programming. McGraw Hill.
  • Bates, A. (2019). Data Analysis Using Python. Springer.
  • Knuth, D. (2014). The Art of Computer Programming. Addison-Wesley.