Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

RMIT Classification: Trusted

COSC1295/COSC2391
Advanced Programming/
Further Programming

School of Computing Technologies


STEM College
RMIT University
RMIT Classification: Trusted

Staff Contact Details


• Lecturer: Estrid He
– Email: estrid.he@rmit.edu.au

• Note: lab tutors do not provide support outside


contact hours (i.e., timetabled classes).
– Dipto Pratyaksa
– Vu Huy Mai
– Khang Vo

• Please post any queries on Canvas Discussion


Board.

2
RMIT Classification: Trusted

Class Times
Lectorials (week 1 – 12)

• Monday Lectorial 18:30 – 19:30, online via Microsoft


Teams
• Tuesday Lectorial 14:30 – 15:30, on campus: 008.11.068
• Friday Lectorial 11:30 – 12:30, campus: 008.11.068

3
RMIT Classification: Trusted

Class Times (cont.)


Practical labs (week 2 – 12)

Further Programming
• Monday Prac 14:30 – 16:30, online via Microsoft Teams
• Wednesday Prac 8:30 – 10:30, on campus 010.08.026
• Wednesday Prac 10:30 – 12:30, on campus 010.08.026
• Wednesday Prac 14:30 – 16:30, online via Microsoft Teams
• Thursday Prac 10:30 – 12:30, on campus 056.04.086-089

Advanced Programming
• Monday Prac 19:30 – 21:30, online via Microsoft Teams
• Tuesday Prac 10:30 – 12:30, on campus 014.11.037
• Wednesday Prac 16:30 – 18:30, on campus 010.08.026

4
RMIT Classification: Trusted

Queries
• Consultation
– For everyone: Tuesday 13:30 – 14:30 every
teaching week
– One-to-one: book via emails
• Please post your questions in the discussion
forum in Canvas
– Response is expected within 48 hours

5
RMIT Classification: Trusted

Course Objectives
• Prior Java programming experience is assumed
• Solve Complex problems
• Data Structures & Generics
• Object-oriented Concepts and Functional Programming
• Graphical User Interfaces and Event Handling via JavaFX
• Connect to Databases via JDBC
• Test your code with JUnit
• Introduce you to Design Patterns used in Industry

6
RMIT Classification: Trusted

Resources
• Recommended references:
– Y. Daniel Liang, Introduction To Java Programming and Data
Structures, 11th edition
– Yakov Fain, Java Programming: 24-Hour Trainer

• Canvas
– Weekly lecture notes and recordings (pre-class activities)
– Weekly lectorial notes
– Weekly practical lab materials

• Please use your teaching staff for help if you need it


– Your lab tutors are there to help, 2 hour labs each week
– Post questions to Discussion Board on Canvas

7
RMIT Classification: Trusted

Assessment
• Assignment 1 – 20%
– Smaller assignment designed to practice and demonstrate
developing a smaller Java program
• Assignment 2 – 45%
– Larger programming assignment, including OO Concepts, JCF,
JDBC (database connectivity), and a Graphical User Interface,
unit testing via the JUnit framework
• Multiple milestone submissions – 10%
– Submissions of code, in-lab demos/recorded presentations
explaining and executing the code, final interview
• Regular coding exercises during lectorials – 25%
– Week 5, 9, 12

8
RMIT Classification: Trusted

Plagiarism is an Offence
Plagiarism:
• 1. Submitting an assignment that contains other people’s work.
• 2. Helping other students to plagiarise.
To avoid plagiarism, you must give credit whenever you use
• another person’s idea, opinion, or theory;
• any facts, statistics, graphs, drawings - any pieces of information - that are
not common knowledge;
• quotations of another person’s actual spoken or written words; or
• paraphrase of another person’s spoken or written words.

ALL SUBMITTED WORK MUST BE YOUR OWN

NOTE: we will be performing plagiarism checks on ALL submitted work.


PLEASE DO NOT plagiarise other peoples’ work, PLEASE DO NOT
co-develop solutions to assignments

9
RMIT Classification: Trusted

Syllabus

10
RMIT Classification: Trusted

Syllabus (cont.)

11
RMIT Classification: Trusted

Using the Java & Docs v8


• JDK can be downloaded from the Oracle site:
https://www.oracle.com/au/java/technologies/j
avase/javase-jdk8-downloads.html
• All the classes available and their method
details can be viewed easily using the Java
Docs.

12
RMIT Classification: Trusted

JDK vs JRE vs JVM

https://www.ibm.com/cloud/blog/jvm-vs-jre-vs-jdk

13
RMIT Classification: Trusted

IDEs
• You may use
– Eclipse (highly recommended)
– IntelliJ by JetBrains
– Microsoft’s Visual Studio Code
– NetBeans
• Eclipse IDE is available in scheduled RMIT
computer labs.

14
RMIT Classification: Trusted

Review Question 1
• What is the relationship between a class and an
object?
A class is a template or blueprint used in creating the
instances
An object is an instance of the class

15
RMIT Classification: Trusted

Review Question 2
• How long does the data stored in an object
persist? How is it different from local variables?

Data stored in an object persists as long as the object


persists
Local variables persist until the end of their scope (e.g.,
method, if statement)

16
RMIT Classification: Trusted

Review Question 3
• What method is invoked for initialising the
data in an object?
Constructor method
Setter method if defined
public Account(String accountID, String accountName, double amount)
{
accID = accountID;
name = accountName;
balance = amount;
}

17
RMIT Classification: Trusted

Review Question 4
Constructor can return a value.
• True
• False

18
RMIT Classification: Trusted

Review Question 5
• How is an object accessed? Using reference variables

mum Account
dad Account

accID=“s123” accID=“g234”
name=“Mercy Brown” name= “David Brown”
balance=1000.0 balance=2000.0

mum = dad;

mum dad
Account Account

accID=“s123” accID=“g234”
name=“Mercy Brown” name= “David Brown”
balance=1000.0 balance=2000.0
19
RMIT Classification: Trusted

Review Question 6
• How do you decide what functionality should
be implemented in the superclass and what can
be left for the subclass to define later on?
Functionality common to all subclasses should
be placed in the superclass

20
RMIT Classification: Trusted

Review Question 7
• How do you refer to functionality defined in
the superclass from within the subclass?

You need super.method() if the method is


overridden in the subclass; otherwise, use
method() if public

21
RMIT Classification: Trusted

Review Question 8
A method defined in a superclass is redefined in a
subclass with an identical method signature. This is
called ___________.
• Method overloading
• Method overriding

22
RMIT Classification: Trusted

Review Question 9
• What does the term polymorphism refer to?

Polymorphism means that a variable of a super


class type can refer to an object of a subclass
type; the actual method invoked depends on the
object it is acting upon

SAccount
Account reference
account1

CAccount

23
RMIT Classification: Trusted

Review Question 10
Will the program below result in error during
compilation?
class A {
public void method1() {}
}

class B extends A {}

public class Test {


public static void main(String args[]) {
A a = new B();
B b = a;
}
}

Yes. It should be: B b = (B) a;


An explicit typecast is required to assign a
24
superclass reference to subclass.
RMIT Classification: Trusted

Review Question 11
Which of the statements in the main method below will
result in error during compilation?
class A {
public void method1() {}
}
class B extends A {
public void method2() {}
}
public class Test {
public static void main(String args[]) {
B b = new B();
A a = b;
a.method1();
a.method2();
}
}
The statement resulting in error: a.method2();
Only methods of the superclass can be called through this reference. 25
RMIT Classification: Trusted

Review Question 12
What will be the output of the program below?
class A {
public void method1() {
System.out.print("A.method1");
}
}
class B extends A {
public void method1() {
System.out.print("B.method1");
}
}
public class Test {
public static void main(String args[]) {
B b = new B();
A a = b;
a.method1();
}
}

The output will be: B.method1


Method invoked is based on the object it is acting upon 26
RMIT Classification: Trusted

Recap
• Course introduction
• Review of OO programming concepts
• Questions?

27

You might also like