INSTITUTO TECNOLÓGICO
DE MINATITLAN
ING.
EN SISTEMAS COMPUTACIONALES
DISEÑO
ESTRUCTURADO DE ALGORITMOS
Examen
unidad iii
CATEDRÁTICO:
JOSÉ
ÁNGEL TOLEDO ÁLVAREZ
PRESENTA:
JHOANA
CORTEZ FLORES
Minatitlan, VER.
A 24 DE MARZO DE 2004
DEFINICIÓN DEL PROBLEMA
Diseñar un algoritmo(como propuesta de sistema) susceptible de ser programado para llevar el control de las compras y ventas de una tienda de computo.
Dentro del análisis explicar cuales son los tipos de
datos que emplearon como variables, constantes(si las hay), como lo emplearon
dentro del algoritmo y que operaciones tendrá que realizar (tipo de
operaciones).
ANÁLISIS DEL PROBLEMA
Datos de entrada:
Constantes:
ccomp. = 5000 cimp
= 500 cmouse = 25 ctecl = 50 cmoni = 800
vcomp. = 10000
vimp = 1000 vmouse = 50 vtecl =
100 vmoni = 1500
v Son datos de tipo numérico real los precios de los
artículos y carácter el nombre de los artículos
Procesos
Subtotal
= subtotal + opción * articulo
IVA = subtotal * .15
TOTAL
= subtotal + iva
Datos de salida:
Subtotal
= subtotal + opción * articulo
IVA = subtotal * .15
TOTAL
= subtotal + iva
Inicio
Escriba “Bienvenido a tu
tienda de compra – venta Sistemas”
Escribir “ Que operación
desea realizar ”
Escribir 1) Comprar 2)
Vender 3) Salir
Leer opciones
Si la opcion es 1
Escribir “Bienvenido a
compras”
Escribir “ Que articulo
desea comprar “
Escribir “1.Computadoras”
Leer ccomp.
Escribir “2.Monitores”
Leer cmoni
Escribir “3.Impresoras”
Leer cimp
Escribir “4.Teclado”
Leer ctecl
Escribir “5.Mouse”
Leer cmouse
Escribir “6.Salir”
Leer Salir
Si opcion 1=1
Escribir “Cuantos articulos
desea comprar”
Leer cantidad
Calcular Subtotal = comp
* cantidad Iva = subtotal *
.15 Total = subtotal + iva
Si opcion 1=2
Escribir “Cuantos articulos
desea comprar”
Leer cantidad
Calcular Subtotal = cmoni
* cantidad Iva = subtotal *
.15 Total = subtotal + iva
Si opcion 1=3
Escribir “Cuantos articulos
desea comprar”
Leer cantidad
Calcular Subtotal = cimp
* cantidad Iva = subtotal *
.15 Total = subtotal + iva
Si opcion 1=4
Escribir “Cuantos articulos
desea comprar”
Leer cantidad
Calcular Subtotal = ctecl
* cantidad Iva = subtotal *
.15 Total = subtotal + iva
Si opcion 1=5
Escribir “Cuantos articulos
desea comprar”
Leer cantidad
Calcular Subtotal = cmouse
* cantidad Iva = subtotal *
.15 Total = subtotal + iva
Si opcion 1=6
Regresa al menu principal
Si opcion = 2
Escribir “Bienvenido a
ventas”
Escribir “ Que articulo
desea vender”
Escribir “1.Computadoras”
Leer vcomp.
Escribir “2.Monitores”
Leer vmoni
Escribir “3.Impresoras”
Leer vimp
Escribir “4.Teclado”
Leer vtecl
Escribir “5.Mouse”
Leer vmouse
Escribir “6.Salir”
Leer Salir
Si opcion 2 = 1
Escribir “Cuantos articulos
desea vender”
Leer cantidad
Calcular Subtotal = vcomp
* cantidad Iva = subtotal *
.15 Total = subtotal + iva
Si opcion 2=2
Escribir “Cuantos articulos
desea vender”
Leer cantidad
Calcular Subtotal = vmoni
* cantidad Iva = subtotal *
.15 Total = subtotal + iva
Si opcion 2=3
Escribir “Cuantos articulos
desea vender”
Leer cantidad
Calcular Subtotal = vimp
* cantidad Iva = subtotal *
.15 Total = subtotal + iva
Si opcion 2=4
Escribir “Cuantos articulos
desea vender”
Leer cantidad
Calcular Subtotal = vtecl
* cantidad Iva = subtotal *
.15 Total = subtotal + iva
Si opcion 2=5
Escribir “Cuantos articulos
desea vender”
Leer cantidad
Calcular Subtotal = vmouse
* cantidad Iva = subtotal *
.15 Total = subtotal + iva
Si opcion 1=6
Regresa al menu principal
Si la opcion es 3
Escribir “Salir”
Leer Salir
#include<stdio.h>
#include<conio.h>
#include<process.h>
/* DECLARACION DE CONSTANTES*/
const
vcomp=10000, vimp=1000, vmouse=50, vtecl=100, vmoni=1500;
const
ccomp=5000, cimp=500, cmouse=25, ctecl=50, cmoni=800;
/*DECLARACION DE VARIABLES*/
int
opcion,op2,cant=0,subtotal=0;
float iva,
total;
void main()
{
men_prin:
clrscr();
printf("\n QUE OPERACION DESEA REALIZAR \n 1.- COMPRAR \n 2.- VENDER \n 3.- SALIR \n ");
gotoxy(7,6);scanf("%d",&opcion);
/* INICIO DE COMPRAS*/
if(opcion==1)
{
menu:
clrscr();
printf("\nBIENVENIDO A COMPRAS");
printf("\n\nQUE ARTICULO DESEA COMPRAR\n");
printf("\n1.-COMPUTADORAS");
printf("\n2.-MONITORES");
printf("\n3.-IMPRESORAS");
printf("\n4.-TECLADOS");
printf("\n5.-MOUSE");
printf("\n6.-SALIR ");
gotoxy(4,12);scanf("%d",&op2);
if(op2==1) // compra de computadoras
{
printf("\nCUANTOS ARTICULOS DESEA COMPRAR ");
scanf("%d",&cant);
subtotal= ccomp*cant;
goto opera1;
}
if(op2==2) // compra de monitores
{
printf("\nCUANTOS ARTICULOS DESEA COMPRAR ");
scanf("%d",&cant);
subtotal=subtotal + cmoni*cant;
goto opera1;
}
if(op2==3) // compra de impresoras
{
printf("\nCUANTOS ARTICULOS DESEA COMPRAR ");
scanf("%d",&cant);
subtotal=subtotal + cimp*cant;
goto opera1;
}
if(op2==4) // compras de teclados
{
printf("\nCUANTOS ARTICULOS DESEA COMPRAR ");
scanf("%d",&cant);
subtotal=subtotal +
ctecl*cant;
goto opera1;
}
if(op2==5)
// compras de mouse
{
printf("\nCUANTOS ARTICULOS DESEA COMPRAR ");
scanf("%d",&cant);
subtotal=subtotal + cmouse*cant;
goto opera1;
}
if(op2==6) // por si no compra nada
{
goto men_prin;
}
opera1: /* etiqueta de inicio delas poperaciones*/
iva = subtotal* 0.15;
total= subtotal + iva;
printf("\n El total es: $ %d",subtotal);
printf("\n El iva es : $ %f ",iva);
printf("\n El total a pagar es: $ %f ",total);
printf("\ngracias por su compra");
getch();
goto menu;
} /* FIN DE COMPRAS*/
/*INICIO DE VENTAS*/
if(opcion==2)
{
menu2:
clrscr();
printf("\nBIENVENIDO A VENTAS");
printf("\n\nQUE ARTICULO DESEA VENDER\n");
printf("\n1.-COMPUTADORAS");
printf("\n2.-MONITORES");
printf("\n3.-IMPRESORAS");
printf("\n4.-TECLADOS");
printf("\n5.-MOUSE");
printf("\n6.-SALIR ");
gotoxy(4,12);scanf("%d",&op2);
if(op2==1) // SI VENDE COMPUTADORAS
{
printf("\nCUANTOS ARTICULOS DESEA VENDER ");
scanf("%d",&cant);
subtotal= vcomp*cant;
goto opera;
}
if(op2==2) // SI VENDE MONITORES
{
printf("\nCUANTOS ARTICULOS DESEA VENDER ");
scanf("%d",&cant);
subtotal=subtotal + vmoni*cant;
goto opera;
}
if(op2==3) // SI VENDE IMPRESORAS
{
printf("\nCUANTOS ARTICULOS DESEA VENDER ");
scanf("%d",&cant);
subtotal=subtotal + vimp*cant;
goto opera;
}
if(op2==4) // SI VENDE TECLADOS
{
printf("\nCUANTOS ARTICULOS DESEA VENDER ");
scanf("%d",&cant);
subtotal=subtotal + vtecl*cant;
goto opera;
}
if(op2==5) // SI VENDE MOUSEïS
{
printf("\nCUANTOS ARTICULOS DESEA VENDER ");
scanf("%d",&cant);
subtotal=subtotal + vmouse*cant;
goto opera;
}
if(op2==6)
{
goto men_prin;
}
/* INICIO DE OPERACIONES DE VENTAS*/
opera:
iva = subtotal* 0.15;
total= subtotal + iva;
printf("\n El total es: $ %d",subtotal);
printf("\n El iva es : $ %f ",iva);
printf("\n El total a pagar es: $ %f ",total);
printf("\ngracias por su VENTA");
getch();
goto menu2;
} /* FIN DE VENTAS*/
if(opcion== 3)
exit(1);}
PRUEBA Y DEPURACIÓN
Es ejecutar el programa para
verificar si hay errores de sintaxis y de lógica.
DOCUMENTACIÓN
Se maneja aquí un manual o
guía de operación para documentar el
programa y se utilizan los manuales de usuario
y técnico.
En este se le hacen mejoras
al programa para que este mejor día a
día y para que sea de mas fácil manejo para el usuario, se le pueden poner
otras versiones y mucho mas.