Object Oriented Programming — COIT11134

 Instruction Sheet

  1. Write your answers clearly. Use numbered headings or subheadings to show which part of your answer refers to which question. Example: Part A – Question 2.
  • Write your answers from page 10 of this document. Please do not modify this document’s content from page 1 to 9.

Page 1 of 9

PART A                                                                                              10 MARKS

COMPULSORY QUESTIONS

Answer ALL questions from this part.

Each question is worth 2.0 marks (5 x 2 = 10 marks).

Briefly comment on the following statements from Java language point of view. For each question, limit your answers to three to four sentences only.

Question 1                                                                                                              2 Marks

Differentiate Instance variables from static variables.

Question 2                                                                                                              2 Marks

Java Interface can have instance fields and default method implementations.

 

Question 3                                                                                                              2 Marks

In Java, a sub class can implement only one interface and can be extended from multiple superclasses.

Question 4                                                                                                              2 Marks

How can you remove two adjacent elements from the collection that an Iterator is referring to?

Question 5                                                                                                              2 Marks

Java abstract class can contain implemented and abstract methods.

 

PART B                                                                                             35 MARKS

Answer all questions from this part.

Question 1                                                                                             3 Marks

The following class Loan has incomplete codes. Complete the missing lines of code for the given parameterized constructor, isToMonitor() method, and an overridden toString() method.

Hint:

If the loan amount exceeds $500,000 then isToMonitor() method has to return true; otherwise it should return false.

 

toString() method should display the Loan details and based on isToMonitor() method’s return value whether the Loan needs monitoring or not.

import java.time.*; public class Loan

{

private double loanAmount; private LocalDate startDate;

private double interestRate;

private static final double LIMIT = 500000.0;

/**@param givenLoanAmount the loan amount

  • @param year the year of startDate
  • @param month the month of startDate
  • @param day the day of startDate

*/

public Loan ( double givenLoanAmount, int year, int month, int day, double givenInterestRate)

{

//Missing lines of code need to be completed by the student

}

/* If the loan amount exceeds $500,000 then isToMonitor()

method has to return true; otherwise it should return false.*/

public boolean isToMonitor()

{

//Missing lines of code need to be completed by the student

}

/* toString() method should display the Loan details and based on isToMonitor() method’s return value whether the Loan needs monitoring or not. */

@Override

public String toString()

{

//Missing lines of code need to be completed by the student

}

}//end class definition

Question 2            3 Marks

How can you create a unique LoanId for each object of Loan (as mentioned in the above Question 1)? Modify the Loan class given in the above Question 1, and create new class named ModifiedLoan, so that each object of ModifiedLoan will have a unique LoanId.

Question 3            3 Marks

Write a driver class to test the ModifiedLoan class that you have created in Question-2).  The driver should do the following:

  1. create two ModifiedLoan objects; one with the loan amount less than $500000 and the other with the loan amount more than $500000.
  2. print the details of the ModifiedLoan objects on the screen.
Question 4                                                                                                              3 Marks

The following UML class diagram shows that GSTItem class is a subclass of Expense class.

The following table provides the characteristics of the fields that are used in the above two classes.

Field nameClassAccess specifierData type
NameExpenseprivateString
AmountExpenseprivatedouble
GSTIncludedExpenseprivateboolean
GSTAmountGSTItemprivatedouble

You need to write (define) the above mentioned two Java classes. Your classes should have appropriate fields/variables, constructors and overridden toString() methods.

Question 5                                                                                                              3 Marks

Write (define) an interface called as GSTApplicable. The GSTApplicable interface should have a constant and a method declared with the specification as mentioned in the following table:

Field/method nameDescription
percentageOfGSTA constant with the value of 10
calculateGSTA public method that receives no parameters and returns a double

 

Question 6                                                                                                              3 Marks

Modify the GSTItem class you have created as part of Question 4 to implement the interface GSTApplicable that you have created as part of Question 5.  The modified class should have the name “ModifiedGSTItem” and should include implementation of all the methods declared in the interface GSTApplicable.

 

Question 7                                                                                                              3 Marks

The following Java program uses the data structure Stack to store data and the program runs without any error. Write the output produced by the program run.

import java.util.Stack; public class StackTest

{

public static void main(String [] args)

{

// name of structures in an array

String [] buildingPlan = {“Foundation”, “Wall”,”Roof”, “Antenna”};

/*creating buildingStack and taking the contents from buildingPlan array and placing them into the buildingStack*/

Stack<String> buildingStack =new Stack<String>();

for(int i=0; i< buildingPlan.length; i++) buildingStack.push(buildingPlan [i]);

/* creating demolitionStack, taking some of the contents from the buildingStack, one by one, and place them in demolitionStack */

Stack <String> demolitionStack =new Stack <String>(); while(buildingStack.size()>1)

demolitionStack.push(buildingStack.pop());

//printing the name of structures System.out.print(“buildingStack contains “); while(buildingStack.size()>0)

System.out.println(buildingStack.pop());

System.out.println(“demolitionStack contains “);

while(demolitionStack.size()>0)

System.out.println(demolitionStack.pop());

} // end of main method

} // end of class

Question 8                                                                                           6 Marks

The following InsuranceClaim class is incomplete. You need to complete the missing lines of code in

  • toString() method
    • inner class – Approval
    • main method

The expected output is as follows:

Claim Amount: 4500.00 for Claim Id: 1001 has not been approved

Claim Amount: 4500.00 for Claim Id: 1002 has been approved

Note:

An insurance claim is approved only when the claim amount is not exceeding the insured amount.

public class InsuranceClaim {

    private double insuredAmount;

    private double claimAmount;

    private int claimId;

    boolean approved; // for approve or reject the claim by desk verification

    //constructor

    public InsuranceClaim(double insuredAmount, double claimAmount, int claimId) {

        this.insuredAmount = insuredAmount;

        this.claimAmount = claimAmount;

        this.claimId = claimId;

        new Approval().deskVerify();

    }

    @Override

    public String toString() {

        // Student needs to complete the missing lines of code

    }

    class Approval {

/*Complete the deskVerify() method given below. If the claim amount does not exceed the insured amount, it can be approved; otherwise, it is not approved.  To change the instance variable ‘approved’ accordingly.

*/

        void deskVerify(){

// Student needs to complete the missing lines of code

        }

    }

     public static void main (String [] args) {

/*Student needs to complete the missing lines of code

write code to create an InsuranceClaim object with parameters such that the output

 “Claim Amount: 4500.00 for Claim Id: 1001 has not been approved” is produced.

*/

   

          InsuranceClaim myCalim = new

   

       System.out.println(       

/* Student needs to complete the missing lines of code

write code to create an InsuranceClaim object with parameters such that the output

“Claim Amount: 4500.00 for Claim Id: 1002 has been approved” is produced.

*/

   

          InsuranceClaim yourCalim = new

   

          System.out.println(

    }

}

 

Question 9                                                                                                                4 Marks

The ShapeTest class contains incomplete code in the main method. You need to complete the missing lines of code to test the polymorphic behaviour by calling the calculateArea() method appropriately.

// an interface interface Shape {

public double calculateArea();

}

//Rectangle class

class Rectangle implements Shape {

// fields/variables double length; double width;

//constructor

public Rectangle(double length, double width) { setLength(length);

setWidth(width);

}

//getters and setters

public double getLength() { return length;

}

public void setLength(double length) { if(length > 0)

this.length = length;

}

public double getWidth() { return width;

}

public void setWidth(double width) { if(width > 0)

this.width = width;

}

// returning the area of rectangle public double calculateArea(){

return length * width;

}

}// end of Rectangle class

//Circle class

class Circle implements Shape {

// fields/variables double radius;

//constructor

public Circle(double radius) { setRadius(radius);

}

//getters and setters

public double getRadius() { return radius;

}

public void setRadius(double radius) {

if(radius > 0) this.radius = radius;

else

this.radius = 0.0;

}

// returning area of circle public double calculateArea()

{

return Math.PI * radius * radius;

}

}

// to test the objects of Rectangle and Circle public class ShapeTest {

public static void main(String [] args){ Shape [ ] diagrams = new Shape [2];

/* Store the references to one rectangle and one circle shape objects in the above-mentioned ‘diagrams’ array.

Loop through the ‘diagrams’ array and invoke the calculateArea() method of the two shape objects stored in the array to test the polymorphic behavior.

*/

//Missing lines of code need to be completed by the student

}

}

Question 10                                                                                         4 Marks

Write short notes on the following. Your answer should have maximum three sentences for each of the following:

  • Generic method
  • Generic class
  • raw type and upper bound

— End of Exam Questions —

Order Now
No Fields Found.
Universal Assignment (May 28, 2023) Object Oriented Programming — COIT11134. Retrieved from https://universalassignment.com/object-oriented-programming-coit11134/.
"Object Oriented Programming — COIT11134." Universal Assignment - May 28, 2023, https://universalassignment.com/object-oriented-programming-coit11134/
Universal Assignment July 3, 2022 Object Oriented Programming — COIT11134., viewed May 28, 2023,<https://universalassignment.com/object-oriented-programming-coit11134/>
Universal Assignment - Object Oriented Programming — COIT11134. [Internet]. [Accessed May 28, 2023]. Available from: https://universalassignment.com/object-oriented-programming-coit11134/
"Object Oriented Programming — COIT11134." Universal Assignment - Accessed May 28, 2023. https://universalassignment.com/object-oriented-programming-coit11134/
"Object Oriented Programming — COIT11134." Universal Assignment [Online]. Available: https://universalassignment.com/object-oriented-programming-coit11134/. [Accessed: May 28, 2023]

Please note along with our service, we will provide you with the following deliverables:

Please do not hesitate to put forward any queries regarding the service provision.

We look forward to having you on board with us.

Get 90%* Discount on Assignment Help

Most Frequent Questions & Answers

Universal Assignment Services is the best place to get help in your all kind of assignment help. We have 172+ experts available, who can help you to get HD+ grades. We also provide Free Plag report, Free Revisions,Best Price in the industry guaranteed.

We provide all kinds of assignmednt help, Report writing, Essay Writing, Dissertations, Thesis writing, Research Proposal, Research Report, Home work help, Question Answers help, Case studies, mathematical and Statistical tasks, Website development, Android application, Resume/CV writing, SOP(Statement of Purpose) Writing, Blog/Article, Poster making and so on.

We are available round the clock, 24X7, 365 days. You can appach us to our Whatsapp number +1 (613)778 8542 or email to info@universalassignment.com . We provide Free revision policy, if you need and revisions to be done on the task, we will do the same for you as soon as possible.

We provide services mainly to all major institutes and Universities in Australia, Canada, China, Malaysia, India, South Africa, New Zealand, Singapore, the United Arab Emirates, the United Kingdom, and the United States.

We provide lucrative discounts from 28% to 70% as per the wordcount, Technicality, Deadline and the number of your previous assignments done with us.

After your assignment request our team will check and update you the best suitable service for you alongwith the charges for the task. After confirmation and payment team will start the work and provide the task as per the deadline.

Yes, we will provide Plagirism free task and a free turnitin report along with the task without any extra cost.

No, if the main requirement is same, you don’t have to pay any additional amount. But it there is a additional requirement, then you have to pay the balance amount in order to get the revised solution.

The Fees are as minimum as $10 per page(1 page=250 words) and in case of a big task, we provide huge discounts.

We accept all the major Credit and Debit Cards for the payment. We do accept Paypal also.

Popular Assignments

MQBS7030 Final Assessment Data Analysis and Report

ASSIGNMENT TASK: For this assignment, you need to refer to “Fringe” dataset. Fringe is concerned with the factors that contribute to the fringe benefits of employees. The dataset includes a range of different variables, which allows for a range of different tests to be performed. You should note that our

Read More »

MIS770 Foundation Skills in Business Analysis

MIS770 Foundation Skills in Business Analysis Department of Information Systems and Business Analytics Deakin Business School Faculty of Business and Law, DeakinUniversity Assignment Two Analysis of Click Sales Data Particulars Assurance of Learning This assignment assesses the following Graduate Learning Outcomes and related Unit Learning Outcomes: Graduate Learning Outcome (GLO)

Read More »

ITECH7407 – Real Time Analytics

Assessment Task – Data Analytics Assignment Overview For this assessment task, you will work in a group to analyse a selected data set, and provide recommendations to the leadership of the company based on your findings. Timelines and Expectations Percentage Value of Task: 25% Due: Week 11, Sunday 5pm Minimum

Read More »

BSB123 Data Analysis

BSB123 Data Analysis Research Report Assessment Semester 1, 2021 Due Date: 11:59 30th May The data for the Assignment can be found in the file Research Report Assessment (2021-01).xlsx on Blackboard The Problem FringeTech is an information technology / electrical engineering company that employs thousands of people Australia wide. Recently

Read More »

Final Analysis Assignment Help

Refer to the attached excel file, answer the questions below. Use graph if required. The file that can be accessed through the link below contains data on 100 employees in a particular occupation. Suppose that interest centres on investigating the factors that explain salary differences. The data set contains the following

Read More »

VETS6103 Data Analysis Assignment

Factors influencing milk production in Australian dairy cattle Assignment overview: This assignment involves analysing a dataset, interpreting results, and drawing conclusions based on the analyses. The dataset can be found in the file “practical_assignment_2021.xls” which is on Canvas under the Assignments folder. It is a group task worth 50% of

Read More »

ECON 1030 – BUSINESS STATISTICS

ECON 1030 – BUSINESS STATISTICS 1: Individual Assignment   Instructions: This is an individual assignment with a total of 40 marks. The allocation of marks is as follows: Statistical Analysis     (including excel) 32 Professional Report 8              Total 40 The response to the assignment must be provided in the form

Read More »

Assessment 3: Public Health Data Analysis

Assessment 3: Public Health Data Analysis Weighting: 30 % Details of task: This assignment involves the presentation and interpretation of descriptive statistics and statistical test results. On completion of this assessment task, you will be able to: Word limit: This assessment is 2,500 word equivalent with a focus on calculations

Read More »

Log Book Entry 2: Association and Regression

Submission deadline: 11:59pm, 7th December, 2021. All analytics tasks must be completed using R, and should be reproducible from the R code, which must be submitted as an appendix. This log book entry will focus on using association and regression to examine the relationships between multiple variables. Using the ames_train

Read More »

Assignment 2 (Individual): Data Analysis Project

Assignment 2 (Individual): Data Analysis Project (50%): The retail bank that you work for recently ran a telephone marketing campaign to encourage customers to subscribe to a term deposit. Data was obtained from the marketing campaign, internal systems relating to the characteristics of the customer as well as whether or

Read More »

BI7138: Biodiversity Informatics

Biodiversity Informatics Assessment 1 Biodiversity Informatics Assessment 1 The Red Kite (Milvus milvus) is a scavenging raptor found throughout Europe and native to Britain. Red Kites were once common throughout Britain. During the last century their populations were reduced to just a handful of birds in the Welsh valleys by

Read More »

MGMT Course Assignment Fall 2021

Contents Contents General Information. 2 Rules. 2 Outside sources. 3 Scenario. 3 What you need to do. 4 Part 1 – Exploratory data analysis. 4 Table 1. 4 Part 2 – Training and testing set (sample) 4 Table 2. 5 Part 3 – Simple linear regression. 8 Table 3. 8

Read More »

CM 4223– Company Strategic Planning

SWOT Analysis Project Report Guidelines   Introduction/Overview/Background This section is an introduction of your company. Discuss things such as company history, background, leadership team, and location. Ensure that you mention who you are and what you do. If there are global operations, highlight this as well. Mention any goods and/or

Read More »

Surveying (48320) Final Assignment – Major Project

Surveying (48320)  AUTUMN 2023 Final Assignment – Major Project Weight: 40% Due date: 02/06/2023 Student Name:     ________________   Student Number: ______________ Submission Date: ______________________ Submission Component and Marks Awarded Marks   PLAN:     Find Scale of plan and explain 4   9 Bearing and Distances of three lines 3

Read More »

IAP607BM Independent Critical Analysis Project

ASSESSMENT 2 BRIEF Subject Code and Title IAP607BM Independent Critical Analysis Project Assessment Group Presentation of Preliminary Findings Individual/Group Group Length 10-minute presentation and 10-minute Q&A (+/- 10%) Learning Outcomes This assessment addresses the following Subject Learning Outcomes:   Critically review and synthesise the literature as it applies to the

Read More »

SEO PLAN Assignment Help

SEO PLAN Review the SEO slides, SEO videos, and other SEO resources (word files, examples, templates) before doing the assignment.  Choose a “client”, a small to a medium size company, that does not rank too high on search engines. Follow the step by step process described below and create an

Read More »

CET333 Product Development ePortfolio

UNIVERSITY OF SUNDERLAND SCHOOL OF COMPUTER SCIENCE MODULE CODE: CET333 MODULE TITLE: Product Development MODULE ASSESSOR:   ASSESSMENT: 1 of 1 TITLE OF ASSESSMENT: Product Development ePortfolio ASSESSMENT VALUE: 100% PLEASE READ ALL INSTRUCTIONS AND INFORMATION CAREFULLY. This assignment contributes 100% to your final module mark. Please ensure that you

Read More »

ETF2100/5900 Introductory Econometrics Assignment 2

ETF2100/5900 Introductory Econometrics Assignment 2 — A Case Study on the Birth-weight of Baby Important notes: Notation used in the assignment needs to be typed correctly and properly. Incorrect (or inconsistent) notations are treated as wrong answers. We are interested in studying whether a mother’s smoking affects the birthweight of

Read More »

HA1011 Applied Quantitative Methods Group Assignment

   HOLMES INSTITUTE   FACULTY OF HIGHER EDUCATION Assessment Details and Submission Guidelines Trimester T1 2022 Unit Code HA1011 Unit Title Applied Quantitative Methods Assessment Type Assessment 2 Assessment Title Group Assignment (Min of 2 and maximum of 4 members in a group. Please check the group self-enrollment guide in

Read More »

Practical Assessment 2 Data Wrangling

Practical Assessment 2 Data Wrangling Assessment type: Written report (PDF document) using R Markdown Due date: 26th May 2022, 5 pm Melbourne time Weighting: 30% Word limit: Maximum 25 pages Feedback mode: Feedback will be provided using Canvas marking tool and general text comments. Group assessment You will work on

Read More »

Using aggregation functions for data analysis

Using aggregation functions for data analysis Total Marks 100, Weighting 20% The provided zip file contains the data file [RedWine.txt] and the R code [AggWaFit718.R] to use with the following tasks, include these in your R working directory. You can use the R script [template.R] to organise your code. Clarification

Read More »

EC2509 – Econometrics B

EC2509 – Econometrics B This EC2509 problem set must be handed in via Turnitin by Wednesday 23th February 2022, 23.59 Please submit your answer as a single PDF document. The document should contain the results as well as your written answer to the questions, and an appendix with your full

Read More »

Research Report: Assignment 2

Due Date/Time: 3:00pm (AWST), Friday May 13th, 2022 Marks: This assignment will be marked out of 100 and is worth 40% of your final grade for PSEM. Topic Overview: In this assignment, you will be analysing and interpreting the results of research seeking to investigate whether using diagnostic labels to

Read More »

PSEM: Research Report Data Analysis

PSEM: Research Report Data Analysis The next two weeks of content are essential for your second assessment. You will be analysing and reporting the data collected for your research report assessment (worth 40% of your grade for PSEM). At the end of these two weeks, you should be in a

Read More »

Wage Gaps Major Project

As part of your assessment, you will submit a written project worth 40% of your  final mark. This document sets out the main aspects of this project.  The aim of the project is to integrate the learning from the entire module in the service of  conducting your own exploration of

Read More »

Can't Find Your Assignment?

Open chat
1
Free Assistance
Universal Assignment
Hello 👋
How can we help you?