JCreator的问题~~~~(300分)

  • 主题发起人 主题发起人 Cross Tops
  • 开始时间 开始时间
C

Cross Tops

Unregistered / Unconfirmed
GUEST, unregistred user!
谁能帮5把这个程序简化一下,要求用int myArray[]=new int[y]语句,谢了。急急急~~~~~
class NewMathtable{
public static void main(String[]args)
{
int x,y;
char z;
x=gettable();
y=getline();
z=getoperator();
int result;
Screen.message(" The table is :");
Screen.newline();
int myarray[]=new int[y];

for(int i=1;i<=myarray.length;i++)
{

Screen.writeint(x,2);
Screen.writechar(z,2);
Screen.writeint(i,2);
Screen.message(" = ");
Screen.writeint(claculate (x,i,z),2);
Screen.newline();
//}while(i>y);
}
}
public static int gettable()
{ //procedure1
int table;
do
{
Screen.message(" Enter Table: ");
table=Keyboard.readInt();

}while(table<1||table>12);
return table;
//return to x
}

public static int getline()
{ //procedure2
int line;
do
{
Screen.message(" Enter lines: ");
line=Keyboard.readInt();
}while(line<1||line>20);
return line;
//return to y
}

public static char getoperator()
{ //procedure3
char operator;
do
{
Screen.message(" Enter operator: ");
operator=Keyboard.readChar();
}while(operator!='*'&amp;&amp;operator!='/'&amp;&amp;operator!='+'&amp;&amp;operator!='-');//only *,/,+,-allowed
return operator;
//return to z
}
public static int claculate (int x,int y,char z)
{
int myarray[]=new int[y];
int result=0;
for(int i=1;i<=myarray.length;i++)
{

if(z=='*')
{
result=x*i;
}
if(z=='+')
{
result=x+i;
}
if(z=='/')
{
result=x/i;
}
if(z=='-')
{
result=x-i;
}
}
return result;
}
}
多谢~~多谢~~~呵呵~~~
 
不懂,帮你提前
 
甲春~~~~5忍了~~
你有朋友懂JCreater吗?
 
你想做什么呢?看别人程序很累的![?]
 
做一个数学表格,要求输入因数,倍数和运算符号后,程序自动算出结果并显示出来。输入倍数要有像下面这样
假如输入因数为6,倍数为5,运算符号为+,结果显示为:
6+1=7
6+2=8
6+3=9
6+4=10
6+5=11
请帮忙简化一下,谢了。
 
程序也太长了点,有时间慢慢研究吧
 
老兄,你这是什么问题??
JCreator?IDE和这个程序有什么关系?
另外,java里哪来的Screen和Keyboard?!
 
多人接受答案了。
 
后退
顶部