Академический Документы
Профессиональный Документы
Культура Документы
Problema 1
1. Clase: Notas
2. Atributos: Estudiantes, nota1,nota2,nota3,nota4,notlit,notprom;
3. Metodos: int Estudiante, String nombres, int nota1, int nota2, int nota4, char notalit;
Asignar(int nota1, int nota2, int nota3,int nota4)
Promedio()
Notlit()
4. Seudocódigo
clase Notas {
}
INICIO
entero ests
cadena nombre
entero nota1, nota2, nota3, nota4
entero i
real notaprom
real notalit
Notas not
not.Asignar(nota1,nota2,nota3,nota4)
notaprom = not.Promedio()
notalit = not.Notlit()
FIN
}
5. Codigo en Java
import java.util.Scanner;
public void Asignar(int nota1, int nota2, int nota3, int nota4){
not1 = nota1;
not2 = nota2;
not3 = nota3;
not4 = nota4;
}
public double Promedio(){
notprom = (not1+not2+not3+not4)/4;
return notprom;
}
public char Notlit(){
if(notprom > 90){
notlit = 'A';
}
else if(notprom > 80 && notprom < 90){
notlit = 'B';
}
else if(notprom > 70 && notprom < 80){
notlit = 'C';
}
else if(notprom > 60 && notprom < 70){
notlit = 'D';
}
else if(notprom <= 60 && notprom >= 0){
notlit = 'F';
}
else{
System.out.println("Algun error en la entrada de notas");
}
return notlit;
}
public static void main(String[] args){
int ests;
String nombre;
int nota1, nota2, nota3, nota4;
int i;
double notaprom;
double notalit;
not.Asignar(nota1,nota2,nota3,nota4);
notaprom = not.Promedio();
notalit = not.Notlit();
}
}
Problema 2
1. Clase: Estudiantes
2. Atributos: estudiantes, sexo,estatura,peso;
3. Métodos: int estudiantes, int sexo, int sexo, real estatura, real peso;
Asignar(int sexo, real estatura, real peso)
CantEstM()
CantEstF()
PromPesoxM()
PromPesoxF()
PromEstaturaxM()
PromEstaturaxF()
4. Seudocódigo
5. Código en Java
Problema 3
1. Clase
problema3
2. Atributos
Vent1
Vent2
Vent3
Vent4
total
3. Métodos
import java.util.Scanner;
double vent1=0,vent2=0,vent3=0,vent4=0;
double total=0;
}
public void venta(int vend, Double vent)
{
total+=vent;
switch(vend)
{
case 1: vent1+=vent; break;
case 2: vent2+=vent; break;
case 3: vent3+=vent; break;
case 4: vent4+=vent; break;
}
}
public void imprimirventas()
{
System.out.println("aqui van las ventas totales y parciales");
}
vendedor= get.nextInt();
validar=caja.Vendedor(vendedor);
if(validar==0)
{
System.out.println("codigo incorrecto, intente
nuevamente.");
}
else if(validar>0)
{
do
{
System.out.println("Desea agregar una nueva
venta?");
resp=get.nextLine();
if(resp=="s")
{
System.out.println("digite el monto de la
venta");
venta=get.nextDouble();
caja.venta(vendedor,venta);
}
else if (resp=="n")
{
caja.imprimirventas();
}
else {resp="0";}
}
}