女人被躁到高潮嗷嗷叫游戏,久久久久亚洲av成人人电影,久久久精品人妻一区二区三区四,久久久久无码精品国产app,免费人成视频在线播放

留求藝—您的留學規(guī)劃師

編寫一個控制臺應用程序項目Proj6-18用于求學生的GPAGPA是英文平均分的簡稱美國大學的GPA滿分是4分

190次

問題描述:

編寫一個控制臺應用程序項目Proj6-18用于求學生的GPA。GPA是英文平均分的簡稱。美國大學的GPA滿分是4分。求高手給解答

最佳答案

推薦答案

using System;using System.Collections.Generic;using System.Text;namespace Proj6_18{class Student {int sno;string sname; Course[] course;int[] score; double sgpa1; double sgpa2; public int psno {get{ return sno; }set{ sno = value; }}public string psname{get{ return sname; }set{ sname = value; }}public void setcourse(params Course[] course1){course = new Course[course1.Length];for (int i = 0; i< course1.Length; i++)course[i] = course1[i];}public void setscore(int[] score1){score = new int[score1.Length];for (int i = 0; i< score1.Length; i++)score[i] = score1[i];}public void computegpa(){int i;double s, sumc = 0, sumgpa1 = 0, sumgpa2 = 0;for (i = 0; i< score.Length; i++){if (score[i] >= 90)s = 4.0;else if (score[i] >= 80)s = 3.0;else if (score[i] >= 70)s = 2.0;else if (score[i] >= 60)s = 1.0;elses = 0.0;sumgpa1 += course[i].pcredits * s;sumgpa2 += course[i].pcredits * score[i];sumc += course[i].pcredits;}sgpa1 = sumgpa1 / sumc;sgpa2 = sumgpa2 * 4 / sumc / 100;}public void dispstud()//輸出學生e68a84e8a2ade799bee5baa6e997aee7ad9431333335313863信息{Console.WriteLine("學號:{0} 姓名:{1}", sno, sname);Console.WriteLine(" 課程名 學分 分數(shù)");for (int i = 0; i< course.Length; i++)Console.WriteLine(" {0} {1} {2}", course[i].pcname, course[i].pcredits, score[i]);}public void dispgpa() //輸出GPA{Console.WriteLine("常見算法GPA={0:n},標準算法GPA={1:n}", sgpa1, sgpa2);}}class Course{string cname; int credits;public Course() { }public Course(string name, int xf){cname = name;credits = xf;}public string pcname {get{ return cname; }set{ cname = value; }}public int pcredits{get{ return credits; }set{ credits = value; }}}class Program{static void Main(string[] args){Course[] course1 = new Course[] {new Course("課程1",4),new Course("課程2",3), new Course("課程3",2),new Course("課程4",6),new Course("課程5",3)};int[] score1 = new int[] { 92, 80, 98, 70, 89 };Student s1 = new Student();s1.psno = 1; s1.psname = "王華";s1.setcourse(course1);s1.setscore(score1);s1.computegpa();s1.dispstud();s1.dispgpa();}}}

編寫一個控制臺應用程序項目Proj6-18用于求學生的GPAGPA是英文平均分的簡稱美國大學的GPA滿分是4分

為你推薦

網站首頁  |  關于我們  |  聯(lián)系方式  |  用戶協(xié)議  |  隱私政策  |  在線報名  |  網站地圖