country
$20 Bonus + 25% OFF
Securing Higher Grades Costing Your Pocket? Book Your Assignment at The Lowest Price Now!

CSE1OOF-Oriented Programming Fundamentals

tag 0 Download12 Pages / 2,836 Words tag Add in library Click this icon and make it bookmark in your library to refer it later. GOT IT
  • Course Code: CSE1OOF
  • University: La Trobe University
  • Country: Australia

Question:

Assessment Objectives:

To design programs that conform to given specifications
To practise combining multiple classes and methods into a whole program
To implement programs in Java.

Task 1: Vector

In mathematics and physics, a vector is an element of a vector space. If the space is N dimensional, such a vector consists of N scalars. For example, the vector (0, 0) represents the origin point of a two-dimensional Euclidean space.

Task 1 requires you to write a Java class for a simplified vector that handle integer scalars. To enable rapid development of the program, the following Java file is provided:

 

Vector.java

An object of Vector class has the following attributes:

  • valuesThis is an integer array that stores a collection of input integers passed in a constructor. Note its access mode is protected.
  • sizeThis is an integer that represents the size of values attribute, i.e. the number of input integers. Note its access mode is protected.

Vector class has the following two overloaded constructors:

  • The first constructor has two parameters: an integer array that stores input integers passed by users, and an integer that represents a default value. It takes following actions:
  1. If the integer array parameter is null or contains less than two elements, values attribute is initialised of length 2, and both elements inside are set to the default value parameter; otherwise, values attribute is initialised of the same length as the integer array parameter, and all elements in the integer array parameter are copied to values attribute. Note it is NOT allowed to assign the value of the integer array parameter to values attribute. (Recall that an array is an object, and its corresponding object variable holds a memory address)
  2. size attribute is set to the actual length of integer attribute.
  • The second constructor has any number of integers as parameters for values attribute. It takes similar actions to what the first constructor does, with the default value parameter of zero (0). Note the second constructor is required to reuse the first constructor. (Recall what you have learned on the this keyword and varargs)

 

Vector class has the following four methods:

· toString

This is a public overrided method, which has no parameters but returns a String to represent the information about the current object’s values attribute. For example, if the values attribute has elements {2, 2, 2, 2}, the returned String is “[ 2 2 2 2 ]”.

· getValues

This is a public method, which has no parameters but returns an integer array. Specially, it returns a copy of all elements in values attribute. Note it is NOT allowed to return values attribute here. (Recall private leakage)

· getSize

This is a public method, which has no parameters but returns an integer. Specially, it returns the value of size attribute.

· main

This is a public static method to test the class and has been provided already. Note it is NOT allowed to make any change on this method. If the class is correctly written, it is supposed to output following information:

[ 0 0 ]

[ 0 0 ]

[ 1 2 ]

[ 1 1 ]

[ 4 5 6 ]

[ 4 5 6 ]

[ 4 5 6 ]

Task 2: RangedVector

Task 2 requires you to write a Java class for a more complicated vector compared to the previous one. It ensures all elements in values attribute in a specific range. To enable rapid development of the program, the following Java file and test data are provided:

RangedVector.java v1.dat

v2.dat v3.dat

RangedVector class inherits Vector class in Task 1. (Recall the lectures on inheritance in Week 10, especially the extends keyword)

Beside the attributes inherited from Vector class, an object of RangedVector class has the following attributes:

  • lowerbound This is an integer that specifies the smallest value stored in values attribute.

i.e. any element in values attribute is larger than or equal to it.

  • upperbound This is an integer that specifies the largest value stored in values attribute.

i.e. any element in values attribute is smaller than or equal to it.

RangedVector class has one constructor. It has three parameters: an integer array that stores input integers passed by users, an integer that represents the lowerbound, and another integer that represents the upperbound. The constructor takes following actions:

  1. It calls the first constructor of bass class, i.e. Vector class, and pass the integer array parameter and the lowerbound integer parameter (as the default value) to that constructor. (Recall the lectures on inheritance in Week 10, especially the super keyword)
  2. It sets upperbound and lowerbound attributes to the corresponding parameters. It is assumed that lowerbound parameter is always smaller than or equal to upperbound parameter.
  3. It checks each element in values attirbute to ensure if it is in the range of [lowerbound, upperbound] (inclusive). Specifically, if an element is smaller than lowerbound attribute, it is set to lowerbound attribute; if an element is larger than upperbound attribute, it is set to upperbound attribute.

RangedVector class has the following four methods:

· getDistance

This is a public method that has one parameter, i.e. another object of RangedVector class, and returns the Euclidean distance between the current vector and the parameter vector in double. Specifically, it takes the following actions,

  1. If the parameter object is null or has a difference size of values from the current one, it returns -1.0.
Otherwise, as mentioned above, it calculates the Euclidean distance between the two vector objects. Suppose the current object’s values is x = {x1, x2, …, xn} and the other’s values is y = {y1, y2, …, yn}, it returns a double d as follows:

? =  2√(?1 − ?1)2  + (?2 − ?2)2  + ? + (?? − ??)2

· add

This is a public method that has one parameter, i.e. another object of RangedVector class, and returns an object of Vector class. Specifically, it takes following actions:

  1. If the parameter object is null or has a different size to the current object, it returns a null.

 

  1. Otherwise, it adds the values attributes of the current object and the parameter object and returns an object of Vector class by using its first constructor with the added integer array and the default value of 0 as parameters. For example, if the two RangedArray objects have values attributes {1, 2, 3} and {4, 5, 6}, the method creates an object of Vector class with an integer array {5, 7, 9} and 0 as the constructor’s parameters and then returns it.

 

· toString

This is a public overrided method, which has no parameters but returns a String to represent the information about the current object. Specifically, it takes following actions:

  1. If lowerbound and upperbound attributes are same, it calls toString method of base class.

 

  1. Otherwise, it returns a String about the values attribute, e.g. {1, 2, 3, 4}, the lowerbound attribute, e.g. 1, and the upperbound attribute, e.g. 4, as

“[ 1 2 3 4 ] in range of [ 1, 4 ]”

 

· main

This is a public static method to test the class and has been provided already. Regarding change on main method, you are ONLY allowed to add code between the two following comments:

//---CHANGE ON main METHOD STARTS HERE

//---CHANGE ON main METHOD ENDS HERE

You are required to add code in the abovementioned area to enable the following actions:

  1. The program takes as command line arguments the paths to three .dat files as command arguments. For example:
java RangedVector v1.dat v2.dat v3.dat
  1. If command line arguments are less than or more than three, it prints the following information:
Error: The program requires as input 3 .dat files.
  1. Otherwise, it creates an object of RangedVector class for data read from each .dat file and stores all objects in an RangedVector array named rv.
  1. Each .dat file, no matter the one provided for testing or marking, consists one line of integers separated by white space. The first integer is lowerbound, the second is upperbound, and the rest are used as values in an object of RangedVector class. For example, v1.dat contains the following line:
3 7 1 3 5 7 9

Hence, the program takes 3 as lowerbound parameter, 7 as upperbound parameter, and {1, 3, 5, 7, 9} as the interger array parameter to the constructor and then creates an object of RangedVector class.

Any .dat test file for this assignment contains at most 16 integers.

 

  1. If the class is correctly written, it is supposed to output following information with v1.dat, v2.dat and v3.dat as command line arguments:

RV 0: [ 3 3 5 7 7 ] in the range of [ 3, 7 ]

RV 1: [ 4 4 6 8 8 ] in the range of [ 4, 8 ]

RV 2: [ 2 2 2 2 ]

--->

Euclidean distance between RV 0 and RV 1: 2.24

Addition of RV 0 and RV 1: [ 7 7 11 15 15 ]

Euclidean distance between RV 0 and RV 2: -1.00 Addition of RV 0 and RV 2: Invalid!

Euclidean distance between RV 1 and RV 2: -1.00 Addition of RV 1 and RV 2: Invalid!

Download Sample Now

Earn back the money you have spent on the downloaded sample by uploading a unique assignment/study material/research material you have. After we assess the authenticity of the uploaded content, you will get 100% money back in your wallet within 7 days.

Upload
Unique Document

Document
Under Evaluation

Get Money
into Your Wallet

Total 12 pages, 1 USD Per Page

Cite This Work

To export a reference to this article please select a referencing stye below:

My Assignment Help. (2020). Oriented Programming Fundamentals. Retrieved from https://myassignmenthelp.com/free-samples/cse1oof-oriented-programming-fundamentals.

"Oriented Programming Fundamentals." My Assignment Help, 2020, https://myassignmenthelp.com/free-samples/cse1oof-oriented-programming-fundamentals.

My Assignment Help (2020) Oriented Programming Fundamentals [Online]. Available from: https://myassignmenthelp.com/free-samples/cse1oof-oriented-programming-fundamentals
[Accessed 19 September 2020].

My Assignment Help. 'Oriented Programming Fundamentals' (My Assignment Help, 2020) <https://myassignmenthelp.com/free-samples/cse1oof-oriented-programming-fundamentals> accessed 19 September 2020.

My Assignment Help. Oriented Programming Fundamentals [Internet]. My Assignment Help. 2020 [cited 19 September 2020]. Available from: https://myassignmenthelp.com/free-samples/cse1oof-oriented-programming-fundamentals.


Finding the perfect topic for your speech can turn out to be a real struggle. To tackle the issue, seek assistance from MyAssignmenthelp.com to get the best persuasive speech topics. The informative speech topics you receive from us will help you write an impactful essay easily. You will also be able to find sufficient resources on the persuasive essay for college provided by us. Hence, stop wasting time searching for interesting and informative speech topics and seek our essay help now.

Latest Programing Samples

COIT 11134 Object Oriented Programming

Download : 0 | Page : 1
  • Course Code: COIT 11134
  • University: Central Queensland University
  • Country: Australia

Answer:

Home or Menu screen of the Application 

Add a Tour with activity Screen of the application

 

Error message if any of the Text Fields are left blank 

Add a tour without activity

Error message when text box is left blank in the add tour page

Add new activity screen of the application

Error message for Add Activity Screen

Add guide Screen

Add Guide Error  

Error message for add activity

Read More arrow

MSC 3371 Linear Programming And Sensitivity Analysis

Download : 0 | Pages : 3
  • Course Code: MSC 3371
  • University: American University
  • Country: United States

Answer: Part a             The optimal solution for the solution is 5* 523.364486 + 8*1532.71028. The value of the total annual return is 14878.50467. Variable Cells                 Final Reduced Objective Allowable Allowable   Cell Name Value Cost Coefficient ...

Read More arrow

MCHA3900 : Mechatronic System Design

Download : 0 | Pages : 4
  • Course Code: MCHA3900
  • University: University Of Newcastle
  • Country: Australia

Answer: 1) Generally, the controlling process of a PID controller is adjustable with the help of tuning the settings of the controller. Tuning refers to a process, where the optimal gains are set for, P, I along with D, so that the control system can receive a response which is ideal. Generally, the plant control systems are automated. However, control performance changes along with the passage of time. Thus, it is required tuning. Control syst...

Read More arrow Tags: Management Conceptual Tuning Process MBA 

CI6110 Programming III

Download : 0 | Pages : 6
  • Course Code: CI6110
  • University: Kingston University London
  • Country: United Kingdom

Answer: Employee Management System a) Introduction to Java Spring and SpringBoot Spring is a very popular Java-based framework. It is used for building web applications and various enterprise level applications. Spring framework provides a wide variety of features addressing modren business needs. We can configure beans in a Spring application by various ways like XML, annotations and JavaConfig. As the number of features incresed, the S...

Read More arrow

CIS 5200 Advance Programming

Download : 0 | Pages : 11
  • Course Code: CIS 5200
  • University: Central Queensland University
  • Country: Australia

Answer: TASK 1: Time Management Plan      Task Name Duration Start Finish Coles Group Limited 50 days Tue 1/9/18 Mon 3/19/18    Primiliarly Investigation 14 days Tue 1/9/18 Fri 1/26/18       Understanding Problems related to Existing project 4 days Tue 1/9/18 Fri 1/12/18   &n...

Read More arrow
Next
watch

Save Time & improve Grade

Just share Requriment and get customize Solution.

question
We will use e-mail only for:

arrow Communication regarding your orders

arrow To send you invoices, and other billing info

arrow To provide you with information of offers and other benefits

1,417,912

Orders

4.9/5

Overall Rating

5,091

Experts

Our Amazing Features

delivery

On Time Delivery

Our writers make sure that all orders are submitted, prior to the deadline.

work

Plagiarism Free Work

Using reliable plagiarism detection software, Turnitin.com.We only provide customized 100 percent original papers.

time

24 X 7 Live Help

Feel free to contact our assignment writing services any time via phone, email or live chat.

subject

Services For All Subjects

Our writers can provide you professional writing assistance on any subject at any level.

price

Best Price Guarantee

Our best price guarantee ensures that the features we offer cannot be matched by any of the competitors.

Our Experts

Assignment writing guide
student rating student rating student rating student rating student rating 5/5

798 Order Completed

97% Response Time

Benjamin Blakeman

MSc in Medical Technology

London, United Kingdom

Hire Me
Assignment writing guide
student rating student rating student rating student rating student rating 4/5

2594 Order Completed

95% Response Time

Michael Johnson

Masters of MSc in Economics

Washington, United States

Hire Me
Assignment writing guide
student rating student rating student rating student rating student rating 5/5

2109 Order Completed

99% Response Time

Emma Zhong

Ph.D in Project Management with Specialization in Project Communications Management

Singapore, Singapore

Hire Me
Assignment writing guide
student rating student rating student rating student rating student rating 5/5

610 Order Completed

100% Response Time

Cheryl Zhao

PhD in Statistics

Singapore, Singapore

Hire Me

FREE Tools

plagiarism

Plagiarism Checker

Get all your documents checked for plagiarism or duplicacy with us.

essay

Essay Typer

Get different kinds of essays typed in minutes with clicks.

edit

GPA Calculator

Calculate your semester grades and cumulative GPa with our GPA Calculator.

referencing

Chemical Equation Balancer

Balance any chemical equation in minutes just by entering the formula.

calculator

Word Counter & Page Calculator

Calculate the number of words and number of pages of all your academic documents.

Refer Just 5 Friends to Earn More than $2000

Check your estimated earning as per your ability

1

1

1

Your Approx Earning

Live Review

Our Mission Client Satisfaction

I got the timely response and got the editing done according to the tutor. Lets hope for the good marks.

flag

User Id: 477849 - 19 Sep 2020

Australia

student rating student rating student rating student rating student rating

THANKS, I GOT 100% MARKS IN THIS SUBMISSION, NICE WORDS, CLEARLY EXPLAINED ALL THE NEED AND DETAILED INFORMATION PROVIDED BY EXPERT; I AM VERY THANKFUL TO YOU. I HAVE VERY BUSSY SCHEDULE NOT ABLE TO GET TIME OUT FOR MAKING MY SUBMISSION NOW. I GET SO...

flag

User Id: 489837 - 19 Sep 2020

Australia

student rating student rating student rating student rating student rating

so far I have got just pass and some of that got fail grade let's see at this time

flag

User Id: 309932 - 19 Sep 2020

Australia

student rating student rating student rating student rating student rating

I told u many times mentioned many times that the industry name is. The spectacle site but u wrote about pharmarcy 777 bcz of ur mistake i lost my 30%

flag

User Id: 273173 - 19 Sep 2020

Australia

student rating student rating student rating student rating student rating
callback request mobile
Have any Query?