Jump to content

C# help

peaky101

hey all, first post and thread all in the one here !!!

 

 

anyway to the question. i've been given a task to complete a points calculator for qualifications. the qualifications are in a combobox dropdown menu and the grade is in another combobox next to it.  depending on the qualification and the grade depends on the points given. 

 

for example advanced higher at an A level is 130 points. 

 

it can have upto 6 qualifications entered and the points gather over the 6 need added up and displayed as a total. im at a complete lose of how to do this.

Link to comment
Share on other sites

Link to post
Share on other sites

hey all, first post and thread all in the one here !!!

 

 

anyway to the question. i've been given a task to complete a points calculator for qualifications. the qualifications are in a combobox dropdown menu and the grade is in another combobox next to it.  depending on the qualification and the grade depends on the points given. 

 

for example advanced higher at an A level is 130 points. 

 

it can have upto 6 qualifications entered and the points gather over the 6 need added up and displayed as a total. im at a complete lose of how to do this.

Can you post the actual specification of the software? All requirements and features. In proper english.

 

It sounds like an easy thing to create that wouldnt take more than 10 to 30 mins.

Link to comment
Share on other sites

Link to post
Share on other sites

You've been 'given' a task; by who/what entity? Is this coursework/homework or a project related problem? I think you really need to work on cleaning up your question/making it a lot more clear and concise because right now, at least to me it makes little sense and is difficult to follow.

 

I interpreted: You have grades, qualifications and points. Your grades are related to qualifications but are defined by points. You have 6 of these relationships that can be entered and a total must be accumulated for each of their point values...

 

What is your model like? Moreover what do you actually need help with?

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

The image explains it bit better.

 

in the qualification comboboxes the options are: advanced higher, higher, standard grades

 

the grade options are: A, B, C, D , band 1, band 2  

 

The points to be allocated are in the other image. once each box is filled the points have to be added together and the total placed in the bottom right hand corner box

post-109750-0-45432800-1406832369.png

post-109750-0-79667800-1406832517.png

Link to comment
Share on other sites

Link to post
Share on other sites

The image explains it bit better.

 

in the qualification comboboxes the options are: advanced higher, higher, standard grades and HND 

 

the grade options are: A, B, C, D , band 1, band 2 and hnd pass 

 

The points to be allocated are in the other image. once each box is filled the points have to be added together and the total placed in the bottom right hand corner box

 

Right that's more information, but what is it exactly that you require assistance with?

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

You've been 'given' a task; by who/what entity? Is this coursework/homework or a project related problem? I think you really need to work on cleaning up your question/making it a lot more clear and concise because right now, at least to me it makes little sense and is difficult to follow.

 

I interpreted: You have grades, qualifications and points. Your grades are related to qualifications but are defined by points. You have 6 of these relationships that can be entered and a total must be accumulated for each of their point values...

 

What is your model like? Moreover what do you actually need help with?

 

sorry, I have to create the program to help students decide which year of university to register for. so they enter the qualifications they have with the grades they got for each and it out puts a score. based on what score they receive determines what year they are recommended to enter.

Link to comment
Share on other sites

Link to post
Share on other sites

Right that's more information, but what is it exactly that you require assistance with?

i stupidly took this on and i have no idea where to start with the actual programming part of it. as you can see i have made the form, however i don't know how to connect all the pieces behind the scenes. so i guess the questions is can anyone guide me through the process ? 

Link to comment
Share on other sites

Link to post
Share on other sites

i stupidly took this on and i have no idea where to start with the actual programming part of it. as you can see i have made the form, however i don't know how to connect all the pieces behind the scenes. so i guess the questions is can anyone guide me through the process ? 

 

I see now, so you simply have a UI, What is your actual experience with Software Development? Also it's not immediately clear to me from that screenshot, did you choose WPF or WinForms? 

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

I see now, so you simply have a UI, What is your actual experience with Software Development? Also it's not immediately clear to me from that screenshot, did you choose WPF or WinForms? 

 

i dont have much experience at all, its a windows form

Link to comment
Share on other sites

Link to post
Share on other sites

i dont have much experience at all, its a windows form

 

Indeed, in that case I would advise you to look at WPF and the MVVM design pattern over going the WinForms route. It's the more modern approach and generally facilitates better software practices.

 

That said however it's not going to be something you can learn overnight and therefore will not address your current predicament. What you are trying to achieve is actually quite trivial in the grand scheme of things. Though I don't suggest it seems that way from your perspective by any means. Furthermore I doubt it's going to be practical or possible to spoon feed you all of the knowledge that your going to need in order to complete your task on here.

 

What we can do however is talk about architecture. It's important to calm down first, then to think about the problem in small chunks and specifically in relation to being separated out into at least Model, View, Controller/ViewModel.

 

What's your model going to be? Well what are our things/entities here? We have Qualifications and Grades. What fields do we have on each of our things? A name probably for each entity and specifically a Point value for a Grade . Do we have any relationships? Yes, our Qualifications are related to Grades.

 

We could then make our classes like so:

class Grade{   int Index { get; set; }   string Name { get; set; }   int Points { get; set; }}class Qualification{   int Index { get; set; }   string Name { get; set; }}

If you want to limit Grades to only applicable Qualifications, make another class to represent the relationship?

class QualificationGradeRelationship{   int Index { get; set; }   int QualificationIndex { get; set; }   int GradeIndex { get; set; }}

I added an index field because I assumed that you are going to be storing this data in some form of database? If you are then you should learn about the Entity Framework. Without going into the specifics of this it will handle your data model for you to a certain extent and you can come at it by two approaches; model first or code first (look these up).

 

Once you have your model worked out it should then just be a case of implementing your view logic. This is why I suggested MVVM; you can clearly separate out these parts of the application. Your View is exactly that, just UI and nothing more, it knows nothing about your VIewModel (which is where you implement your business logic) and vice versa, the ViewModel knows nothing bout the View. The same applies to your Model, it's also completely separated and has nothing to do with the other two layers. As a specific example when applied in WPF; the View interacts with the ViewModel via data bindings, commands, ViewModel locators and so on and the ViewModel interacts with the View via events, interaction requests, dependency properties and many other patterns. These are all methods of abstraction aimed at maintaining encapsulation and separation. There are a number of libraries that both facilitate and enrich the MVVM design pattern; Prism, MVVMLight, DevExpress and so on.

 

I digress. Binding View to code behind in a dirty way, for what you need is trivial in WInForms. Find the control you want and examine it's events and properties then connect them... Do you really need to go into the specifics of how to do this? Let's take a button for example, in the designer simply double click it and Visual Studio will generate you an event handler for the OnClick event for that button in your code behind class.

 

When you come to implementing your business logic, in the interest of keeping things clean and concise you should consider the syntactic sugar that LINQ offers for things like performing summing on a collection of classes with numeric properties. i.e. to get your total from what's been selected in your combo boxes.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

Thinking about it if your data model is read only and small enough you might well not even need to go the database route at all. Just create it in XML, maybe embed it as a resource and load the data into your data structures yourself at runtime. Furthermore LINQ is ideal for this.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×