Question: For this assignment, you are to create a WPF application of a simple student management system. A starter project is provided to help you get
For this assignment, you are to create a WPF application of a simple student management system.
A starter project is provided to help you get started. You can use it as it is, extend it, or create your own.
A base class Person is provided. You are required to inherit from it to create an UndergraduateStudent class, then a GraduateStudent class derived from
UndergraduateStudent class. The differences between the two are:
1. Undergraduate student can only add undergraduate courses, and graduate students can only add graduate course.
2. Course Number 1000-4999 are undergraduate courses.
3. Course Number 5000-9999 are graduate courses.
A Course class is needed, which includes course related information such as Course Name, Course Number etc. Build the Course class based on the information provided on the UI.
When the user selects an existing student from the student list, corresponding student information (first name, last name and etc.) and Course List should be automatically filled in with proper information.
While a student is selected, a user can add courses the student. The following rules are to be followed.
1. Course numbers can only be a 4-digits int number.
2. As mentioned earlier, only undergraduate courses are allowed to be added for undergraduate students. Similarly, only graduate courses are allowed to be added for graduate students.
3. GPA is in the range 0.0-4.0.
4. Total GPA is calculated automatically, and cannot be edited.
Total GPA = (gpa for each course * credit hours) / totalcredit hours
When a student and one of the courses are both selected, related course information boxes should be automatically filled.
Consider exception handling for invalid user input.
ListBox is used in this project. Find a short ListBox in WPF tutorial here.
ListBox Class on MSDN.
Code given:
MainWindow.xaml:
MainWindow.xaml.cs:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes;
namespace TestWPF { ///
private void AddStudentButton_Click(object sender, RoutedEventArgs e) { ListBoxItem studentListBoxItem = new ListBoxItem(); studentListBoxItem.Content = LastNameTextBox.Text + " " + FirstNameTextBox.Text; StudentsListBox.Items.Add(studentListBoxItem); } } }
Person.cs:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace TestWPF { abstract class Person { private string firstName; private string lastName; ///
public string FirstName { get { return firstName; } set { firstName = value; } }
public string LastName { get { return lastName; } set { lastName = value; } }
public int Gender { get { return gender; } set { gender = value; } }
public int Age { get { return age; } set { age = value; } } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
