Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE COMPLETE ALL PARTS IN JAVA PLEASE COMPLETE ALL PARTS IN JAVA PLEASE COMPLETE ALL PARTS IN JAVA PART 1 PART 2 PART 3 PART

PLEASE COMPLETE ALL PARTS IN JAVA

PLEASE COMPLETE ALL PARTS IN JAVA

PLEASE COMPLETE ALL PARTS IN JAVA

PART 1

image text in transcribed

PART 2

image text in transcribedPART 3image text in transcribed

PART 4

image text in transcribed

PLEASE COMPLETE ALL PARTS IN JAVA

PLEASE COMPLETE ALL PARTS IN JAVA

PLEASE COMPLETE ALL PARTS IN JAVA

PLEASE COMPLETE ALL PARTS IN JAVA

PLEASE COMPLETE ALL PARTS IN JAVA

PLEASE COMPLETE ALL PARTS IN JAVA

We have created a Car class with the following methods (we're intentionally hiding implementation details from you): class Car { public String getMake(); // get the car's make public String getModel(); // get the car's model public String getNoise(); // returns a String of the noise the car makes TASK: Create a class called MyProgram with a main method that does the following tasks: 1. Create a new Car object 2. Print its make 3. Print its model 4. Print the noise it makes Sample Input: Ignore the Sample Input/Output sections (Stepik won't let me hide them) Sample Output: TASK: Create a class called Rectangle that has the following private instance variables: width, which is a double height, which is a double As well as the following public constructors: A constructor with one double parameter sideLength, which sets both the width and height instance variables to sideLength A constructor with two double parameters width and height, which sets both the width and height instance variables to the corresponding values that were passed in And the following public methods: computeArea, which has no parameters and returns the area of the Rectangle object as a double computePerimeter, which has no parameters and returns the perimeter of the Rectangle object as a double getHeight, which has no parameters and returns the height of the Rectangle object as a double getWidth, which has no parameters and returns the width of the Rectangle object as a double Sample Input: 42.0 4.2 Sample Output: 42.0 42.0 168.0 1764.0 42.0 4.2 92.4 176.4 TASK: Create a class called FancyArray that has the following private instance variables: array, which is an int[] delim, which is a String As well as the following public constructor: A constructor with one int[] parameter array and one String parameter delim, which sets the array and delim instance variables to the corresponding values of the arguments. You can assume we will not give you an empty array And the following public methods: .getArray, which has no parameters and returns the array instance variable getDelim, which has no parameters and returns the delim instance variable print, which has no parameters and prints the elements of the array instance variable such that they are delimited by the delim instance variable Sample Input: 1 2 3 4 5 -> Sample Output: 1->2->3->4->5 TASK: Create a class called Point that will be used to represent n-dimensional points (Not just 2-dimensional! Any arbitrary n!). It should have the following properties: It should have one private instance variable of type double[] called coordinates It should have a public constructor that has one double[] parameter coordinates, which should set the coordinates instance variable to the argument that is passed in It should have a public instance method called distance that has one Point parameter other, and it should return the Euclidean distance between the point object and other as a double + (ai b;). In other words, HINT: Recall that the Euclidean distance between two n-dimensional points points a and bis d(a,b) = d(a, b) = V (a1 b)2 + (az bz)? + ... + (ar bn)?. HINT: You can use Math.sqrt(x) to take the square root of a variable x. No need to import anything: we've done that for you behind-the- scenes. Sample Input: 42.0 4.2 24.0 8.4 Sample Output: 18.483506160899235

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 And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions