Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a c# WPF project I am working on and am completely lost. The assumptions

ID: 3577235 • Letter: T

Question

This is a c# WPF project I am working on and am completely lost. The assumptions used by the program are: Each course carries three credit hours. The program terminates only when the student requires it. The program must follow these registration business rules: No registration more than once for the same course. No registration for more than nine credit hours (e.g., no more than three courses). The program validates the user menu selection, and if valid, registers the student for the selected course. Otherwise, the program outputs an error message. The program then outputs the current list of registered classes. Additionally, the program should output the cumulative total credit hours the student has registered for thus far.

namespace WPFRegisterStudent { ///

/// Interaction logic for MainWindow.xaml ///

public partial class MainWindow : Window

{ Course choice; public MainWindow()

{ InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e)

{ Course course1 = new Course("IT 145"); Course course2 = new Course("IT 200"); Course course3 = new Course("IT 201"); Course course4 = new Course("IT 270"); Course course5 = new Course("IT 315"); Course course6 = new Course("IT 328"); Course course7 = new Course("IT 330"); this.comboBox.Items.Add(course1); this.comboBox.Items.Add(course2);

this.comboBox.Items.Add(course3);

this.comboBox.Items.Add(course4);

this.comboBox.Items.Add(course5);

this.comboBox.Items.Add(course6); this.comboBox.Items.Add(course7); this.textBox.Text = ""; }

private void button_Click(object sender, RoutedEventArgs e)

{ choice = (Course)(this.comboBox.SelectedItem); // TO DO - Create code to validate user selection (the choice object) // and to display an error or a registation confirmation message accordinlgy // Also update the total credit hours textbox if registration is confirmed for a selected course } } } namespace WPFRegisterStudent { ///

/// Interaction logic for App.xaml ///

public partial class App : Application { } }

namespace WPFRegisterStudent { class Course { private string name = ""; private bool isRegisteredAlready = false; public Course(string name) { this.name = name; }

public void setName(string name)

{ this.name = name; } public string getName() { return name; } public bool IsRegisteredAlready() { return isRegisteredAlready; } public void SetToRegistered() { isRegisteredAlready = true; } public override string ToString() { return getName(); } } }

Explanation / Answer

namespace WPFRegisterStudent
{

public partial class MainWindow : Window
{
Course choice;


public MainWindow()
{
InitializeComponent();
}

private void Window_Loaded(object sender, RoutedEventArgs e)
{

Course course1 = new Course("IT 145");
Course course2 = new Course("IT 200");
Course course3 = new Course("IT 201");
Course course4 = new Course("IT 270");
Course course5 = new Course("IT 315");
Course course6 = new Course("IT 328");
Course course7 = new Course("IT 330");


this.comboBox.Items.Add(course1);
this.comboBox.Items.Add(course2);
this.comboBox.Items.Add(course3);
this.comboBox.Items.Add(course4);
this.comboBox.Items.Add(course5);
this.comboBox.Items.Add(course6);
this.comboBox.Items.Add(course7);


this.textBox.Text = "";
}

private void button_Click(object sender, RoutedEventArgs e)
{
choice = (Course)(this.comboBox.SelectedItem);


if(choice.IsRegisteredAlready()==true)

MessageBox.show("sorry! User already registered in this course");

else if(this.textBox.Text=="9")

MessageBox.show("sorry! User already registered in 3 courses");

else

{

choice.SetToRegistered();

if(this.textBox.Text=="")

this.textBox.Text=="3";

else if(this.textBox.Text=="3")

this.textBox.Text=="6";

else if(this.textBox.Text=="6")

this.textBox.Text=="9";

MessageBox.show("Congratulation! User registered in +choice.ToString+ course");

}

}

}
}


namespace WPFRegisterStudent
{

public partial class App : Application
{
}
}

namespace WPFRegisterStudent
{
class Course
{

private string name = "";
private bool isRegisteredAlready = false;

public Course(string name)
{
this.name = name;
}

public void setName(string name)
{
this.name = name;
}

public string getName()
{
return name;
}

public bool IsRegisteredAlready()
{
return isRegisteredAlready;
}

public void SetToRegistered()
{
isRegisteredAlready = true;
}

public override string ToString()
{
return getName();
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote