標題:
電話簿 (一)
[打印本頁]
作者:
tonyh
時間:
2012-11-15 15:22
標題:
電話簿 (一)
本帖最後由 tonyh 於 2012-11-24 16:11 編輯
[attach]630[/attach]
import java.io.Console;
public class ch41
{
public static void main(String args[])
{
String name;
String tel[][]={{"大雄","0980-454666"},
{"技安","0911-333898"},
{"宜靜","0922-999579"},
{"阿福","0938-234567"},
{"小叮噹","0911-864356"}};
Console console=System.console();
System.out.println("***小米的電話簿***");
System.out.println("1.輸入'all'顯示完整電話簿\n2.輸入姓名查詢目標對象的電話\n3.輸入'end'結束程式");
System.out.print("請在此輸入: ");
name=console.readLine();
if(name.equals("all")==true)
{
System.out.println("編號\t姓名\t電話");
System.out.println("============================");
for(int i=0; i<=4; i++)
{
System.out.print((i+1)+"\t");
for(int j=0; j<=1;j++)
{
System.out.print(tel[i][j]+"\t");
}
System.out.println();
}
}
}
}
複製代碼
作者:
黃博鴻
時間:
2012-11-24 16:19
import java.io.Console;
public class ch41
{
public static void main(String args[])
{
Console console=System.console();
String name;
System.out.println("***明久的電話簿***");
System.out.println("1.請輸入'all'以顯示完整電話簿\n2.輸入名字以顯示目標電話\n3.輸入'end'以結束程式");
System.out.print("請輸入: ");
name=console.readLine();
String tel[][]={{"板本雄二","0985-326124"},{"土屋康太","0987-517640"}
,{"木下秀吉","0956-784356"},{"島田美波","0934-521345"},
{"姬路瑞希","0965-521521"},{"工藤愛子","0956-599599"}};
if(name.equals("all")==true)
{
System.out.println("編號\t姓名\t\t電話號碼");
System.out.println("=====================================");
for(int i=0; i<=5; i++)
{
System.out.print((i+1)+"\t");
for(int j=0; j<=1; j++)
{
System.out.print(tel[i][j]+"\t");
}
System.out.println();
}
}
}
}
複製代碼
作者:
蔡昀佑
時間:
2012-11-24 16:20
import java.io.Console;
public class ch41
{
public static void main(String args[])
{
String name;
String tel[][]={{"大雄","0980-454666"},
{"技安","0911-333898"},
{"宜靜","0922-999579"},
{"阿福","0938-234567"},
{"小叮噹","0911-864356"}};
Console console=System.console();
System.out.println("***小米的電話簿***");
System.out.println("1.輸入'all'顯示完整電話簿\n2.輸入姓名查詢目標對象的電話\n3.輸入'end'結束程式");
System.out.print("請在此輸入: ");
name=console.readLine();
if(name.equals("all")==true)
{
System.out.println("編號\t姓名\t電話");
System.out.println("============================");
for(int i=0; i<=4; i++)
{
System.out.print((i+1)+"\t");
for(int j=0; j<=1;j++)
{
System.out.print(tel[i][j]+"\t");
}
System.out.println();
}
}
}
}
複製代碼
作者:
尤泓鈞
時間:
2012-11-24 16:20
import java.io.Console;
public class ch41
{
public static void main(String args[])
{
String name;
String tel[][]={{"大雄","0980-454666"},
{"技安","0911-333898"},
{"宜靜","0922-999579"},
{"阿福","0938-234567"},
{"小叮噹","0911-864356"}};
Console console=System.console();
System.out.println("***小米的電話簿***");
System.out.println("輸入'all'顯示完整電話簿\t2.輸入姓名查詢目標對象的電話\t3.輸入'end'結束程式");
System.out.print("請在此輸入: ");
name=console.readLine();
if(name.equals("all")==true)
{
System.out.println("編號\t姓名\t電話");
System.out.println("============================");
for(int i=0; i<=4; i++)
{
System.out.print((i+1)+"\t");
for(int j=0; j<=1;j++)
{
System.out.print(tel[i][j]+"\t");
}
System.out.println();
}
}
}
}
複製代碼
作者:
t2364705
時間:
2012-11-24 16:21
import java.io.Console;
public class ch41
{
public static void main(String args[])
{
String name;
String tel[][]={{"大雄","0980-564561"},
{"小夫","0911-333898"},
{"靜香","0922-999579"},
{"胖虎","0938-244567"},
{"小叮噹","0947-864356"}};
Console console=System.console();
System.out.println("***小米的電話簿***");
System.out.println("1.輸入'all'顯示完整電話簿\n2.輸入姓名查詢目標對象的電話\n3.輸入'end'結束程式");
System.out.print("請在此輸入: ");
name=console.readLine();
if(name.equals("all")==true)
{
System.out.println("編號\t姓名\t電話");
System.out.println("============================");
for(int i=0; i<=4; i++)
{
System.out.print((i+1)+"\t");
for(int j=0; j<=1;j++)
{
System.out.print(tel[i][j]+"\t");
}
System.out.println();
}
}
}
}
複製代碼
作者:
lon
時間:
2012-11-24 16:42
import java.io.*;
public class telephone {
public static void main(String[] args) {
String tel[][]={{"甲","0912-123456"},
{"乙","0923-234567"},
{"丙","0934-345678"},
{"丁","0945-456789"},
{"戊","0956-567891"}};
Console console=System.console();
System.out.println("***小米的電話簿***");
System.out.println("1.輸入all顯示完整電話簿\n2.輸入姓名查詢目標對象的電話\n3.輸入end結束程式");
String name;
name=console.readLine();
if(name.equals("all")==true){
for(int i=0;i<5;i++){
System.out.print((i+1)+"\t");
for(int j=0;j<2;j++){
System.out.println(tel[i][j]);
}
}
}
}
}
複製代碼
作者:
t2364705
時間:
2012-11-24 17:06
import java.io.Console;
public class ch42
{
public static void main(String args[])
{
String name;
int sum;
String tel[][]={{"大雄","0980-564561"},
{"小夫","0911-333898"},
{"靜香","0922-999579"},
{"胖虎","0938-244567"},
{"小叮噹","0947-864356"}};
Console console=System.console();
System.out.println("***小米的電話簿***");
System.out.println("1.輸入'all'顯示完整電話簿\n2.輸入姓名查詢目標對象的電話\n3.輸入'end'結束程式");
System.out.print("請在此輸入: ");
name=console.readLine();
if(name.equals("all")==true)
{
System.out.println("編號\t姓名\t電話");
System.out.println("============================");
for(int i=0; i<=4; i++)
{
System.out.print((i+1)+"\t");
for(int j=0; j<=1;j++)
{
System.out.print(tel[i][j]+"\t");
}
System.out.println();
}
}else
{
for(int i=0; i<=4; i++)
{
if(name.equals(tel[i][0])==true)
{
System.out.println(tel[i][0]+"的電話是"+tel[i][1]);
sum++;
}
}
if(sum==0)
{
System.out.println("查無此人!");
}
}
}
}
複製代碼
作者:
劉漢文
時間:
2012-12-8 14:24
import java.io.Console;
public class ch41
{
public static void main(String args[])
{
String name;
String tel[][]={{"大雄","0980-454666"},
{"技安","0911-333898"},
{"宜靜","0922-999579"},
{"阿福","0938-234567"},
{"小叮噹","0911-864356"}};
Console console=System.console();
System.out.println("***小米的電話簿***");
System.out.println("1.輸入'all'顯示完整電話簿\n2.輸入姓名查詢目標對象的電話\n3.輸入'end'結束程式");
System.out.print("請在此輸入: ");
name=console.readLine();
if(name.equals("all")==true)
{
System.out.println("編號\t姓名\t電話");
System.out.println("============================");
for(int i=0; i<=4; i++)
{
System.out.print((i+1)+"\t");
for(int j=0; j<=1;j++)
{
System.out.print(tel[i][j]+"\t");
}
System.out.println();
}
}
}
}
複製代碼
作者:
t3742238
時間:
2012-12-8 14:41
import java.io.Console;
public class ch41
{
public static void main(String args[])
{
String name;
String tel[][]={{"大雄","0980-454666"},
{"技安","0911-333898"},
{"宜靜","0922-999579"},
{"阿福","0938-234567"},
{"小叮噹","0911-864356"}};
Console input=System.console();
System.out.println("***小米的電話簿***");
System.out.println("1.輸入'all'顯示完整電話簿\n2.輸入姓名查詢目標對象的電話\n3.輸入'end'結束程式");
System.out.print("請在此輸入: ");
name=input.readLine();
if(name.equals("all")==true)
{
for(int i=0;i<=4;i++)
{
for(int j=0;j<=1;j++)
{
System.out.println(tel[i][j]+"\t");
}
System.out.println();
}
}
}
}
複製代碼
作者:
粘靖瑜
時間:
2012-12-15 11:52
import java.io.Console;
public class ch41
{
public static void main(String args[])
{
String name;
String tel[][]={{"大雄","0980-454666"},
{"技安","0911-338888"},
{"宜靜","0922-999579"},
{"阿福","0938-234567"},
{"小叮噹","0911-864356"}};
Console console=System.console();
System.out.println("***小米的電話簿***");
System.out.println("1.輸入'all'顯示完整電話簿\n2.輸入性名查尋目標對象的電話\n3.輸入'end'結束程式");
System.out.print("請在此輸入: ");
name=console.readLine();
if(name.equals("all")==true)
{
System.out.println("編號\t姓名\t電話");
System.out.println("==================================");
for(int i=0; i<=4; i++)
{
System.out.print((i+1)+"\t");
for(int j=0; j<=1;j++)
{
System.out.print(tel[i][j]+"\t");
}
System.out.println();
}
}
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2