hi i am new to c#programming and i need help on how to create a GPA calculator software application using visual studio. the purpose of this application is to keep track of the grades obtained by a student for the modules he is taking. the application allows student to enter module name,module code,module credit and grade obtained for the module.


the difficult part is how do i allow the application to store all the information entered by the student in a text file,so that student can retrieve all his modules information and display them out.


how do i make the application to store information in a text file? and how can the student retrieve all his module details...what are the codes used for this

Recommended Answers

All 16 Replies

atleast need the pseudo code please!!!

i am stuck on what kind of pseudo codes i am supposed to use to code the program.I know that using system.IO would do great,but i am not too sure of the procedures of coding for every elements...can anyone help with the pseudo codes..i have done the GUI design . and i also want to know how to tell the program how many of my text boxes has been filled up top do proper calculations.
http://img805.imageshack.us/img805/3364/guidesign.jpg please go to this link to see my GUI design

hmm thanks Lusiphur for the knowledge but hmmm can i send u a private message on the codes that i have done ?

@yayaza: why handle it privately?
This is not really the purpose of this site, I believe.
My guess is that Lusipur is a very good coder and is able to help you out.
But there are others here too, to help you.
Don't be affraid to show us your code.

commented: That's what I'm sayin'!! +1

@yayaza: why handle it privately?
This is not really the purpose of this site, I believe.
My guess is that Lusipur is a very good coder and is able to help you out.
But there are others here too, to help you.
Don't be affraid to show us your code.

okay thanks

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        constant char DELIM = ',';//delimeter between data fields
        const string FILENAME = @"c:\gpa.text";//location of data file
        string studentId;
        string moduleCode;
        double moduleCredit;
        char moduleGrade;
        double gpaScore;//final GPA 

        FileStream outFile;//creating the File stream object
        StreamWriter writer;// Stream writer object


        public Form1()
        {
            InitializeComponent();
            //create File Stream object to Create a file called FILENAME for writing
            outFile = new FileStream (FILENAME,FileMode.Open, FileAccess.Write);
            //create a StreamcWriter with the outFile File Stream object
            writer=new StreamWriter(outFile);

        }

        private void button1_Click(object sender, EventArgs e)
        {
            //prepare data for writing into file
            for (int row = 0; row < 10; row++)
{
studentId = string.Format ("studIdTb[0]", row);//for rows of textbox array
moduleCode = string.Format ("modCodeTb[0]", column);//for rows of textbox array
}

// modCreditTb's//get module credit
for (int row = 0; row < 10; row++)
{
moduleCreditTb = string.Format ("modCreditTb[0]", row);

}
//get module grade
 moduleCode = string.Format ("modCodeTb{0}", column);//for column of textbox array           

            
            
          
           function gradePoints(inputs);
            var gradeValue=0;
           /* var gradeLet=input;
           * if(var gradeLet=="A") grade value=4
            if(var gradeLet=="B") grade value=4
            if(var gradeLet=="C") grade value=4
           * if(var gradeLet=="D") grade value=4
           * else if wrong input display error message 
           * else if below grade "D"  grade value =0*/
          
         
          
           //calculate GPA
            gpaScore=(moduleCredit * moduleGrade)/moduleCredit;
            //using stream writer to write a record
            writer.WriteLine(studentId + DELIM + moduleCode + moduleCredit + moduleGrade + gpaScore);
            //clear all textboxes in preparation for next record
            

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void exitBtn_Click(object sender, EventArgs e)
        {
            //close the file stream and Stream Writer object
           writer.Close;
            outFile.Close;
        }
    }
}

so far this is what i know.there is still alot to add on and please take a look at my GUI design too at http://img805.imageshack.us/img805/3364/guidesign.jpg

Now we are getting somewhere!
If you show some effort, we are (if we have time) willing to show some effort too!
A question about your user interface design ( I hate the word GUI :@ ) you have 10 textboxes for 10 student ID's. What if you have more students?

Now we are getting somewhere!
If you show some effort, we are (if we have time) willing to show some effort too!
A question about your user interface design ( I hate the word GUI :@ ) you have 10 textboxes for 10 student ID's. What if you have more students?

hmm so what do i do if students have more than 10 students....help me please

To design a user interface is the "easy" part, if you see what VS can offer you for that matter.
But that is not the point.
Have you read the suggestion of Lusiphur about pseudocode??
Take a paper and a pencil!
Ask yourself, amongst other things, this:
1> I want to input some data about a student.
2> I want to save this data.
3> I want to process the data in some way.
Now try to work that out for yourself and perhaps throw away your nicely designed UI?
And really, you don't wanna know how many designs I threw away in the past...

Basically (as ddanbe said) your planning step is the most important step, even more so than the actual coding.

You need to work out step by step what you want to accomplish out of your program and build from there.

If you have an input value with unknown numbers of inputs (ie: any number of possible students) then perhaps you need to plan for a dynamically driven input form that expands the number of input slots based on either a selected number of inputs (user types in number of ids they want to enter) or with an "add new student number" type control which would generate a new input row in your UI.

Perhaps you loop the inputs until an escape is reached (ie: click this button when you are finished entering student id's).

Pseudocode (to give my own definition of it which might be clearer for you) involves using regular English (or your native language if not English), Flowcharts or other means to illustrate the paths your programming will take and the decision points within those paths so that you can work out any logic issues in advance, prior to entering into the coding stage.

As an example of (plain English) pseudocode:

  1. Get number of student ids
  2. Set number of available student id input rows
  3. Prompt user to enter student ids and indicate when finished (finished button?)
  4. When finished button is pressed, loop through list to verify all information has been provided, if not then prompt for incomplete fields
  5. Once form is validated loop through form to transfer form details to dataSet/database/etc., confirm data storage is successful
  6. If successful, return success message
  7. If unsuccessful, return failure message
  8. etc......

This is a general example, not a very high-level example, but it gives the idea of the pseudocode process and how you walk through your processes step by step to create the logic behind them and work out potential bugs in advance of coding.

Hope this helps :)

commented: Nice! +7

Basically (as ddanbe said) your planning step is the most important step, even more so than the actual coding.

You need to work out step by step what you want to accomplish out of your program and build from there.

If you have an input value with unknown numbers of inputs (ie: any number of possible students) then perhaps you need to plan for a dynamically driven input form that expands the number of input slots based on either a selected number of inputs (user types in number of ids they want to enter) or with an "add new student number" type control which would generate a new input row in your UI.

Perhaps you loop the inputs until an escape is reached (ie: click this button when you are finished entering student id's).

Pseudocode (to give my own definition of it which might be clearer for you) involves using regular English (or your native language if not English), Flowcharts or other means to illustrate the paths your programming will take and the decision points within those paths so that you can work out any logic issues in advance, prior to entering into the coding stage.

As an example of (plain English) pseudocode:

  1. Get number of student ids
  2. Set number of available student id input rows
  3. Prompt user to enter student ids and indicate when finished (finished button?)
  4. When finished button is pressed, loop through list to verify all information has been provided, if not then prompt for incomplete fields
  5. Once form is validated loop through form to transfer form details to dataSet/database/etc., confirm data storage is successful
  6. If successful, return success message
  7. If unsuccessful, return failure message
  8. etc......

This is a general example, not a very high-level example, but it gives the idea of the pseudocode process and how you walk through your processes step by step to create the logic behind them and work out potential bugs in advance of coding.

Hope this helps :)

thank you ..i'll work on it. i am going to redo the whole thing again as my visual studio is having some problems:(

You mean after 15 days you still have not figured out how to write this program? The easiest way to display all the data for an (nearly) unlimited number of modules is to use a grid control which is something like a spreadsheet. Here is a free one that's written in C# language.

And reading/writing to text files is not all that complicated -- it ain't rocket science. Here is a short tutorial that might get you started.

hi can i redo and show it to you so that you can tell me where i have gone wrong?

gpa calculator srs document???

If you are going to revive a six-year-old thread at least try to squeeze in a verb.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.