Exercício 03
Página 1 de 1
Exercício 03
Faça um programa que receba nota de um aluno, calcule e mostra media final deste aluno. Considerando que a media é composta por notas da prova, trabalhos e faltas. Se o aluno tiver mais do que 10 faltas é Reprovado, para o aluno a media de aprovação tem que ser maior do que seis.
=> Class "nota"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EX3
{
class notas
{
public double n1 { get; set; }
public double n2 { get; set; }
public double t1 { get; set; }
public double t2 { get; set; }
public int fatas { get; set; }
public void dados(double a,double b,double c,double d,int f)
{
a = this.n1;
b = this.n2;
c = this.t1;
d = this.t2;
f = this.fatas;
}
}
}
=> Class "Main Principal"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EX3
{
class Program
{
static void Main(string[] args)
{
notas n = new notas();
double media = 0;
Console.Write("NOTA 1 = ");
n.n1 = double.Parse(Console.ReadLine());
Console.Write("TRABALHO 1 = ");
n.t1 = double.Parse(Console.ReadLine());
Console.Write("NOTA 2 = ");
n.n2 = double.Parse(Console.ReadLine());
Console.Write("TRABALHO 2 = ");
n.t2 = double.Parse(Console.ReadLine());
Console.Write("----------------------\n");
Console.Write("FALTAS = ");
n.fatas = int.Parse(Console.ReadLine());
media = n.n1 + n.t1 + n.n2 + n.t2;
media = media / 4;
if (media >= 6 && n.fatas<=5)
{
Console.Write("-------------------------------------\n");
Console.Write("APROVADO\n");
Console.Write("NOTA = " + media + "\nFALTAS = " + n.fatas);
}
else
{
Console.Write("-------------------------------------\n");
Console.Write("REPROVADO\n");
Console.Write("NOTA = " + media + "\nFALTAS = " + n.fatas);
}
Console.ReadKey();
}
}
}
Comenta ai
=> Class "nota"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EX3
{
class notas
{
public double n1 { get; set; }
public double n2 { get; set; }
public double t1 { get; set; }
public double t2 { get; set; }
public int fatas { get; set; }
public void dados(double a,double b,double c,double d,int f)
{
a = this.n1;
b = this.n2;
c = this.t1;
d = this.t2;
f = this.fatas;
}
}
}
=> Class "Main Principal"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EX3
{
class Program
{
static void Main(string[] args)
{
notas n = new notas();
double media = 0;
Console.Write("NOTA 1 = ");
n.n1 = double.Parse(Console.ReadLine());
Console.Write("TRABALHO 1 = ");
n.t1 = double.Parse(Console.ReadLine());
Console.Write("NOTA 2 = ");
n.n2 = double.Parse(Console.ReadLine());
Console.Write("TRABALHO 2 = ");
n.t2 = double.Parse(Console.ReadLine());
Console.Write("----------------------\n");
Console.Write("FALTAS = ");
n.fatas = int.Parse(Console.ReadLine());
media = n.n1 + n.t1 + n.n2 + n.t2;
media = media / 4;
if (media >= 6 && n.fatas<=5)
{
Console.Write("-------------------------------------\n");
Console.Write("APROVADO\n");
Console.Write("NOTA = " + media + "\nFALTAS = " + n.fatas);
}
else
{
Console.Write("-------------------------------------\n");
Console.Write("REPROVADO\n");
Console.Write("NOTA = " + media + "\nFALTAS = " + n.fatas);
}
Console.ReadKey();
}
}
}
Comenta ai
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|