我真的不会做!没时间了!要在4月22号前完成阿! 跪求有能力人士帮忙下!这是我的其中一道作业!!谢谢大家了!!!!拜托,拜托!!请帮忙解答案,请把答案付上!多谢!
要写3个文件 Point.java, Rectangle.java, TheOrder.java ( TheOrderTest.java)已给以给程序~
public class TheOrderTest {
public static void main( String [ ] args ) {
TheOrder myWindows = new TheOrder();
Point[] testPoints = new Point[ 3 ];
testPoints[0] = new Point( 2, 2 );
testPoints[1] = new Point( 3, 5 );
testPoints[2] = new Point( 5, 7 ); Rectangle[] testRects = new Rectangle[ 3 ];
testRects[ 0 ] = new Rectangle( testPoints[0], 6, 8 );
testRects[ 1 ] = new Rectangle( testPoints[1], 6, 8 );
testRects[ 2 ] = new Rectangle( testPoints[2], 6, 8 );
for( int i = 0; i< testRects.length; i++ ) {
myWindows.addWindow( testRects[i] );
}
System.out.println( "Original order of windows:" );
System.out.println( myWindows );
Point p1 = new Point( 4, 4 );
myWindows.click( p1 );
System.out.println( "After clicking point " + p1 + ":" );
System.out.println( myWindows );
myWindows.click( p1 );
System.out.println( "After AGAIN clicking point " + p1 + ":" );
System.out.println( myWindows );
Point p2 = new Point( 10, 10 );
myWindows.click( p2 );
System.out.println( "After clicking point " + p2 + ":" );
System.out.println( myWindows );
}
}这是Output from "crude test" for TheOrder
(原始窗)Original order of windows:"<(2,2),6,8>,<(3,5),6,8>,<(5,7),6,8>"(经过点击点)After clicking point (4,4):"<(3,5),6,8>,<(5,7),6,8>,<(2,2),6,8>"(在次点击)After AGAIN clicking point (4,4):"<(3,5),6,8>,<(5,7),6,8>,<(2,2),6,8>"(经过点击点)After clicking point (10,10):"<(3,5),6,8>,<(2,2),6,8>,<(5,7),6,8>""<(3,5),6,8>,<(2,2),6,8>,<(5,7),6,8>,<(7,1),20,12>""<(3,5),6,8>,<(2,2),6,8>,<(5,7),6,8>,<(7,1),20,12>"
Java长方形图形重叠,重叠的矩形二维窗口区域,在列表中的矩形命令意味着它们的顺序将显示在屏幕上从0(有时被称为“Z -顺序“)上的底部,大小() -在顶部1。详情:
写class named TheOrder, 长方形(x,y)长,宽。(x,y)的位置
class named Rectangle 应该是一个point(点),如下所述。
The class name Point 要有implement the Point class在个功课中。
您的矩形列表类,TheOrder,将保持一个矩形的ArrayList来实现的可能重叠的矩形二维窗口地区的样板。您的矩形列表类,TheOrder,应该有一个方法,它作为一个参数一个点,就像对待用户点击它的点在屏幕上,并移动最上面的矩形感人指向列表的前面,留下的顺序对其余的名单不变。要写命名TheOrderTest来测试你的代码的类。这个类只包含主要方法,实例化一个类型TheOrder对象,初始化它,并测试它。尽可能完成这项测试。请记住,我们使用TheOrder代表的z屏幕的显示顺序。
要写3个文件 Point.java, Rectangle.java, TheOrder.java ( TheOrderTest.java)已给以给程序~
public class TheOrderTest {
public static void main( String [ ] args ) {
TheOrder myWindows = new TheOrder();
Point[] testPoints = new Point[ 3 ];
testPoints[0] = new Point( 2, 2 );
testPoints[1] = new Point( 3, 5 );
testPoints[2] = new Point( 5, 7 ); Rectangle[] testRects = new Rectangle[ 3 ];
testRects[ 0 ] = new Rectangle( testPoints[0], 6, 8 );
testRects[ 1 ] = new Rectangle( testPoints[1], 6, 8 );
testRects[ 2 ] = new Rectangle( testPoints[2], 6, 8 );
for( int i = 0; i< testRects.length; i++ ) {
myWindows.addWindow( testRects[i] );
}
System.out.println( "Original order of windows:" );
System.out.println( myWindows );
Point p1 = new Point( 4, 4 );
myWindows.click( p1 );
System.out.println( "After clicking point " + p1 + ":" );
System.out.println( myWindows );
myWindows.click( p1 );
System.out.println( "After AGAIN clicking point " + p1 + ":" );
System.out.println( myWindows );
Point p2 = new Point( 10, 10 );
myWindows.click( p2 );
System.out.println( "After clicking point " + p2 + ":" );
System.out.println( myWindows );
}
}这是Output from "crude test" for TheOrder
(原始窗)Original order of windows:"<(2,2),6,8>,<(3,5),6,8>,<(5,7),6,8>"(经过点击点)After clicking point (4,4):"<(3,5),6,8>,<(5,7),6,8>,<(2,2),6,8>"(在次点击)After AGAIN clicking point (4,4):"<(3,5),6,8>,<(5,7),6,8>,<(2,2),6,8>"(经过点击点)After clicking point (10,10):"<(3,5),6,8>,<(2,2),6,8>,<(5,7),6,8>""<(3,5),6,8>,<(2,2),6,8>,<(5,7),6,8>,<(7,1),20,12>""<(3,5),6,8>,<(2,2),6,8>,<(5,7),6,8>,<(7,1),20,12>"
Java长方形图形重叠,重叠的矩形二维窗口区域,在列表中的矩形命令意味着它们的顺序将显示在屏幕上从0(有时被称为“Z -顺序“)上的底部,大小() -在顶部1。详情:
写class named TheOrder, 长方形(x,y)长,宽。(x,y)的位置
class named Rectangle 应该是一个point(点),如下所述。
The class name Point 要有implement the Point class在个功课中。
您的矩形列表类,TheOrder,将保持一个矩形的ArrayList来实现的可能重叠的矩形二维窗口地区的样板。您的矩形列表类,TheOrder,应该有一个方法,它作为一个参数一个点,就像对待用户点击它的点在屏幕上,并移动最上面的矩形感人指向列表的前面,留下的顺序对其余的名单不变。要写命名TheOrderTest来测试你的代码的类。这个类只包含主要方法,实例化一个类型TheOrder对象,初始化它,并测试它。尽可能完成这项测试。请记住,我们使用TheOrder代表的z屏幕的显示顺序。
解决方案 »
- java.lang.Process stdin stdout stderr
- NIO中的SelectableChannel能否双向读写?高手们帮忙呀,在线等!
- skycncomp(早知道今日的离别,你还愿意昨日的相逢吗),不如来这里领分?
- 用final定义方法参数的问题
- 如何求得 基本变量 对象 对象数组的地址?
- 编译出的错
- 对短消息编程感兴趣吗,请看hnjsbyl.nease.net
- [共享]通用对象是否相等的比较
- 用jbuild里,如何将struts架构相关的包包含进jbuild的工程里呀
- 关于.class文件
- 请教同步时分复用、异步时分复用与分组交换的本质区别
- 用BufferedWriter往文件里写字符串提示这个?
hehehe~~~
yes!sir!! =)
I am gonna to cancel this post~
let me know if you have time and want to help!
I am gonna to post my information to you if you can help! then, after that, I will give you 100 point! promise!!! I don't know how long you will take! but for me! suppost to spend half day!!!
Still Enlgish! Assignment
TCSS 143 Spring 2011, Chapter 11 Programming Project 4.1, due 25 April
Main Idea:
Write a public static method contains4 that accepts a List of strings as a parameter and returns true if any single string occurs at least 4 times in the list, and false otherwise. Use a map as auxiliary storage.Starter code (Code he give to us)
import java.util.*;public class ProgAssign4 { public static void main(String[] args) {
String[] testData = { "Hop", "on", "Pop",
"Hop", "on", "Pop",
"Hop", "on", "Pop",
"on" };
List<String> theList = new ArrayList<String>();
for( int i = 0; i < testData.length; i++ ) {
theList.add( testData[ i ] );
}
System.out.println( "The list:" );
System.out.println( theList );
System.out.print( "does" );
if( !contains4( theList ) ) {
System.out.print( " not" );
}
System.out.println( " contain at least 4 occurences of one value." );
}
// Your code goes here.
}
public class ProgAssign4 { public static void main(String[] args) { String[] testData = { "Hop", "on", "Pop", "Hop", "on", "Pop", "Hop",
"on", "Pop", "on" }; List<String> theList = new ArrayList<String>();
for (int i = 0; i < testData.length; i++) {
theList.add(testData[i]);
} System.out.println("The list:");
System.out.println(theList);
System.out.print("does");
if (!contains4(theList)) {
System.out.print(" not");
}
System.out.println(" contain at least 4 occurences of one value.");
} // Your code goes here.
public static boolean contains4(List<String> strList) {
if (strList == null || strList.size() == 0) {
return false;
} HashMap<String, Integer> hm = new HashMap<String, Integer>();
for (Iterator<String> it = strList.iterator(); it.hasNext();) {
String key = it.next();
if (!hm.containsKey(key)) {
hm.put(key, new Integer(1));
} else {
Integer count = hm.get(key);
Integer newCount = new Integer(count.intValue() + 1);
// In fact, we need't count all works, if we find any one
// appear the forth time, then return true
if (newCount.intValue() >= 4) {
System.out.println();
System.out.println("The list contains the word: \"" + key
+ "\" at least 4 times :) ");
return true;
}
hm.put(key, newCount);
}
} return false;
}
}
OK, little girl~~
Oh, I can't help calling you "little girl".
This is very simple. I'm sure you can manage it if you like.Maybe, you can have a try, solve this problem by your self.Ahh, do you mind tell me your QQ number?
yeah! I am gonna to send you my QQ number in your e-mail!
I don't want to post it in here!!! so public!
ah ha....
bad egg.........
Come on~~
I did nothing~~
How can you describe a gentleman like that~~?
I'm crying...