我正在编写关于在线学生成绩的项目,该项目将计算成绩点,平均成绩点和累积成绩点。所需的输出是:
Name: Shakira Abdullahi
Adm.No: 096784657
Department: Information Technology
Semester: 1st semester
Level: 200
Course title Course code Course unit score Grade
Computer programming II Csc 201 3 45 D
Introduction to file procesing Csc 204 2 57 C
Introduction to the internet Int 201 3 34 F
Linear algebra II Mth 205 2 60 B
Real Analysis I Mth 207 3 76 A
Numeric Analysis Mth 209 2 42 E
Nigerian people and culture Gst 201 2 80 A
Units this session:17
Units to date:35
G.P this session:47
G.P.A last session:3.43
G.P.A to date:2.87
Remarks: To repeat Int 201
Examination grading
Score(%) grade Grade points
70-100 A 5
60-69 B 4
50-59 C 3
45-49 D 2
40-44 E 1
0-39 F 0
说明:
Units this session
:本课程的总课程单元Units to date
:每个会话单元累积到此会话G.P this session
:sum(每门课程(成绩点x单位))G.P to date
:每次会话G.P累积到本次会议G.P.A last session
:平均G.P上次会议G.P.A to date
:迄今为止的平均G.P。level
:我们最多有4个级别:100,200,300和400 在访问结果之前,用户还需要: 姓名,Adm.No,部门,学期和会议。 会议的形式是多年,例如2010-2011。
那么,请问我该怎么做这个项目?我的问题是:
答案 0 :(得分:4)
我建议创建一个数据库,其中包含与学生链接到主表的不同表格。
这是我要创建的表的结构:
在每个中我都会创建所需的列。
学生表
在学生表中,为以下内容创建一列:
<强>课程强>
<强>得分强>
<强>分级强>
包含值的SQL如下:
CREATE TABLE IF NOT EXISTS `student` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(256) NOT NULL,
`AdmNo` int(11) NOT NULL,
`Department` varchar(256) NOT NULL,
`Semester` varchar(256) NOT NULL,
`Level` int(11) NOT NULL,
`SessionUnits` int(11) NOT NULL,
`DateUnits` int(11) NOT NULL,
`ThisGP` int(11) NOT NULL,
`LastGPA` float NOT NULL,
`TDGPA` float NOT NULL,
`Remarks` varchar(256) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
INSERT INTO `student` (`ID`, `Name`, `AdmNo`, `Department`, `Semester`, `Level`, `SessionUnits`, `DateUnits`, `ThisGP`, `LastGPA`, `TDGPA`, `Remarks`) VALUES
(1, 'Shakira Abdullahi', 96784657, 'Information Technology', '1st semester', 200, 17, 35, 47, 3.43, 2.87, 'To repeat Int 201');
CREATE TABLE IF NOT EXISTS `courses` (
`ID` int(11) NOT NULL DEFAULT '0',
`Name` varchar(256) NOT NULL,
`CourseCode` varchar(256) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `courses` (`ID`, `Name`, `CourseCode`) VALUES
(1, 'Computer programming II', 'Csc 201'),
(2, 'Introduction to file procesing', 'Csc 204'),
(3, 'Introduction to the internet', 'Int 201'),
(4, 'Linear algebra II', 'Mth 205'),
(5, 'Real Analysis I', 'Mth 207'),
(6, 'Numeric Analysis', 'Mth 209'),
(7, 'Nigerian people and culture', 'Gst 201');
CREATE TABLE IF NOT EXISTS `scores` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`StudentID` int(11) NOT NULL,
`CourseID` int(11) NOT NULL,
`Score` int(11) NOT NULL,
`CourseUnit` int(11) NOT NULL,
`Grade` varchar(256) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
INSERT INTO `scores` (`ID`, `StudentID`, `CourseID`, `Score`, `CourseUnit`, `Grade`) VALUES
(1, 1, 1, 45, 3, 'D'),
(2, 1, 2, 57, 2, 'C'),
(3, 1, 3, 34, 3, 'F'),
(4, 1, 4, 60, 2, 'B'),
(5, 1, 5, 76, 3, 'A'),
(6, 1, 6, 42, 2, 'E'),
(7, 1, 7, 80, 2, 'A');
CREATE TABLE IF NOT EXISTS `grading` (
`ScoreMinPercent` int(11) NOT NULL AUTO_INCREMENT,
`ScoreMaxPercent` int(11) NOT NULL,
`Grade` varchar(256) NOT NULL,
`GradePoints` int(11) NOT NULL,
PRIMARY KEY (`ScoreMinPercent`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=77 ;
INSERT INTO `grading` (`ScoreMinPercent`, `ScoreMaxPercent`, `Grade`, `GradePoints`) VALUES
(40, 44, 'E', 1),
(45, 49, 'D', 2),
(50, 59, 'C', 3),
(60, 69, 'B', 4),
(70, 100, 'A', 5),
(71, 39, 'F', 0);