mstoyanov7

ceci

Oct 29th, 2021 (edited)
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.82 KB | None | 0 0
  1. using System;
  2.  
  3. class Student
  4.     {
  5.         public string name = "";
  6.         public int grade = 0;
  7.         public int number = 0;
  8.  
  9.         public void setGrades() {
  10.             Console.Write("Въведете оценка по БЕЛ: ");
  11.             BEL = double.Parse(Console.ReadLine());
  12.  
  13.             Console.Write("Въведете оценка по ЧЕП: ");
  14.             foreign = double.Parse(Console.ReadLine());
  15.  
  16.             Console.Write("Въведете оценка по Математика: ");
  17.             maths = double.Parse(Console.ReadLine());
  18.  
  19.             Console.Write("Въведете оценка по Физика: ");
  20.             phys = double.Parse(Console.ReadLine());
  21.  
  22.             Console.Write("Въведете оценка по Химия: ");
  23.             chem = double.Parse(Console.ReadLine());
  24.  
  25.             Console.Write("Въведете оценка по Биология: ");
  26.             bio = double.Parse(Console.ReadLine());
  27.         }
  28.  
  29.         public void getGrades() {
  30.             averageGrade = (BEL + foreign + maths + phys + chem + bio) / 6;
  31.             Console.WriteLine(averageGrade);
  32.         }
  33.  
  34.         private double BEL, foreign, maths, phys, chem, bio;
  35.         private double averageGrade;
  36.     }
  37.                    
  38. public class Program
  39. {
  40.     public static void Main()
  41.     {
  42.         Student ceci = new Student();
  43.             Console.Write("Въведете името на ученика: ");
  44.             ceci.name = Console.ReadLine();
  45.  
  46.             Console.Write("Въведете класа на ученика: ");
  47.             ceci.grade = int.Parse(Console.ReadLine());
  48.  
  49.             Console.Write("Въведете номера на ученика: ");
  50.             ceci.number = int.Parse(Console.ReadLine());
  51.  
  52.             ceci.setGrades();
  53.             ceci.getGrades();
  54.     }
  55. }
Add Comment
Please, Sign In to add comment