C Java Tutor 客服在線

代做國外C C++ Java程序 QQ: 1067665373 Email:cjtutor@foxmail.com

« Conway’s Game of Life Formal Foundations of Programming »

Java reflection

 Victoria University of Wellington

School of Mathematics, Statistics and Computer ScienceSWEN221: Software DevelopmentLab HandoutThe purpose of this Lab is to give you hands on practice using Java reflection. Before the end of thelab, you should submit your solutions via the online submission system which will automatically markit. You may submit as many times as you like in order to improve your mark and the final deadlinewill be Friday @ 23:59. Please be aware that it is a mandatory requirement to submit 8/10labs in SWEN221.1 A Widget SystemThe program provided with this lab implements a very primitive widget system which is inspired bymodern windowing systems. In this system widgets occupy areas on the screen and can respond tomouse clicks. Widgets have internal state which they can use to control how they look. The followingillustrates a simple widget system:Here we see a very simple widget systems constructed from five widgets. The four visible squares eachconstitute one widget, whilst the background itself constitutes another widget. The two widgets onthe top row are toggles — when clicked on, they will change to either the on or off state. The twowidgets on the bottom row are counters — when clicked on, they will increment an internal counterand set their counter according to this.12 What to doThe key challenge in this lab lies in interacting with widgets through reflection. In particular, youwill be unable to see the source code for one of the widgets. This means that reflection provides theonly way in which you can interact with this widget. The Inspector provides the skeleton for a suiteof methods for creating widgets and reading/writing their attributes. Some notes:• Inspector.newWidget(String name, Rectangle dimensions). This instantiates a new in-stance of the class given by name. To do this, you will need to first find the appropriate construc-tor in the widget’s class, and then instantiate a new object using Constructor.newInstance().• Inspector.getAttribute(Widget widget, String name). This reads the value of field namein the given widget. To do this, it must call the corresponding “getter” method. For example,for a field called color the corresponding getter would be getColor().• Inspector.setAttribute(Widget widget, String name, Object value). This writes a givenvalue into field name in the given widget. To do this, it must call the corresponding “setter”method. For example, for a field named color of type Color the corresponding setter would besetColor(Color).Your goal in this lab is to complete the above methods in the Inspector class.SubmissionYour lab solution should be submitted electronically via the online submission system, linked fromthe course homepage. The required files are:swen221/lab8/core/Canvas.javaswen221/lab8/core/Inspector.javaswen221/lab8/core/Widget.javaswen221/lab8/Main.javaswen221/lab8/tests/WidgetTests.javaswen221/lab8/util/AbstractWidget.javaswen221/lab8/util/Point.javaswen221/lab8/util/Rectangle.javaswen221/lab8/views/WidgetViewer.javaswen221/lab8/widgets/Background.javaswen221/lab8/widgets/Counter.javaswen221/lab8/widgets/Toggle.javaYou must ensure your submission meets the following requirements (which are needed for theautomatic marking script):1. Your submission is packaged into a jar file, including the source code. Note, the jarfile does not need to be executable. See the following Eclipse tutorials for more on this:http://ecs.victoria.ac.nz/Support/TechNoteEclipseTutorials2. The names of all classes, methods and packages remain unchanged. That is, youmay add new classes and/or new methods and you may modify the body of existing methods.However, you may not change the name of any existing class, method or package. This is toensure the automatic marking script can test your code.23. All JUnit test files supplied for the assignment remain unchanged. Specifically, youcannot alter the way in which your code is tested as the marking script relies on this. This doesnot prohibit you from adding new tests, as you can still create additional JUnit test files. Thisis to ensure the automatic marking script can test your code.4. You have removed any debugging code that produces output, or otherwise affectsthe computation. This ensures the output seen by the automatic marking script does notinclude spurious information.Note: Failure to meet these requirements could result in your submission being reject by the submis-sion system and/or zero marks being awarded.3
  • 相關文章:





Powered By

Copyright 代寫C.


悉尼assignment代写,北美作业代写,代写毕业论文-100%原创 北美代写,Homework代写,Essay代寫-准时✔️高质✔最【靠谱】 墨尔本assignment代写,代写毕业论文,paper代写-51作业君 北美代写,程序代做,程序代写,java代写,python代写,c++代写,c代写 英国代写paper,python代写,Report代写,编程代写-程序代写网 北美代写essay,程序代写,Java代写代做,Java代考-焦点论文 澳大利亚essay代写,编程代写,代码代写,程序代写-三洋编程 加拿大essay代写|程序代写代做||Python代写|Matlab代写-Meeloun 澳大利亚代写,代写essay,代写毕业论文,留学生代写-小马代写 日本代写,北美作业代写,新加坡代写,essay代写-无时差服务