CSC72002 Object Oriented Programming

CSC72002 Object Oriented Programming - Assignment 2
Weight: 40% of your final mark
Specifications
Your task is to complete various exercises in NetBeans, using the Java language, and to submit
these via 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 Help
This assignment is to be completed individually. It is the opportunity to gain an understanding of
the concepts of object-oriented programming and coding syntax. It is important that you master
these concepts yourself. You are permitted to work from the examples in the study guide or
textbook but you must acknowledge assistance from other textbooks or classmates. In particular,

CSC72002留学生作业代做、代写Java语言作业
you must not use online 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
your program.
Please Note for all parts of the assignment:
• You cannot use the same examples that the Study guide uses. Examples taken from the
study guide 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
in the start method. Your program should make use of multiple methods, each with a
distinct function.
Part 1 – Shapes and Events
Create a new JavaFX project called usernamePart1 in NetBeans. In my case, the project would
be called rghanbarPart1.
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 shape
Part 2 – Images and Animations
Create a new JavaFX project called usernamePart2 in Netbeans. In my case, the project would
be called rghanbarPart2.
• 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
(https://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
shape as 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 green
• Demonstrate the use of the Timeline class to change the colour of the second shape every
1 second indefinitely e.g. green to yellow to green to yellow to green etc.
3
Part 3 – UI Controls and Collections
Create a new JavaFX project called usernamePart3 in NetBeans. In my case the project would
be called rghanbarPart3.
For this part of the assignment you need to build an app that stores a collection of cars for a small
car rental company (see attached class at the end of this assignment). Your app will allow the user
(company’s staff) to enter data about a car. When the user is finished, the data will be written to a
Car object and then the Car object will be added to a LinkedList. The user can then enter data for
a new car and repeat the process.
Your app will need the following UI controls that will be mapped to instance variables in the Car
class provided at the end of this document:
• Text field for the car make
• Text field for the car model
• Slider for the year (car production year e.g. 2019)
• Radio buttons for the transmission type (Automatic and Manual)
• A combo box for car’s body type (SUV, Sedan, Hatch, and Ute)
• A list view for the following four types of insurance coverage provided to the customer:
? Collision Damage Waiver (CDW)
? Supplemental Liability Protection (SLP)
? Personal Accident Insurance (PAI)
? Personal Effects Coverage (PEC)
• Check boxes for some extra options that the car might have (e.g. rear-view camera, GPS
or satellite navigation, extra airbags, extra tinting)
Once a user has entered the data for a car, your app needs to do the following:
• Write the data from the UI to a Car object (use the attached class at the end of this
assignment)
• Add the Car object to a LinkedList that will store all cars entered by the user
• Reset the UI controls so the user can enter a new car
One way to do this would be to have the following (you do not have to do it this way):
• A “New Car” button that resets the UI controls
• An “Add Car” button that creates a new instance of the car, sets the cars instance variables
(via the mutator methods) using the values from the UI controls and then adds the car to
the LinkedList
PLEASE NOTE:
• You CANNOT modify the attached Car class
4
Part 4 – Parallel Programming
Create a new Java project called usernamePart4 in NetBeans. In my case the project would be
called rghanbarPart4.
Write a program that uses 4 threads to print out 4 car makes (Toyota, Hyundai, Jeep, Audi) in the
console, in parallel, 20 times each make. NOTE: you will not receive any marks if your program
does not use threads.
• Use two different ways to create the threads: by using the Thread class, and by using the
Runnable 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 care make is
printed to the console
Use 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 and
return TRUE when 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 all
tasks in the cached thread pool have been terminated
Avoiding data corruptions
• Assume that there is a possibility of data corruption in this program (data corruption may
not happen in this program). Write the necessary code to your methods to allow only one
thread can execute the code block at one time so that data corruption is prevented. In
order to do so, use both thread Synchronisation and explicit lock object techniques
separately.
Submission
You should now have 4 NetBeans projects. You must zip the projects into one zip file called
username_A2.zip For example, mine would be rghanbar_A2.zip.
Submit this file via the Assignment 2 link on MySCU by the due date. Please leave enough time
for it to upload, so do not submit at the last minute!
5
Car Class
Use the following class for your Car in Part 3:
public class Car {
// text field
private String make;
// text field
private String model;
// slider
private Integer year;
// radio buttons
private String transmission;
// combo box
private String bodyType;
// list view
private HashSet<String> insurance = new HashSet();
// check boxes
private HashSet<String> extraOptions = new HashSet();
public Car() {
}
public String getMake() {
return make;
}
public void setMake(String make) {
this.make = make;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public String transmission() {
return transmission;
}
public void setTransmission(String transmission) {
this.transmission = transmission;
}
public String getBodyType() {
return bodyType;
}
public void setBodyType(String bodyType) {
this.bodyType = bodyType;
}
public HashSet<String> getInsurance () {
return insurance;
}
6
public void setInsurance (HashSet<String> insurance) {
this.insurance = insurance;
}
public HashSet<String> getExtraOptions () {
return extraOptions;
}
public void setExtraOptions (HashSet<String> extraOptions) {
this.extraOptions = extraOptions;
}
}

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected]

微信:codehelp

原文地址:https://www.cnblogs.com/liipython/p/11631722.html

时间: 2024-10-11 00:11:47

CSC72002 Object Oriented Programming的相关文章

Java Object Oriented Programming concepts

Introduction This tutorial will help you to understand about Java OOP'S concepts with examples. Let's discuss about what are the features of Object Oriented Programming. Writing object-oriented programs involves creating classes, creating objects fro

Object Oriented Programming python

new concepts of the object oriented programming : class encapsulation inheritance polymorphism the three features of an object are : identity, state and behaviora class is an abstraction which regroup objects who have the same attributes and the same

CSE210 Advanced Object Oriented Programming

CSE210 Advanced Object Oriented ProgrammingCoursework 2019 Release date: 11th, Mar, 2019Deadline: 12:00PM, 23rd, Apr, 2019 1. DescriptionThe objective of the coursework is to develop a practical application for data processing, analysis and content s

MQF Object Oriented Programming

MQF Object Oriented Programming I Fall 2019Hw2 Due 10/1/2019 before midnightSpecificationsRutgers parking garage management system is required to take care Rutgers University Paringneeds. The system can keep track of all the cars parked in your garag

what&#39;s the problem of Object oriented programming

The problem came from the Object itselft.It can divided into two aspect: 1.Everything is an Object: that's not true,lots of so called object is  not object ,it's just a Wrapper.You dont know what it is  ,but you just need one to let  things go on. Sa

面向对象编程Object Oriented Programming(OOP)

把对象作为程序的基本单元,一个对象包含了数据和操作数据的函数. 面向过程的程序设计把计算机程序视为一系列的命令集合,即一组函数的顺序执行.为了简化程序设计,面向过程把函数继续切分为子函数,即把大块函数通过切割成小块函数来降低系统的复杂度. 面向过程的程序设计把计算机程序视为一系列的命令集合,即一组函数的顺序执行.为了简化程序设计,面向过程把函数继续切分为子函数,即把大块函数通过切割成小块函数来降低系统的复杂度. 一:封装(类内的事) 假设我们要处理学生的成绩表,为了表示一个学生的成绩,面向过程的

opp(Object Oriented Programming)

嗯,昨天忙了一天没来及发,过年啊,打扫啊,什么搽窗户啊,拖地啊,整理柜子啊,什么乱七八糟的都有,就是一个字,忙. 好了,废话也不多说,把自己学到的放上来吧.嗯,说什么好呢,就说原型链啊 原型对象 每个javascript对象都有一个原型对象,这个对象在不同的解释器下的实现不同.比如在firefox下,每个对象都有一个隐藏的__proto__属性,这个属性就是"原型对象"的引用. 原型链 由于原型对象本身也是对象,根据上边的定义,它也有自己的原型,而它自己的原型对象又可以有自己的原型,这

[email&#160;protected] [355] Design Twitter (Object Oriented Programming)

https://leetcode.com/problems/design-twitter/ Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent tweets in the user's news feed. Your design should support the follow

object oriented programming : class application

class Thread_Sync; class Critical; class Info; class Info{Info(std::string str):m_info(str){} private: std::string m_info;}; // a process need: { pre-run();run();post-run();mutex for threads, running previlledge} #define APPL_DECLARE_APP( YourAppClas