0% found this document useful (0 votes)
10 views10 pages

Algorithm Analysis for Sales Reporting

This document presents an algorithm to meet the requirements of the company AID regarding the sales report of its agents for the first quarter. The algorithm includes the steps of: 1) entering the data of agents, months, and sales, 2) calculating the total sales, average, and sales per month, 3) identifying the agent with the highest and lowest sales, and 4) determining the month with the highest sales. Additionally, the pseudocode and the verification of the algorithm through a C++ program are presented.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views10 pages

Algorithm Analysis for Sales Reporting

This document presents an algorithm to meet the requirements of the company AID regarding the sales report of its agents for the first quarter. The algorithm includes the steps of: 1) entering the data of agents, months, and sales, 2) calculating the total sales, average, and sales per month, 3) identifying the agent with the highest and lowest sales, and 4) determining the month with the highest sales. Additionally, the pseudocode and the verification of the algorithm through a C++ program are presented.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PERUVIAN UNIVERSITY OF APPLIED SCIENCES

DEPARTMENT OF SCIENCES

FINAL WORK

Professional Studies for Executives - EPE

Work done for the Algorithms course of the engineering faculty


Industrial- EPE

G02

MEMBERS:

U20181D730 Leon Castillo Paul Brian


U20161B203 Huaman Sarmiento Fernando
-U20231D638 Turin Granda Leslie Katheryn
-U202317988 Ponciano Antenza Oscar Yohary

TEACHER:
José Luis Ojeda Merino

May 2, 2023
1. INTRODUCTION

The study of algorithms is one of the central topics in science and studies.
engineering is a method for problem solving and is the fundamental concept of
computer science.

The main objective of this work is to demonstrate the scope of development of the
competencies proposed in the subject (identify, formulate and solve problems).

The general management of the company AID requests the general manager a sales report of
first quarter, for this he requested an algorithm and the verification of it through a
programming code.
2. THEORETICAL FRAMEWORK

An algorithm constitutes a well-defined, ordered, and finite list of operations, that


allows finding the solution to a specific problem. Given an initial state and a
entry, it is through successive and well-defined steps that one reaches a final state, in
the one that obtains a solution (if there are several) or the solution (if it is unique).

An algorithm can be expressed in:

● Natural language
● Pseudocode
● Flow diagrams
● Programs

STAGES IN PROBLEM SOLVING

The process of solving a problem with a computer leads to the


writing a program and its execution in it.

● Analysis
● Design
● Coding
● Execution
● Maintenance

Characteristics of an algorithm:

● I need (indicate the order of execution at each step)


● Defined (if it is repeated twice, it gives the same result each time)
● Finished (it has an end; a determined number of steps)

ANALYSIS OF THE PROBLEM

This phase requires a clear definition where exactly what is completed


you must make the program and desired result or solution.

Since it is a computer solution, specifications are required.


detailed entry and exit.
3. STATEMENT
The commercial company AID has a sales force (sales agents) according to
to the demand of each period. The sales manager needs to respond to management
ask the following questions regarding the first quarter:

Agent January February March Total

John 18 15 19 52

Carla 24 18 17 59

Luis 18 22 22 62

Matas 21 17 16 54

Oscar 15 15 17 47

Juliana 15 23 29 67

Elena 15 18 21 54

a) Find the total sales made by all agents in the quarter


b) Find the average sales made by all agents
c) Find the agent who has sold the least in the quarter and indicate their name.
agent.
d) Find the agent who sold the most in the quarter and state their name.
agent.
In which month was the most sold?

Consider that there are 7 sales agents for the first quarter.

4. PROBLEM

The company seeks to obtain the report on the collaborators and the effectiveness they are showing.
having for the sales process. As well as verifying which was the month most
cash
3.1. OBJECTIVES

3.1.1 General objective:

It is to demonstrate the scope of the development of the proposed competencies in


the subject of Algorithms.

3.1.2 Specific objectives:

● Solve the requirements of the AID company with an algorithm,


following all his steps.

● Carry out a complete analysis of the problem to make an appropriate


algorithm.

● Verify the algorithm or programming code by executing the code in the


C++ program.

4. ANALYSIS

a. Logical solution model

1. We enter the names of the agents


2. We Enter Months
3. We enter Agent Sales by month
4. We calculate the total sales
5. We calculate the average sales
6. We calculate the agent with the highest sales

7. We calculate the agent with the lowest sales.


8. We calculate the month of highest sales.

9. Next we write total sales


10. Next we write average sales
11. Next we write Agent with the highest sales
12. Next we write Agent with the lowest sales
13. Next, we write the month with the highest sales

14. End
b. Data analysis table

We identified the input, intermediate, and output data of the AID company's problem.

Variable Description Data type Validation Use

names Chain Entry

agents Enter Entry

months Enter Entry

sales Enter Intermedia

total sales Enter Intermediate

Total Sales Per Month Entero Exit

average Sales Enter Exit

minor sale Entero Intermediate

majorSale Enter Intermedia

nameOfLowestSale Exit

highestSellingName Character Exit

more sales Entero Exit

c. Mathematical Model

Average sales = (Total sales) / (Agents * sales)

Total sales = Sum of Sales from Agents


5. PSEUDOCODE

START
nombres (7) = {"Juan", "Carla", "Luis", "Matias", "Oscar", "Juliana", "Elena"}
meses (3) = {0,1,2}
ventas [nombres][meses] = {{18, 15, 19}, {24, 18, 17}, {18, 22, 22}, {21, 17, 16}, {15,
15, 17}, {15, 23, 29}, {15, 18, 21}}

Parai=0Hastai < names


ventasAgente = 0
Paraj=0Hastaj < months
salesAgent += sales[i][j]
totalSalesPerMonth [j] += sales [i][j]
next j
totalSales += agentSales
IfSalesAgent < lessThanSaleThen
agentSales
names[i]
Finland
IfSalesAgent > highestSaleThen
salesAgent
names[i]
Finland
next i
averageSales = totalSales / (names * months)
So=0hastai < months
If totalSalesPerMonth[i] > totalSalesPerMonth[monthWithMostSales] Then
i
Finland
next i

Total Sales:
Write 'Average Sales: ', averageSales
Write "Less Sale: ", nombreMenorVenta " ( ", menorVenta " ) "
Write " More Sale: ", nameHighestSale " ( ", highestSale " ) "
Month of highest sales:
If SalesTime = 0 Then
January
IfSImesMasVenta = 1 Then
February
Finland-SI
WHO
March
Finland-South Inland
Write( totalSalesPerMonth[monthWithMostSales] )

FIN
6. ALGORITHM VERIFICATION
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
const int agents = 7;
const intmeses = 3;
int main() {
// Variables
stringnombres[agentes] = {"Juan", "Carla", "Luis", "Matias", "Oscar", "Juliana", "Elena"};
intventas[agentes][meses] = {{18,15,19}, {24,18,17}, {18,22,22}, {21,17,16}, {15,15,17},
Invalid input format for translation.
inttotalVentas =0;
doubleAverageSales;
lowestSale = sales[0][0];
highestSale = sales[0][0];
stringnombreMenorVenta = names[0];
nameHighestSale = names[0];
intmesMasVenta =0;
{0};
Response to each question
for(int i = 0; i < agents; i++) {
intventasAgente =0;
for(int j = 0; j < months; j++) {
agentSales += sales[i][j];
totalSalesPerMonth[j] += sales[i][j];
}
totalSales += agentSales;
if(salesAgent < smallestSale) {
leastSale = agentSales;
lowestSalesName = names[i];
}
if(agentSales > highestSale) {
salesAgent
highestSaleName = names[i];
}
}
averageSales = totalSales / (agents * months);
for(int i = 0; i < months; i++) {
if(totalSalesPerMonth[i] > totalSalesPerMonth[monthWithMostSales]) {
i
}
}
Printing of results
cout << "Total Sales: " << totalSales << endl;
cout << "Average Sales: " << averageSales << endl;
cout << "Least sale: " << nombreMenorVenta << " (" << menorVenta << ")" << endl;
cout << "Most sales: " << nameWithMostSales << " (" << mostSales << ")" << endl;
Month of highest sales:
if(monthMostSales == 0) {
January
else if(mostSalesMonth == 1) {
February
else
March
}
cout << " (" << totalVentasPorMes[mesMasVenta] << ")" << endl;
return0;
}

7. CONCLUSIONS

By performing the procedure, the course on algorithms allows for an approach.


disciplinary and introductory to the training of computerized systems through
programming. It is understood that to give instruction to a computer
We must carry out the detailed step by step of what is being sought (Logical sequence).
Once this procedure has been performed, it must be outlined in specific steps and
concrete examples for the computer to understand. This is done through the
pseudocode flowchart.

8. RECOMMENDATIONS

It is important that the pseudocode is written clearly and easily.


understand, using consistent and coherent notation throughout the code to
avoid confusions and syntax errors in C++.
It is advisable to test the pseudocode to ensure that it really
function in a C++ programming environment. You can do it manually.
following the instructions you have generated, or using a C++ compiler
to check that the code compiles without errors.
● Ensure that the pseudocode covers all possible cases, including cases
extremes, error cases and normal cases, and use control structures
of flow, data types and operations that are available in C++.
It is important to understand the problem well before starting to create the
algorithm. Make sure to understand the requirements and constraints of the problem and
have a clear idea of what is expected of the algorithm.
9. BIBLIOGRAPHY

Introduction to Programming
General Fundamentals of Programming
Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2009). Introduction to algorithms
(3rd ed.). The MIT Press
● Programming. Arrangements o Vectors. Recovered from
Unable to access the content of the provided URL.
● Microsoft. (2021). Const keyword (C++ Reference). Retrieved on May 2
2023, of[Link]

You might also like