1917: Person-Student
内存限制:128 MB
时间限制:1.000 S
评测方式:文本比较
命题人:
提交:89
解决:67
题目描述
define a Person class as follows:
1)contains four data fields: name,addr,sex,age
2)define a no-arg constructor and a constructor with all data fields
3)add a toString method
define a Student class extending Person class:
1) add new properties, math and english to denote the corresponding grade between 0 and 100
2)define a no-arg constructor and a constructor with all data fields
3)override toString method,which invokes toString method of Person class
输入
there are many cases, for each case,input a student,in an order of name,addr,sex,age,math,english
输出
if math and english is not valid,output "wrong grade",else,output the student's information as required
样例输入 复制
zhang sanming male 25 88 65
li hangzhou female 20 77 110
样例输出 复制
zhang, sanming, male, 25 years old, math 88, english 65.
wrong grade.