Write a void method that takes as a parameter

Assignment Help JAVA Programming
Reference no: EM13700665

Can you answer the given questions?

Question 1: Write a Point class. A Point should have the subsequent:

- two private double fields, x and y, representing the coordinates of the Point

- a constructor that takes two double parameters with which to initialize a Point's fields

- get and set methods for the x and y coordinates

Question 2: Write a Line class. A Line should have the subsequent:

- two private Point fields, p1 and p2, representing two points of the LineSegment

- a constructor that takes two Point parameters with which to initialize a Line's fields

- get and set methods for the two points

- an intersects method that takes a Line parameter and will return a new Point object representing where the two Lines intersect.

If the two Lines are parallel, you should return null. The header will look like this: "public Point intersects (Line otherLine)".

Question 3: Write a void method that takes as a parameter an array of Lines and prints out the location of each intersection. The intersection of any two lines should only be printed once (in other words, don't print the intersection of line1 and line2, and then print the intersection of line2 and line1).

Solve these questions in details and give examples to support your rationale. Be sure to add comments. Comments should be added in the program to explain your calculations and program.

Reference no: EM13700665

Questions Cloud

What is the ph of a buffer prepared by adding of weak acid : Question- What is the pH of a buffer prepared by adding 0.405mol of the weak acid HA to 0.608mol of NaA in 2.00 L of solution. The dissociation constant Ka of HA is 5.66×10?7.
Write a program that draws a picture of a house : Write a program that draws a picture of a house. It could be as easy as the accompanying figure, or if you like, make it more elaborate (3-D, skyscraper, marble columns in the entryway, whatever).
Write a class called misc that has no instance variables : Write a static double method called evaluateQuadraticPolynomial that takes four double parametersa, b, c, and x and returns the value of ax^2 + bx + c
How many dissociated h+ ions are there in aqueous solution : Question- At 25 °C, how many dissociated H+ ions are there in 341 mL of an aqueous solution whose pH is 11.47
Write a void method that takes as a parameter : Write a Point class. A Point should have the subsequent - Write a void method that takes as a parameter an array of Lines and prints out the location of each intersection. The intersection of any two lines should only be printed once
What is the mass percent water in cobalt(ii) hexahydrate : This is due to the fact that the hydrate is a deep magenta color while the anhydrous form is a pale blue. As the humidity level changes, the color changes as well. What is the mass percent water in cobalt(II) hexahydrate
Write a bag class with a generic type : Write a Bag class with a generic type. Write a class such as item that has a name and price - Add objects of item to the bag and find the average and the total of the price of all items in the bag.
Find its speed after given time : A 1.5 x 103-kg car is pulled horizontally by a tow truck. The tension in the tow rope is 2.1 x 103N, and a 1.8 x 102 N friction force opposes the motion. If the car starts from rest, what is its speed after 5.0 s
Explain if a buffer solution is 0.100 m in a weak acid : Question- If a buffer solution is 0.100 M in a weak acid (Ka=3.8 x 10^-5) and 0.480 M in its conjugate base, what is the pH

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive method

What will happen when the following recursive method is executed with an initial input value of 10?public int recursiveMethod(int input)

  Java application to permit user to enter ten numbers

Write down Java application which permits a user to enter 10 numbers (double precision) into the array and then sorts and displays numbers from lowest to highest.

  Use a loop to allow a user to enter a series of numbers

Use a loop to allow a user to enter a series of numbers and then print out the series of numbers when the user is done. The user stops the lseries program by entering -1 (or any negative number).

  Program (using java) that is suppose to find the largest

writing a program (using java) that is suppose to find the lowest integer that can be evenly divided by a range (ex. 1-25). I need help fixing/debugging it so it comes up with the proper output.

  Part-1inheritance write code using eclipse and output

part-1inheritance write code using eclipse and output screenimplement a subclass square that extends the rectangle

  What ways can vulnerable inmates be protected

What ways can vulnerable inmates be protected? Why are classification and housing assignments so critical to these populations?

  Consider an array of integers

Consider an array of integers as below: int[] a = {5, 2, -4, 3, 0, -5, 7, 11, 6, 13} Complete the method named count(int[] a) in the class Count. The method should return the number of positive numbers in the array

  Explain the difference between throwing an exception and

question 1. what is the difference between throwing an exception and catching an exception?question 2. how does a

  Simulate the transactions of a checking account

create a base class, called CBankAccount, and two additional classes (each derived from CBankAccount), called CSavingsAccount and CCheckingAccount.

  Javas drawing capabilities

This week, we will be learning to use some of Java's drawing capabilities. The Graphics class provides methods for drawing many different shapes, using different colors, and for drawing strings using different fonts.

  Determine product a inferior or normal good

Research illustrates that prices of related goods are given by Py = $5,900 and ; Pz = $90, while average income of individuals consuming this product is M = $55,000. Is X inferior or normal good?

  Design and implement a small and simple email server

Design and implement a small and simple email server using the concept of web based information system (WBIS).

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd