Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace zadanie_1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. decimal[,]rejestracja;
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. rejestracja = new decimal[20, 5];
  20. }
  21.  
  22. private void Form1_Load(object sender, EventArgs e)
  23. {
  24.  
  25. }
  26.  
  27. private void ącznaLiczbaToolStripMenuItem_Click(object sender, EventArgs e)
  28. {
  29.  
  30. decimal suma_tydzień = 0;
  31. for (int i = 0; i < rejestracja.GetLength(0); i++)
  32. {
  33. for (int j = 0; j < rejestracja.GetLength(1); j++)
  34. {
  35. suma_tydzień = suma_tydzień + rejestracja[i, j];
  36. }
  37. }
  38. label3.Text = "Łączna suma" + suma_tydzień + " ";
  39.  
  40. }
  41.  
  42. private void informacjaToolStripMenuItem_Click(object sender, EventArgs e)
  43. {
  44. int max = int.MinValue;
  45. int max_id = -1;
  46.  
  47. for (int i = 0; i < rejestracja.GetLength(0); i++)
  48. {
  49.  
  50. decimal max_z_wiersza = 0;
  51.  
  52.  
  53. for (int j = 0; j < rejestracja.GetLength(1); j++)
  54. {
  55. max_z_wiersza = max_z_wiersza + rejestracja[i, j];
  56.  
  57. }
  58.  
  59. if (max_z_wiersza > max)
  60. {
  61. max_z_wiersza = max;
  62. max_id = i + 1;
  63. }
  64. label4.Text = "Najwięcej zrobił" + max_z_wiersza + " ";
  65. label5.Text = "I" + +max_id + " ";
  66. }
  67.  
  68. }
  69.  
  70. private void button1_Click(object sender, EventArgs e)
  71. {
  72. int nr_pracownika = (int)numericUpDown1.Value - 1;
  73. int nr_dnia = (int)numericUpDown2.Value - 1;
  74. decimal godziny = numericUpDown3.Value;
  75.  
  76. rejestracja[nr_pracownika, nr_dnia] = godziny;
  77.  
  78. }
  79. }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement