” 写作CSC72002程序、Java编程调试CSC72002 Object Oriented Programming – Assignment 2Weight: 40% of your final markDue: 30 September 2020, 11:00 pmSpecificationsYour task is to complete various exercises in NetBeans, using the Java language, and to submit thesevia the MySCU link created for this purpose.Marking criteria includes: Use of correct coding style, including the use of comments; Accuracy of coding; Use of suitable coding structures; Correct submission and Naming conventions of assessment items as required.Getting HelpThis assignment is to be completed individually. It is the opportunity to gain an understanding of theconcepts of object-oriented programming and coding syntax. It is important that you master theseconcepts yourself. You are permitted to work from the examples in the study guide or textbook, butyou must acknowledge assistance from other textbooks or classmates. In particular, you must not useonline material or help from others, as this would prevent you from mastering these concepts.Who can you get help from? Use this diagram to determine from whom you may seek help with yourprogram.EncouragedAttribution RequiredAsk tutorNot acceptable2 | P a g ePlease Note for all parts of the assignment: You cannot use the same examples that the Study Guide uses. Examples taken from the studyguide will result in no marks and may count as plagiarism. Marks will be given for high cohesion. This means that you should not have all your code inthe start method. Your program should make use of multiple methods, each with a distinctfunction.Part 1 Shapes and EventsCreate a new JavaFX project called usernamePart1 in NetBeans. In my case, the project would becalled pdarcyPart1.Using a GridPane: Add at least 4 different shapes to your app (Every shape must have at least 1 event) Demonstrate the use of at least 4 different Mouse events Demonstrate the use of at least 2 different Key events Demonstrate the use of at least 1 inner class Demonstrate the use of at least 1 anonymous inner class Demonstrate the use of at least 1 lambda expression Demonstrate the use of setHgap, setVgap, setHalignment and setValignment Ideally, you should have a method for each shapePart 2 Images and AnimationsCreate a new JavaFX project called usernamePart2 in Netbeans. In my case, the project would becalled pdarcyPart2. Add an image as The background for your app using an ImageView object Demonstrate the use of at least 3 methods of ImageView, e.g. setFitHeight( httpss://docs.oracle.com/javase/8/javafx/api/javafx/scene/image/ImageView.html) Add a Polygon with at least 8 sides Demonstrate the use of the PathTransition class using the polygon as the path and any shapeas the node Demonstrate the use of the FadeTransition class to fade the polygon in and out Add a Second shape (can be any shape) and set the fill to red Demonstrate the use of the Timeline class to change the colour of the second shape every 2seconds indefinitely, e.g. red to blue to red to blue to red etc.Part 3 UI Controls and CollectionsCreate a new JavaFX project called usernamePart3 in NetBeans. In my case, the project would becalled pdarcyPart3.For this part of the assignment, you need to build an app that stores a collection of Sculptures for asmall exhibition (see the attached class at the end of this assignment). Your app will allow the user(exhibitions staff) to enter data about a sculpture. When the user is finished, the data will be writtento a Sculpture object, and then the Sculpture object will be added to a LinkedList. The user can thenenter data for a new sculpture and repeat the process.2 | P a g eYour app will need the following UI controls that will be mapped to instance variables in theSculpture class provided at the end of this document: Text field for the sculpture title Text field for the sculpture artist Slider for the year created (sculpture creation year, e.g. 2020) Radio buttons for the sculpture height (tall (over 5m), medium (shorter than 5m, taller than1m) and short (under 1m)) A combo box for sculptures weight (Very Heavy, Heavy, Medium, Light, Very Light, etc.) A list view For the following four countries of origin of sculptures:o Italyo Franceo Chinao United Kingdom CheckBoxes for the material(s) that the sculpture might have (e.g. Stone, Metal, Glass,Pottery, Wood Carving, Other, etc.)Once a user has entered the data for a sculpture, your app needs to do the following: Write the data from the UI to a Sculpture object (use the attached class at the end of thisassignment) Add the Sculpture object to a LinkedList that will store all sculptures entered by the user Reset the UI controls so the user can enter a new sculptureOne way To do this would be to have the following (you do not have to do it this way): A New Sculpture button that resets the UI controls An Add Sculpture button that creates a new instance of the sculpture, sets the Sculpturesinstance variables (via the mutator methods) using the values from the UI controls and thenadds the sculpture to the LinkedListPLEASE NOTE: You CANNOT modify the attached Sculpture classPart 4 Parallel ProgrammingCreate a new Java project called usernamePart4 in NetBeans. In my case, the project would becalled pdarcyPart4.Write a program that uses 4 threads to print out 4 sculpture titles (Donatellos EquestrianMonument of Gattamelata, The Terracotta Army, Michelangelos David, Maman) in the console, inparallel, 20 times each author. NOTE: you will not receive any marks if your program does not usethreads. Use two different ways to create the threads: by using the Thread class, and by using theRunnable interface Set different priority to each thread (maximum, normal, minimum) Write the code to put the threads to sleep for 100 milliseconds each time a sculpture artist isprinted to the Console2 | P a g eUse of thread pools: Create a fixed thread pool that returns a thread pool with a maximum of 3 threads Write the code to shut down the fixed thread pool after current tasks are complete andreturn TRUE when the shutdown is complete Create a cached thread pool that returns a thread pool that creates new threads as required Write the code to shut down the cached thread pool immediately and return TRUE if alltasks in the cached thread pool have been terminatedAvoiding data corruptions Assume that there is a possibility of data corruption in this program (data corruption maynot happen in this program). Write the necessary code to your methods to allow only onethread can execute the code block at one time so that data corruption is prevented. In orderto do so, use both thread Synchronisation and explicit lock object techniques separately.SubmissionYou should Now have four (4) NetBeans projects. You must zip the projects into one zip file calledusername_A2.zip. For example; mine would be pdarcy_A2.zip.Submit this file via the Assignment 2 link on MySCU by the due date. Please leave enough time for itto upload, so do not submit at the last minute!2 | P a g eBook ClassUse the following class for your Sculpture in Part 3:public class Sculpture {// text fieldprivate String title;// text fieldprivate String artist;// sliderprivate Integer yearCreated;// radio fieldprivate String height;// combo boxprivate String weight;// list viewprivate HashSetString countryOfOrigin = new HashSet();// check boxesprivate HashSetString material = new HashSet();public Sculpture() {}public String getTitle() {return title;}public Void setTitle(String title) {this.title = title;}public String getArtist() {return artist;}public void setArtist(String artist) {this.artist = artist;}public Integer getYearCreated() {return yearCreated;}public void setYearCreated(Integer yearCreated) {this.yearCreated = yearCreated;}public String getHeight() {return height;}public void setHeight(String height) {this.Height = height;}2 | P a g epublic String getWeight() {return weight;}public void setWeight(String weight) {this.weight = weight;}public HashSetString getCountryOfOrigin() {return countryOfOrigin;}public void setCountryOfOrigin (HashSetString countryOfOrigin) {this.countryOfOrigin = countryOfOrigin;}public HashSetString getMaterial () {return Material;}public void setMaterial (HashSetString material) {this.Material = material;}}如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。