Topic: 大虾们帮帮忙 这道题怎么做啊? |
Print this page |
1.大虾们帮帮忙 这道题怎么做啊? | Copy to clipboard |
Posted by: lushan1202 Posted on: 2005-02-09 23:26 Write a program that prompts the user to input a number between 1 and 36 from keyboard. Restrictions: • If the number is less than or equal to 10, then output the number; • If the number is bigger than 10, then output A for 11, B for 12, C for 13, …, Y for 35, Z for 36. 学这个的时候的作业 int anInterger = 17 String a String = String.valueOf( an Interger ); 个人不是很理解这段东西讲了什么 |
2.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: BarryWhite Posted on: 2005-02-10 15:20 36 进制! |
3.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: lushan1202 Posted on: 2005-02-11 02:17 ?? 36 进制是什么意思? 到底写出来的程序应该是什么样子的阿?? |
4.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: 孤独王子 Posted on: 2005-02-11 16:55 不时36近制 import java.io.*; public class testjava { String s1; BufferedReader in; int number_mql; public void pp() { System.out.println("please input a number between 1 and 36 and end with Enter"); try{ in=new BufferedReader(new InputStreamReader(System.in)); s1=in.readLine(); number_mql=Integer.parseInt(s1); switch(number_mql){ case 1:System.out.println("1");break; case 2:System.out.println("2");break; case 3:System.out.println("3");break; case 4:System.out.println("4");break; case 5:System.out.println("5");break; case 6:System.out.println("6");break; case 7:System.out.println("7");break; case 8:System.out.println("8");break; case 9:System.out.println("9");break; case 10:System.out.println("10");break; case 11:System.out.println("A");break; case 12:System.out.println("B");break; case 13:System.out.println("C");break; case 14:System.out.println("D");break; case 15:System.out.println("E");break; case 16:System.out.println("F");break; case 17:System.out.println("G");break; case 18:System.out.println("H");break; case 19:System.out.println("I");break; case 20:System.out.println("J");break; case 21:System.out.println("K");break; case 22:System.out.println("L");break; case 23:System.out.println("M");break; case 24:System.out.println("N");break; case 25:System.out.println("O");break; case 26:System.out.println("P");break; case 27:System.out.println("Q");break; case 28:System.out.println("R");break; case 29:System.out.println("S");break; case 30:System.out.println("T");break; case 31:System.out.println("U");break; case 32:System.out.println("V");break; case 33:System.out.println("W");break; case 34:System.out.println("X");break; case 35:System.out.println("Y");break; case 36:System.out.println("Z");break; default:System.out.println("please input a number between 1 and 36"); } }catch(NumberFormatException ee){ System.out.println("please input an number next time and this project will end!"); }catch(Exception e){ e.printStackTrace(); } } public static void main(String mql[]) { testjava tt=new testjava(); tt.pp(); } } |
5.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: lushan1202 Posted on: 2005-02-11 17:14 和我写的这个 异曲同工也…… import java.io.* ; public class CSI1100 { public static void main (String[] args) throws IOException { int i; System.out.println("CSI1100B Winter 2005, Assignment 4, Question 3"); System.out.println("Name: Lu Shan, Student# 3887235"); System.out.println("Lab section Thursday ,TA :Aminul Islam"); System.out.println("Enter an integers between 1 and 36:"); i=System.in.read(); if (i<11) System.out.println; else if (i==11) System.out.println("A"); else if (i==12) System.out.println("B"); else if (i==13) System.out.println("C"); else if (i==14) System.out.println("D"); else if (i==15) System.out.println("E"); else if (i==16) System.out.println("F"); else if (i==17) System.out.println("G"); else if (i==18) System.out.println("H"); else if (i==19) System.out.println("I"); else if (i==20) System.out.println("J"); else if (i==21) System.out.println("K"); else if (i==22) System.out.println("L"); else if (i==23) System.out.println("M"); else if (i==24) System.out.println("N"); else if (i==25) System.out.println("O"); else if (i==26) System.out.println("P"); else if (i==27) System.out.println("Q"); else if (i==28) System.out.println("R"); else if (i==29) System.out.println("S"); else if (i==30) System.out.println("T"); else if (i==31) System.out.println("U"); else if (i==32) System.out.println("V"); else if (i==33) System.out.println("W"); else if (i==34) System.out.println("X"); else if (i==35) System.out.println("Y"); else System.out.println("Z"); } } |
6.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: lushan1202 Posted on: 2005-02-12 01:13 就是我的比较复杂 哈 |
7.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: 孤独王子 Posted on: 2005-02-12 15:37 你的不是复杂,是根本部队 按照你写的方法 打什么都是z 其实不用复杂的switch判断,可以利用ACSII码来排列的 那样更简单 |
8.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: lushan1202 Posted on: 2005-02-12 18:10 else if 不也是像switch一样的一个一个case的选择吗? |
9.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: 孤独王子 Posted on: 2005-02-12 21:50 编码方式不合格,加上括号看看自己能看出来不 |
10.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: lushan1202 Posted on: 2005-02-13 11:37 看不出 那比如我输入12的时候 系统会执行哪些运算? |
11.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: 孤独王子 Posted on: 2005-02-14 12:20 System.in.read() 读入的是char啊啊啊啊啊啊啊啊啊 返回的就是对应的键直的ACSII马 |
12.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: 鸡肋男 Posted on: 2005-02-16 11:57 老兄们,哪有这样死写的,如果让你写1到36000怎么办,还这样写?大概你们公司的软件开发费用是根据代码行数来计算的吧。 |
13.Re:大虾们帮帮忙 这道题怎么做啊? [Re: lushan1202] | Copy to clipboard |
Posted by: 孤独王子 Posted on: 2005-02-16 12:20 老兄,您若是批评我们,我全部接受 不过请再批评之余给我们一个榜样ok? |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |