0% found this document useful (0 votes)
24 views

Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

This document defines a Windows form application that allows a user to add student records to an array. Each student record contains a name, year of study, and GPA. Buttons allow the user to add new records, display the highest GPA record, and display all records. A student class is defined to represent each record with properties for the data. Arrays store the student objects and GPAs. Methods handle clicking the buttons to populate and display the data.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

This document defines a Windows form application that allows a user to add student records to an array. Each student record contains a name, year of study, and GPA. Buttons allow the user to add new records, display the highest GPA record, and display all records. A student class is defined to represent each record with properties for the data. Arrays store the student objects and GPAs. Methods handle clicking the buttons to populate and display the data.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public class Student
{
private string prezimeIme;
private int godinaStudija;
private double prosek;
public string GetSetPrezimeIme
{
set { prezimeIme = value; }
get { return prezimeIme; }
}
public int GetSetGodinaStudija
{
set { godinaStudija = value; }
get { return godinaStudija; }
}
public double GetSetProsek
{
set { prosek = value; }
get { return prosek; }
}
}
int i, ik = 0;

Student[] nizk = new Student[50];


double[] Prosek = new double[50];
private void buttonDodaj_Click(object sender, EventArgs e)
{
nizk[ik] = new Student();
nizk[ik].GetSetPrezimeIme = textBox1.Text;
nizk[ik].GetSetGodinaStudija = Convert.ToInt32(textBox2.Text);
nizk[ik].GetSetProsek = Convert.ToDouble(textBox3.Text);
ik++;
}
private void buttonIspis_Click(object sender, EventArgs e)
{
double max = nizk[0].GetSetProsek;
string prezimeIme = nizk[0].GetSetPrezimeIme;
int godinaStudija = nizk[0].GetSetGodinaStudija;
for (i = 1; i < ik; i++)
if (nizk[i].GetSetProsek > max)
{
max = nizk[i].GetSetProsek;
prezimeIme = nizk[i].GetSetPrezimeIme;
godinaStudija = nizk[i].GetSetGodinaStudija;
}
labelPrezimeIIme.Text = prezimeIme;
labelProsek.Text = Convert.ToString(max);
labelGodinaStudija = Convert.ToInt32(godinaStudija);
}
private void buttonIspisSvihStudenata_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
for (i = 0; i < ik; i++)
{
listBox1.Items.Add("Prezime i ime: " + nizk[i].GetSetPrezimeIme);
listBox1.Items.Add("Godina studija: " + nizk[i].GetSetGodinaStudija);
listBox1.Items.Add("Prosek: " + nizk[i].GetSetProsek);
listBox1.Items.Add("");
}
}
}
}

You might also like