![]() |
|
|||||||
| 論壇說明 |
|
歡迎您來到『史萊姆論壇』 ^___^ 您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的! 請點擊這裡:『註冊成為我們的一份子!』 |
![]() |
|
|
主題工具 | 顯示模式 |
|
|
#1 |
|
長老會員
![]() |
PHP 語法:
|
|
__________________ 金錢的數量,決定馬子的漂亮 硬碟的容量,決定男人的力量 製作Mail Logo按這裡 |
|
|
|
送花文章: 257,
|
|
|
#2 (permalink) |
|
註冊會員
![]() |
雖然我不知道為什麼你要這要做
不過很好改 語法:
interface Data
{
public void showData();
}
interface Test
{
public void showScore();
public double calcu();
}
abstract class CStu implements Data,Test
{
protected String id; // 學號
protected String name; // 姓名
protected int mid; // 期中考成績
protected int finl; // 期末考成績
protected int common; // 平時成績
public CStu(String s1,String s2,int m,int f,int c)
{
id=s1;
name=s2;
mid=m;
finl=f;
common=c;
}
public void show()
{
showData();
showScore();
}
public void showScore()
{
System.out.println("期中考成績:"+mid);
System.out.println("期末考成績:"+finl);
System.out.println("平時成績:"+common);
System.out.println("學期成績:"+calcu());
}
public void showData()
{
System.out.println("學號:"+id);
System.out.println("姓名:"+name);
}
public double calcu()
{
return (mid*0.3+finl*0.3+common*0.4);
}
}
class SubClass extends CStu{
public SubClass(String s1,String s2,int m,int f,int c){
super(s1,s2,m,f,c);
}
}
public class App
{
public static void main(String args[])
{
CStu stu=new SubClass("940001","Fiona",90,92,85);
stu.show();
}
}
|
|
|
送花文章: 623,
|
|
向 snoopy 送花的會員:
|
|
|
#6 (permalink) |
|
註冊會員
![]() |
語法:
interface Data {
public void showData();
}
abstract class Test {
abstract public void showScore();
abstract public double calcu();
}
class CStu extends Test implements Data {
protected String id; // 學號
protected String name; // 姓名
protected int mid; // 期中考成績
protected int finl; // 期末考成績
protected int common; // 平時成績
public CStu(String s1, String s2, int m, int f, int c) {
id = s1;
name = s2;
mid = m;
finl = f;
common = c;
}
public void show() {
showData();
showScore();
}
public void showScore() {
System.out.println("期中考成績:" + mid);
System.out.println("期末考成績:" + finl);
System.out.println("平時成績:" + common);
System.out.println("學期成績:" + calcu());
}
public void showData() {
System.out.println("學號:" + id);
System.out.println("姓名:" + name);
}
public double calcu() {
return (mid * 0.3 + finl * 0.3 + common * 0.4);
}
}
public class App {
public static void main(String args[]) {
CStu stu = new CStu("940001", "Fiona", 90, 92, 85);
stu.show();
}
}
|
|
|
送花文章: 623,
|
|
向 snoopy 送花的會員:
|
|
|
#7 (permalink) | |
|
長老會員
![]() |
引用:
|
|
|
|
送花文章: 257,
|