Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Note: Please answer the following questions in the Java Programming Language. Please answer within 24 hours . Part II: Coding Section 1) Inheritance Demonstrate your

Note: Please answer the following questions in the Java Programming Language.

Please answer within 24 hours.

image text in transcribed

image text in transcribed

Part II: Coding Section 1) Inheritance Demonstrate your ability to program using inheritance in the Java programming language. Demonstrate your knowledge of proper equals implementations in the Java programming language. Instructions There are three tasks to complete . Create an object hierarchy which mimics the classification for university affiliates. This should proceed logically. The hierarchy should be contained within package edu.nyu.cs9053.midterm hierarchy There should be an abstract base class called Universitxaffidiate There should be the following subtypes. Subtypes in bold should be abstract: Student Undergraduate Student Graduate Student Employee Faculty Staff Administrator Lecturer Assistant Professor Associate Professor Professor Each of the subtypes should have the following methods: getdamos. returns a name for the person as a String. This value is per object and not defined by the class it should not be used for equality. setage returns the age of the person as an int. This value is per object and not defined by the class it should be used for equality. Students should have the method: js Matriculated which returns a Boolean o Employees should have the methods: get Salary which returns a salary as a double o Faculty should have the methods: istenured which returns a bestean isadiynst which returns a bordean Staff and Administrator classes should have the method gettitle which returns a String indicating their job title There should be an equals() method to show if two faculty objects have the same values (other than name, which can be different) 2) File 1/0 and Exceptions Create a Java class MyVector that represents an n-dimensional vector. The class should have the following methods: MXVesterfint n): constructor creates a vector of size n with all values set to zero void save(String filename): saves the values of the vector to a file with the name filename static MxVector read(String filename): reads the values of a vector from the file named filename, creates the vector, and returns it Mylester sum (MXVester v): adds the value of the current vector to the vector v and returns a new vector representing the sum. Throws the exception Incompatibledimensions if the matrices are of different dimensions MyVector multiply (MyVector v): calculates the dot product of MyVector and vand returns a new vector representing the detrraduct. Throws the exception IncompatibleDimensions if the matrices are of different dimensions A few hints for file reading and processing: If you've read in a line, intine, the method inline:split() will return an array of Strings of the contents of the line separated by spaces. Eg, for the line 5.5 2.3 4.5 inline.split() will give an array ["5.5", "2.3", "4.5"] If you have a string representing a numerical value, to convert it to an Integer, use the method Integer.parseInt(). For a double value, use the method Double parse Double() You will have to define the exception IncompatibleRimensions if the sum and multiply methods attempt to operate on vectors of different dimensions. You will also define the exception InvalidFileFormat if the file has data that can't be read into a vector

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago