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

  Write program that uses top five countries national wealth

Write a program that uses the top five countries' National Wealth to calculate the average of those five countries.

  Enhance the test score applicaion

Enhance the Test Score applicaion so it uses a "while" or a "do-while" loop plus a for loop - Change the while statement to a do-while statement, andtest this change. Does this work any better than the while loop?

  Classes using set and get methods

Create a java program that contains two classes using set and get methods. I need the program to return the area and perimeter of a rectangle. I wrote a program and he returned to me saying I used the wrong constructors and didn't create a the sec..

  Accepts a string as its parameter and returns an integer

Write a method in java named secondHalfLetters that accepts a string as its parameter and returns an integer representing how many of letters in the string come from the second half of the alphabet

  Write a java application that calculates and displays

The application should ask the user to enter the name of the property owner and the assessed value of the property for each owner (total N owners) and calculate the property tax.

  Finding java code error

Indicate in the given code segment if an error occurs. If so, point to whether it is syntax, runtime or logic and how you would fix it.

  Java program the program has a page that shows the users

java program the program has a page that shows the users name and program name. a second jpanel that shows 4 buttons

  Write java program that writes names to text file

Create an empty text file called myfile.txt. Write a Java program that writes your names to the text file created. If the file does not exist, include an exception handler for that error.

  Write a class called rationalnumber

Write a class called RationalNumber that represents a fraction with an integer numerator and denominator.

  Java application which creates bank records

Write down a java application which creates 10000 bank records and the allow user ti enter a balance and customer account info. using a an account number.

  Java program which demonstrates cellular automata

Using the internet, locate a Java program (or Java applet) which demonstrates "Cellular Automata", in particular "the Game of Life".

  Create a project in eclipse

Create a new project

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