Southwest Petroleum University-credit point calculator (written in C # And requires. NET 2.0)

Source: Internet
Author: User

Note: You must have. NET Framework 2.0 to run it.

. NET Framework 2.0 (if your computer doesn't have it, download it here): http://www.gougou.com/search? Search =. Net % 20 framework % 202.0 & id = 0

 

Credit point calculator: http://download.csdn.net/source/973619 (to have a csdn account can download)

 

Running Effect (for example ):

 

 

---------------------------------------- The following section describes the class relationship diagram and code ------------------------------------------------

This is a class relationship diagram:

 

The following code is used:

Using system; <br/> using system. collections. generic; <br/> using system. text; </P> <p> namespace Southwest China University of Petroleum _ credit point calculator <br/>{< br/> class Program <br/>{< br/> static void main (string [] ARGs) <br/> {<br/> console. writeline ("Southwest Petroleum University-credit score calculator"); <br/> console. writeline (); </P> <p> term thisterm = new term (); <br/> int numofcourses = getinput. coursenum (); // number of courses for this semester </P> <p> for (INT I = 1; I <= numofcourses; I ++) <br/> {<br /> Console. writeline (); <br/> console. writeline ("-------------- start to enter the {0} Course ------------", I); </P> <p> console. writeline ("How many credits does the {0} course have? ", I); </P> <p> double credit = getinput. getcredit (); </P> <p> console. writeline ("How many points have you scored for the {0} course? ", I); </P> <p> double score = getinput. getcredit (); </P> <p> course onecourse = New Course (credit, score); </P> <p> thisterm. addonecourse (onecourse); </P> <p> console. writeline ("-------------- {0} course entry completed --------------", I); <br/> console. writeline (); <br/>}</P> <p> console. writeline ("the last credit score is:" + thisterm. getfinaljidian (); <br/> console. writeline ("Welcome to my blog: http://blog.csdn.net/cuipengfei1"); <br/> console. re AD (); <br/> system. diagnostics. process. start ("http://blog.csdn.net/cuipengfei1 "); </P> <p >}< br/>}</P> <p> class getinput <br/>{< br/> Public static int coursenum () <br/> {<br/> console. writeline ("How many required courses are there in this semester? (Note: it is a required course) "); <br/> string num = console. readline (); <br/> int num; <br/> Int. tryparse (Num, out num); <br/> return num; <br/>}</P> <p> Public static double getcredit () <br/>{< br/> string credit = console. readline (); <br/> double credit; <br/> double. tryparse (credit, out credit); <br/> return credit; <br/>}</P> <p> class course // a course <br/>{< br/> private double credit; // credits </P> <p> private Double score; // score </P> <p> Public double credit // credits <br/>{< br/> get {return credit ;} <br/> set {credit = value ;} <br/>}</P> <p> Public Double score // score <br/>{< br/> get {return score ;} <br/> set {score = value ;}< br/>}</P> <p> Public Course (double _ credit, double _ score) // construct <br/>{< br/> credit = _ credit; <br/> score = _ score; <br/>}</P> <p> Public double getjidian () // This score <br/>{< br/> double Jidian; <br/> Jidian = (score-60)/10) + 1; <br/> return Jidian; <br/>}</P> <p> class term // This semester <br/>{< br/> List <course> allcourse = new list <course> (); </P> <p> Public void addonecourse (Course course) <br/>{< br/> allcourse. add (course); <br/>}</P> <p> Public double getfinaljidian () <br/>{< br/> double totalcredit = 0; </P> <p> double totaljidian = 0; </P> <p> foreach (course onecourse in allcourse) <br/>{< br/> totalcredit + = onecourse. credit; <br/> totaljidian + = onecourse. getjidian () * onecourse. credit; <br/>}</P> <p> return totaljidian/totalcredit; <br/>}< br/>

 

PS: When can I check the score?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.