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 (September 27, 2022) Object Oriented Programming — COIT11134. Retrieved from https://universalassignment.com/object-oriented-programming-coit11134/.
"Object Oriented Programming — COIT11134." Universal Assignment - September 27, 2022, https://universalassignment.com/object-oriented-programming-coit11134/
Universal Assignment July 3, 2022 Object Oriented Programming — COIT11134., viewed September 27, 2022,<https://universalassignment.com/object-oriented-programming-coit11134/>
Universal Assignment - Object Oriented Programming — COIT11134. [Internet]. [Accessed September 27, 2022]. Available from: https://universalassignment.com/object-oriented-programming-coit11134/
"Object Oriented Programming — COIT11134." Universal Assignment - Accessed September 27, 2022. https://universalassignment.com/object-oriented-programming-coit11134/
"Object Oriented Programming — COIT11134." Universal Assignment [Online]. Available: https://universalassignment.com/object-oriented-programming-coit11134/. [Accessed: September 27, 2022]

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 45%* OFF on Assignment Help

Popular Assignments

VU22977 – Practice in a Legal Environment

Advanced Diploma of Legal Practice – 22565VIC PORTFOLIO- CLIENT MATTER FILE Assessment task 1 Prepare a comprehensive portfolio of documents to create a Client Matter File which must include: Element 1 Area of law Cover sheet stating client name and short description of legal matter Client Instruction Sheet, Costs Agreement

Read More »

KIT714 ICT Research Principles: Assignment 1

Practical Qualitative Research Exercise                                                                                                                                         Type:                 In-Semester, Individual Assignment Task Length:   minimum 2,000 words Weighting:     20% of total assessment for this unit Due Date:       Friday 5 August 2022 – 11:55 pm (Week05) Submission:    electronic submission on MyLO (WORD or PDF) Description:    This practical exercise will engage students in a qualitative research

Read More »

MODULE 44-704463 Dissertation Help

ASSESSMENT CRITERIA Dissertation (12,500 words) Deadline: JULY 29th 2022, 3pm Introduction and abstract  Situates the research question within the, theory, and concepts Explains the value of the study.  Relevance of the research question, to the field of study is fully justified. Leads logically into the Literature Review. Abstract of professional

Read More »

ITECH1103-Assignment: Assignment 2: Analytics Report

Overview The purpose of this task is to provide students with practical experience in writing a data analytical report to provide useful insights, patterns, and trends in a chosen dataset in the light of a set of tasks required within this document. This dataset will be chosen from the UC

Read More »

PBHL20001 Term 1, 2022 – Supplementary Assessment

PBHL20001 Term 1, 2022 Supplementary Assessment The influenza pandemic that followed World War I and took place over the period from 1918-1920 resulted in an estimated 100 million deaths worldwide and 500 million infections. In addition, this pandemic had a significant impact on public health practice throughout the 20th century

Read More »

Community Health Project 1 (HLTH 3058): Assessment 2: Portfolio Task 2

Community Health Project 1 (HLTH 3058) Assessment 2: Portfolio Task 2 – Evaluative Framework Marking Guide Weighting: 15% the total grade for the course   Criteria Outstanding performance (75-100%) Exceeds core requirements (65-74%) Meets core requirements (50-64%) Does not meet requirements (<50%) Comments Content (70%) Demonstrates adequate knowledge of integrating

Read More »

Community Health Project 1 (HLTH 3058): Assessment 2: Portfolio Task 1

Community Health Project 1 (HLTH 3058)Assessment 2: Portfolio Task 1 – Ethical Considerations Marking GuideWeighting of 15% the total grade for the course Criteria Outstanding performance (75-100%) Exceeds core requirements (65-74%)   Meets core requirements (50-64%) Does not meet requirements (<50%) Comments CONTENT (80%) Ethical Considerations   Demonstrates adequate knowledge

Read More »

SAM 11486/SAM G 6677: Assignment 1 – Individual

Assignment 1 – Individual (25%) Report Due: 11:59pm Sunday Week 5 04/09/2022 This assignment will be marked out of 25 marks and is worth 25% of the overall mark for the unit. Please check the unit outline for late penalties and restrictions on late submissions. This assignment is an individual

Read More »

11486 Systems Analysis and Modelling

Assignment Case Study C – Feed Me Now Disclaimer: The situation described in the following case study is fictional, and bears no resemblance to any persons, businesses, or organisations, living or dead. Any such resemblance, if exists, is merely co-incidental in nature, and is not intentional. Feed Me Now is

Read More »

MAA703 – Accounting for Management

Trimester 2 2022 Assessment Task 2 Part B – Teamwork Reflection (Individual) DUE DATE AND TIME:                        Wednesday, 7 September 2022 by 8:00pm (AEST) PERCENTAGE OF FINAL GRADE:    10% WORD COUNT:                                   750 – 800 words Description Teamwork is one of the vital components of many workplaces and the ability to demonstrate

Read More »

Research project assessment proforma and marking schemes

BSc Biomedical Sciences with Health, Exercise and Nutrition (HEN6004) and BSc Biomedical Science (APS6022) Instructions for use All forms must be completed electronically and uploaded to the student submission point in  turnitin. Please note the literature review assessment will be completed in January whereas the assessment of the paper/poster and

Read More »

XERO and Spotlight reporting software Report Assignment

Case facts – Read me carefully please City Infrastructure Holdings Ltd (CIH) and Network Maintenance Services Ltd (NMS) City Infrastructure Holdings Ltd (CIH) acquired 100% of the 300,000 issued shares in Network Maintenance Services (NMS) on 1 July 2021.  The consideration provided to shareholders of NMS consisted of $1.20 in cash plus 1

Read More »

KIT103 Computational Science

School of Information and Communication Technology College of Sciences and Engineering Unit Outline KIT103 Computational Science Semester 2, 2022 Sandy Bay Campus, Hobart Newnham Campus, Launceston COVID-19 (Coronavirus Information) For information on how you can help keep us all safe, please review the Coronavirus updates page here: https://www.utas.edu.au/about/safety-security-and-wellbeing/coronavirus Sections that

Read More »

SEN725 Urban Stormwater Asset Design

Assessment Task -4 Final Report – Analysis of CoGG Stormwater Network Weight 50% This is an individual assessment task. Plagiarism and collusion is unacceptable practice at Deakin University. You must appropriately reference your work. Failure to do so will result in disciplinary action. For more information on plagiarism and collusion,

Read More »

PSY3PRP 2022 Assignment 2: Research Project Report

PSY3PRP 2022 Assignment 2: Research Project Report Guidelines and Marking Rubric Individual Research Report due Wednesday 19th October 11.59pm (50% of total grade) For this assignment—with support through structured tutorial work across much of the semester— you will produce an individually-written report on the broad topic of feeding difficulties in

Read More »

Increasing Demand for assignment help in Namibia

With the growing population, the demand for clean energy, advanced technology, new structures, and better healthcare is escalating day by day which makes engineering the most popular degree for the youth. As more people pursue engineering nowadays, it also makes it one of the most difficult and competitive degrees also.

Read More »

Online Assignment Help in Germany

How Could You Do Exam Preparation Effectively? Exam time is full of challenges and difficulties. You have to juggle exams even in high school, college, or higher education. It defines your knowledge of a specific subject and how well you know the curriculum. The exam also tests how much you

Read More »

Get Excellent Human Values Assignment Help Immediately

Get Excellent Human Values Assignment Help Immediately: Expert Solutions to all your Queries Instant Human Values Assignment Help Online Students can get Human Values assignment help online in a fast and simple way from the experts at Universal Assignment Help Service. Their team of over 172+ subject experts works every

Read More »

Get Top Modern History Assignment Help Online

Order Modern History Assignment Help immediately Students often need modern history assignment help for many reasons. Getting immediate online help for assignments helps students boost their academics in incredible ways. Sometimes, the pressure of studies is too much to take for students. This causes them to score poor grades and

Read More »

Get Instant Assignment Help in the United Arab Emirates

How Can Assignments Help Students? Whatever the definition of homework is, one thing is certain: it helps students thoroughly learn the concepts they have studied in class. The number of such assignments may cause stress or a burden. It means students and tutors are both correct in their type of

Read More »

Assignment Help in Mexico

How to Gain Awesome Grades in Your Chemistry Subject? Whether you are pursuing a technical degree or studying in the science stream, chemistry is always at the forefront. If you love to observe reactions, molecules, acids, condensation, evaporation, and dilution, chemistry will prove a resource for getting outstanding academic marks.

Read More »

Assignment Help in Kenya

How Could You Find the Best Biology Homework Website? Getting online homework help from an expert is neither embarrassing nor unauthentic. The vast majority of students around the world believe that doing online assignments and tutoring is beneficial. The Standard Graduate School of Education revealed that 56% of students suffer

Read More »

Assignment Help in Bangladesh

The Best 6 Hacks to Shortlist the Top Civil Engineering Assignment Tutor? Finding a homework expert for civil engineering assignments is a hectic task. As civil engineering has several fields, getting expertise is difficult for tutors. You may struggle to receive civil engineering assignment help in Bangladesh due to this

Read More »

Assignment Help in Pakistan

What Will Unethical Occur from Getting Homework? Homework looks like a mode of learning in most cases. But what happens to its quantity? Its quantity should be more than enough for students. Such circumstances may be detrimental to the health of the pupils. Sometimes, college faculties or teachers forget to

Read More »

Assignment Help in Malaysia

The Best 4 Skills You Should Learn For Making Your Career in 2022 As technological innovations leap forward daily, new skills are entering our market. Sticking to one skill set enables you to lose lucrative job opportunities. That is why it gives importance to having diverse skills, which should be

Read More »

MKT200 Marketing Principles: Infographic

Assessment 2 Information Subject Code: MKT200 Subject Name: Marketing Principles Assessment Title: Infographic Assessment Type: Individual infographic Length: Two pages Weighting: 30% Total Marks: 100 Submission: Online Due Date: Week 9 Your task Individually, you are required to create a two-page infographic outlining the communications process of two competitor brands.

Read More »

MMP-223, Property and Real Estate Law and Practice

MMP-223, Property and Real Estate Law and Practice, Trimester 2, 2022 Assignment 2, Client Report, Individual Assignment 25% of Unit Assessment (1,250 words*) Due Date: September 16, 2022, 8-pm AEST Assignment Brief: Clyde, being a real estate agent, loves property. With his share of the sale of the Sorrento property

Read More »

NUR1398 – Foundations of Nursing Practice Theory

Assessment: Care Plan Report Task overview Course NUR1398 – Foundations of Nursing Practice Theory Brief task description Written care plan addressing nursing care requirements for older patients with degenerative conditions. Rationale for assessment task Registered Nurses are required to think through the different aspects of patient care to arrive at

Read More »

MBA641 Project Strategy Framework

Assessment 1 Information Subject Code: MBA641 Subject Name: Strategic Project Management Assessment Title: Project Strategy Framework Assessment Type: Length: Individual video recording and supporting Infographic Video: 10-minute (no more) Supporting infographic: 1 page (no more) Weighting: 30% Total Marks: Submission: 100 Online Due Date: Week 4 Your task You are

Read More »

SEJ201 Structural Design Assessment

SEJ201 Structural Design Assessment Task 5 FINAL PROJECT REPORT Summary The Final Project Report is an individual task which builds on teamwork completed earlier in the trimester. This report shall clearly explain and justify the design solution proposed. In this report students you should identify project scope, inputs and constraints,

Read More »

42907 Design for Durability

Introduction Overall, explain what readers will find in the report, general information about the structure, location, climatic conditions, detail which specific parts of the structure will be designed according to which Australian standard. Which type of foundation, why? You can use figures in this section. Provide the scope of the

Read More »

Can't Find Your Assignment?

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