10 Replies - 8048 Views - Last Post: 11 July 2010 - 07:21 AM Rate Topic: -----

#1 jasonBoy  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 4
  • Joined: 09-July 10

GPA calculator

Posted 09 July 2010 - 09:49 PM

How to create GPA calculator software application where the program stores data entered by user.
the program allows user to key in module id,module grade,module credit and module code.The application will store all these information into a text file.student may also use the application to retrieve all his modules’ information and displayed them out. Lastly, the application must be able to calculate and display the student’s GPA.How do i do code this program...i atleast need a guide with the psedocodeand comments.I only have a rough idea that i should use system.IO,exception handlers to code this program..please help me as i am new to c# programming.

Is This A Good Question/Topic? 0
  • +

Replies To: GPA calculator

#2 Momerath  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1010
  • View blog
  • Posts: 2,444
  • Joined: 04-October 09

Re: GPA calculator

Posted 09 July 2010 - 10:33 PM

Sounds like classwork to me. Learn to do your own work or change your major.
Was This Post Helpful? 0
  • +
  • -

#3 jasonBoy  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 4
  • Joined: 09-July 10

Re: GPA calculator

Posted 09 July 2010 - 11:03 PM

View PostMomerath, on 09 July 2010 - 09:33 PM, said:

Sounds like classwork to me. Learn to do your own work or change your major.

i have done the GUI design using visual studio and now im thinking about the psedo codes.please take a look at http://img31.imagesh...1/6708/gpaf.jpg
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: GPA calculator

Posted 09 July 2010 - 11:05 PM

Ok, we're not just to give you the code or pseudo code you seek, we're not a code writing service. What have you written so far, what effort have you made to create the process/logic/pseudo-code for this assignment?
Was This Post Helpful? 0
  • +
  • -

#5 jasonBoy  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 4
  • Joined: 09-July 10

Re: GPA calculator

Posted 09 July 2010 - 11:53 PM

http://img805.images...4/guidesign.jpg changes done in GUI design. i dont know much about it. I only know this:
            //get number of modules

            //get module code

            //get module credit

            //get module grade
            //read line 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  * //calculate GPA
GPA =sum of all (grade points * module credits)/module credits


how can i improve from here
Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5481
  • View blog
  • Posts: 11,762
  • Joined: 02-June 10

Re: GPA calculator

Posted 10 July 2010 - 10:54 AM

You've spent 2-3 minutes dragging controls from the toolbox.
You have a plan. I use comments all the time to "rough out" my plan of attack, just as you have done here.
You obviously have enough grasp of basic math to understand how to calculate a GPA.
The important thing is that you have recognized the need to take what seems like a big project and cut it down into a lot of small manageable parts.

So start writing the code for each part. If you have not slept through the classes up to this project then you should have learned enough C# language to do this much.
Was This Post Helpful? 0
  • +
  • -

#7 Momerath  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1010
  • View blog
  • Posts: 2,444
  • Joined: 04-October 09

Re: GPA calculator

Posted 10 July 2010 - 10:58 AM

Start with a beginning book on C# and work through the problems there. Your 'code' is so far from actually working code that it would require more time to teach you C# than you probably have for this assignment.
Was This Post Helpful? 0
  • +
  • -

#8 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5481
  • View blog
  • Posts: 11,762
  • Joined: 02-June 10

Re: GPA calculator

Posted 10 July 2010 - 11:12 AM

May I suggest picking up a basic C# introductory book? It's not that people here don't want to be helpful, but there is a certain amount of basic learning work that one should really take upon themselves before asking for help. There are so many great "How do I build my first application" tutorials on the web... There are dozens of "Learn C# in 21 days", "My first C# program" books at your look book seller or even public library... Asking a forum, any forum, to hand-hold you through it is just redundant. In many ways it disrespects the people who have invested dozens of hours in the on-line tutorials and those that spent thousands of hours in authoring books.

Build a Program Now! in Visual C# by Microsoft Press, ISBN 0-7356-2542-5
is a terrific book that has you build a Windows Forms application, a WPF app, a database application, your own web browser.

C# Cookbooks
Are a great place to get good code, broken down by need, written by coding professionals. You can use the code as-is, but take the time to actually study it. These professionals write in a certain style for a reason developed by years of experience and heartache.

Microsoft Visual Studio Tip, 251 ways to improve your productivity, Microsoft press, ISBN 0-7356-2640-5
Has many, many great, real-world tips that I use all the time.

The tutorials below walk through making an application including inheritance, custom events and custom controls.
Quick and easy custom events
Bulding an application - Part 1
Building an application - Part 2
Working with environmental variables

Writing a text file is always one of the first things people want to do, in order to store data like high-scores, preferences and so on
Writing a text file tutorial.

These are just good every-day references to put in your bookmarks.
MSDN C# Developers Center with tutorials
Welcome to Visual Studio

Have you seen the MSDN Code Samples? They spent a lot of time creating samples and demos. It seems a shame to not use them.

  • Anonymous Delegates: Demonstrates the use of unnamed delegates to reduce application complexity.
  • Arrays: Shows how to use arrays.
  • Attributes: Shows how to create custom attribute classes, use them in code, and query them through reflection.
  • Collection Classes: Shows how to make non-generic collection classes that can be used with the foreach statement.
  • COM Interop Part I: Shows how to use C# to interoperate with COM objects.
  • COM Interop Part II: Shows how to a use a C# server together with a C++ COM client.
  • Commandline: Demonstrates simple command-line processing and array indexing.
  • Condiational Methods: Demonstrates conditional methods, which provide a powerful mechanism by which calls to methods can be included or omitted depending on whether a symbol is defined.
  • Delegates: Shows how delegates are declared, mapped to static and instance methods, and combined into multicast delegates.
  • Events: Shows how to declare, invoke, and configure events in C#.
  • Explicit Interface: Demonstrates how to explicitly implement interface members and how to access those members from interface instances.
  • Generics: Shows how to make generic collection classes that can be used with the foreach statement.
  • Hello World: A Hello World application.
  • Indexers Part I: Shows how C# classes can declare indexers to provide array-like access to objects.
  • Indexers Part II: Shows how to implement a class that uses indexed properties. Indexed properties enable you to use a class that represents an array-like collection.
  • Libraries: Shows how to use compiler options to create a DLL from multiple source files; also, how to use the library in other programs
  • Named and Optional (C# 4.0): Demonstrates Named and Optional parameters, an alternative to method overloads
  • Nullable: Demonstrates value types, such as double and bool, that can be set to null
  • Office Sample (C# 4.0): Demonstrates how Dynamic and COM Interop make it easy to call Microsoft Office in C# 4.0
  • OLEDB: Demonstrates how to use a Microsoft Access database from C# by creating a dataset and adding tables to it.
  • Operator Overloading: Shows how user-defined classes can overload operators
  • Partial Types: Demonstrates how classes and structures can be defined in multiple C# source-code files
  • PInvoke: Shows how to call exported DLL functions from C#
  • Properties: Shows how properties are declared and used; also demonstrates abstract properties
  • Python Sample (C# 4.0): Learn how to call a Python script by using the Dynamic feature in C# 4.0
  • Security: Discusses .NET Framework security and shows how to modify security permissions in C# by using permission classes and permission attributes
  • Simple Variance (C# 4.0): See how Covariance and Contravariance are supported in generic interfaces and delegates
  • Structs: Shows how to use structs in C#.
  • Threading: Demonstrates various thread activities such as creating and executing a thread, synchronizing threads, interacting between threads, and using a thread pool
  • Unsafe: Shows how to use unmanaged code (code that uses pointers) in C#
  • User Conversions: Shows how to define conversions to and from user-defined types
  • Versioning: Demonstrates versioning in C# by using the override and new keywords
  • XML Documents: Shows how to document code by using XML
  • Yield: Demonstrates how to use the yield keyword to filter items in a collection

Was This Post Helpful? 3
  • +
  • -

#9 jasonBoy  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 4
  • Joined: 09-July 10

Re: GPA calculator

Posted 10 July 2010 - 10:53 PM

MOD EDIT: Removed unnecessary quote of post immediately preceding

   1.
      using System;
   2.
      using System.IO;
   3.
      using System.Collections.Generic;
   4.
      using System.ComponentModel;
   5.
      using System.Data;
   6.
      using System.Drawing;
   7.
      using System.Linq;
   8.
      using System.Text;
   9.
      using System.Windows.Forms;
  10.
       
  11.
      namespace WindowsFormsApplication3
  12.
      {
  13.
      public partial class Form1 : Form
  14.
      {
  15.
      constant char DELIM = ',';//delimeter between data fields
  16.
      const string FILENAME = @"c:\gpa.text";//location of data file
  17.
      string studentId;
  18.
      string moduleCode;
  19.
      double moduleCredit;
  20.
      char moduleGrade;
  21.
      double gpaScore;//final GPA
  22.
       
  23.
      FileStream outFile;//creating the File stream object
  24.
      StreamWriter writer;// Stream writer object
  25.
       
  26.
       
  27.
      public Form1()
  28.
      {
  29.
      InitializeComponent();
  30.
      //create File Stream object to Create a file called FILENAME for writing
  31.
      outFile = new FileStream (FILENAME,FileMode.Open, FileAccess.Write);
  32.
      //create a StreamcWriter with the outFile File Stream object
  33.
      writer=new StreamWriter(outFile);
  34.
       
  35.
      }
  36.
       
  37.
      private void button1_Click(object sender, EventArgs e)
  38.
      {
  39.
      //prepare data for writing into file
  40.
      for (int row = 0; row < 10; row++)
  41.
      {
  42.
      studentId = string.Format ("studIdTb[0]", row);//for rows of textbox array
  43.
      moduleCode = string.Format ("modCodeTb[0]", column);//for rows of textbox array
  44.
      }
  45.
       
  46.
      // modCreditTb's//get module credit
  47.
      for (int row = 0; row < 10; row++)
  48.
      {
  49.
      moduleCreditTb = string.Format ("modCreditTb[0]", row);
  50.
       
  51.
      }
  52.
      //get module grade
  53.
      moduleCode = string.Format ("modCodeTb{0}", column);//for column of textbox array
  54.
       
  55.
       
  56.
       
  57.
       
  58.
      function gradePoints(inputs);
  59.
      var gradeValue=0;
  60.
      /* var gradeLet=input;
  61.
        * if(var gradeLet=="A") grade value=4
  62.
        if(var gradeLet=="B") grade value=4
  63.
        if(var gradeLet=="C") grade value=4
  64.
        * if(var gradeLet=="D") grade value=4
  65.
        * else if wrong input display error message
  66.
        * else if below grade "D" grade value =0*/
  67.
       
  68.
       
  69.
       
  70.
      //calculate GPA
  71.
      gpaScore=(moduleCredit * moduleGrade)/moduleCredit;
  72.
      //using stream writer to write a record
  73.
      writer.WriteLine(studentId + DELIM + moduleCode + moduleCredit + moduleGrade + gpaScore);
  74.
      //clear all textboxes in preparation for next record
  75.
       
  76.
       
  77.
      }
  78.
       
  79.
      private void label5_Click(object sender, EventArgs e)
  80.
      {
  81.
       
  82.
      }
  83.
       
  84.
      private void exitBtn_Click(object sender, EventArgs e)
  85.
      {
  86.
      //close the file stream and Stream Writer object
  87.
      writer.Close;
  88.
      outFile.Close;
  89.
      }
  90.
      }
  91.
      }
so far this is what i have done...can anyone please pin-point my mistakes and i need help in processing data ,meaning how tell the program the number of module codes text box filled in and to claculate with given data.

This post has been edited by JackOfAllTrades: 11 July 2010 - 06:01 AM

Was This Post Helpful? -1
  • +
  • -

#10 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: GPA calculator

Posted 11 July 2010 - 12:15 AM

Please format your code correctly and don't quote such a large post for no reason.
Was This Post Helpful? 0
  • +
  • -

#11 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5481
  • View blog
  • Posts: 11,762
  • Joined: 02-June 10

Re: GPA calculator

Posted 11 July 2010 - 07:21 AM

Quote

so far this is what i have done...

I don't think YOU'VE done that at all.
That is all copied from a numeralized list. It is the text you would get if you copy/paste from a code block found here on D.I.C.
It is NOT from your Visual Studio project.
Which means you either copied this from someone else's post... or you are double-posting this in two different threads. Either way - shame on you.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1