Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can i get help with this one please. here is the starter class public class Quadrotor { private int x; private int y; private int

can i get help with this one please. here is the starter class

public class Quadrotor { private int x; private int y; private int z;

public Quadrotor(int x, int y, int z) { this.x = x; this.y = y; this.z = z; }

public int getX() { return x; }

public void setX(int x) { this.x = x; }

public int getY() { return y; }

public void setY(int y) { this.y = y; }

public int getZ() { return z; }

public void setZ(int z) { this.z = z; }

@Override public String toString() { return "QR:" + x + "/" + y + "/" + z; }

@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + x; result = prime * result + y; result = prime * result + z; return result; }

@Override public boolean equals(Object obj) { if (!(obj instanceof Quadrotor)) return false; Quadrotor other = (Quadrotor) obj; if (x == other.x && y == other.y && z == other.z) return true; return false; }

}

And what i've got so far

public class QuadrotorApp { public static void main(String[] args){ List rotors = Arrays.asList( new Quadrotor(2,4,2), new Quadrotor(3,4,4), new Quadrotor(4,4,6), new Quadrotor(5,4,2), new Quadrotor(6,4,4), new Quadrotor(7,4,6)); System.out.println(rotors.toString()); } }

image text in transcribed

What is a Quadrotor? Checkout this video Download Quadrotor java In the same directorycreate a file called QuadrotorApp. Itincludes the main method In main do e following Create a List of Quadrotors and initialize it with 6quadrotors like this: List rotors Arrays .as List new Quadrotor (2, 4, 2), new Quadrotor(3, 4, 4), new Quadro tor (4, 4, 6) new Quadrotor (5, 4, 2), new Quadrotor (6 4, 4), new Quadrotor (7, 4, 6) Prin the list (List has an overridden toString method Compile-run Write a private staticmethod called changeorientation. t has one parameter of type List does Change the initialization of the variable rotors by creatingan ArayList ke this List Quadrotor rotors new Array List (Arrays. asList new Quadrotor (2, 4, 2), new Quadrotor(3, 4, 4), new Quadro tor (4, 4, 6) new Quadrotor (5 4, 2), new Quadrotor (6, 4, 4), new Quadro tor (7, 4, 6))) Remove searchltem and pri nt the list New position Remove the item onindex 0and prin the list output: [QR: 2/4/2, QR: 3/4/4, QR: 4/4/6, QR:5/4/2, QR 6/4/4, QR 4/6] original position [QR: 4/2/2, QR: 4/3/4, QR:4/4/6, QR:4/5/2, QR:4/6/4, QR:4/7/6] rotors does contain QR :4/6/4 Number of rotors [QR 4/2/2, QR: 4/3/4, QR: 4/4/6, QR:4/5/2, QR: 4/7/6] [QR :4/3/4, QR :4/4/6, QR 4/5/2, QR :4/7/6]

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 Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

Define Administration?

Answered: 1 week ago

Question

Define Decision making

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago