Advertisement
hurmawe

lab2

Sep 24th, 2022
750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.28 KB | None | 0 0
  1. using System.Drawing;
  2.  
  3. namespace lab2
  4. {
  5.     public class Me
  6.     {
  7.         public string name;//фио
  8.         public string gender;//пол
  9.         public Color coloreye;//цвет глаз
  10.         public int age;
  11.        
  12.             public int mat; //математика
  13.             public int fiz;// физика
  14.             public int prog;// программирование
  15.             public int fil;//философия
  16.  
  17.         public string grand()
  18.         {
  19.             if ((mat >= 4 & mat <= 5) & (fiz >= 4 & fiz <= 5) & (prog >= 4 & prog <= 5) & (fil >= 4 & fil <= 5))
  20.                 return "Получает";
  21.             else
  22.                 return "Ползает по помойкам";
  23.         }
  24.     }
  25. }
  26.  
  27.  
  28. ////////////////////////////////////////////////////////
  29. using System;
  30. using System.Collections.Generic;
  31. using System.ComponentModel;
  32. using System.Data;
  33. using System.Drawing;
  34. using System.Linq;
  35. using System.Text;
  36. using System.Threading.Tasks;
  37. using System.Windows.Forms;
  38.  
  39. namespace lab2
  40. {
  41.     public partial class Form1 : Form
  42.     {
  43.         public Form1()
  44.         {
  45.             InitializeComponent();
  46.         }
  47.         public Me createMe(int mark_mat, int mark_fiz, int mark_prog, int mark_fil)
  48.         {
  49.             Me Ivanov = new Me();
  50.             Ivanov.name = "Иванов Александр Евгеньевич";
  51.             Ivanov.coloreye = Color.Brown;
  52.             Ivanov.gender = "Мужской";
  53.             Ivanov.age = 19;
  54.             Ivanov.mat = mark_mat;
  55.             Ivanov.fiz= mark_fiz;
  56.             Ivanov.prog = mark_prog;
  57.             Ivanov.fil = mark_fil;
  58.             return Ivanov;
  59.         }
  60.         public void fillMe(Me ivanov)
  61.         {
  62.             l_name.Text = ivanov.name;
  63.             l_age.Text = ivanov.age.ToString();
  64.             p_coloreye.BackColor = ivanov.coloreye;
  65.             l_gender.Text = ivanov.gender;
  66.             l_mat.Text = ivanov.mat.ToString();
  67.             l_fiz.Text = ivanov.fiz.ToString();
  68.             l_prog.Text = ivanov.prog.ToString();
  69.             l_fil.Text = ivanov.fil.ToString();
  70.             l_grand.Text = ivanov.grand();
  71.         }
  72.         private void button1_Click(object sender, EventArgs e)
  73.         {
  74.             fillMe(createMe(5, 5, 5, 3));
  75.         }
  76.     }
  77. }
  78.  
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement