In BlueJ, create a project called Lab6
Code for class LineSegment
public class LineSegment
{
private int x1;
private int y1;
private int x2;
private int y2;
public LineSegment()
{
}
public LineSegment(int x1, int y1, int x2, int y2)
{
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
}
public void setPoint1(int x, int y)
{
this.x1 = x;
this.y1 = y;
}
public void setPoint2(int x, int y)
{
this.x2 = x;
this.y2 = y;
}
public int getPoint1X()
{
return x1;
}
public int getPoint1Y()
{
return y1;
}
public int getPoint2X()
{
return x2;
}
public int getPoint2Y()
{
return y2;
}
//Prints the point in the format (x1, y1) to (x2, y2)
public void print()
{
System.out.print("(" + x1 + ", " + y1 + ") to (" + x2 + ", " + y2 + ")");
}
}
Once you have the class working
Code for class Main
import java.util.Scanner;
public class Main
{
public static Scanner kb = new Scanner(System.in);
public static void main(String [] args)
{
String input; // this variable used to allow the
// use to type Y or N when asked about
// changing point
// As you develop your program, add any variables
// you may need here
// Declare an object of the Line Segment class
// Use the constructor with no formal parameters
// You are to finish the rest of main to create the output given.
// This program will also have a method called enterLineSegmentEndPoints
// that allows the user to enter the end points of a line segment. The header
// for the method is given below main.
// Declare any variables you may need in the section above
// Some suggestions might be:
// First get the loop going that will continue asking if there is
// another line segment until the user types in anything other than Y
// Next get the method to enter the endpoints working - see output for formatting
// Then compute the length of the line segment using the method you wrote in the class
// Next for the quadrant, you might want to store the string returned from the method
// class and then check the first character to determine what to print
// Finally put in the code that will print the total number of line segments
// entered after the user indicates they are done.
// NOTE: Get little pieces to work at a time - do NOT type it all in at once
}
// Add the code to this method wrapper so that it allows the user to enter the
// end points of the line segments as shown on the output
public static void enterLineSegmentEndPoints(LineSegment line)
{
}
}
A sample output is given
Enter the x and y coordinate of the first end point: 2 9 Enter the x and y coordinate of the second end point: 14 6 Line Segment: (2, 9) to (14, 6) The length of the line segment is: 12.37 The line segment is completely in Quadrant 1 Would you like to enter another line segment (y/n): Y Enter the x and y coordinate of the first end point: -4 8 Enter the x and y coordinate of the second end point: -7 -3 Line Segment: (-4, 8) to (-7, -3) The length of the line segment is: 11.40 The line segment Crosses an Axis Would you like to enter another line segment (y/n): y Enter the x and y coordinate of the first end point: 3 -7 Enter the x and y coordinate of the second end point: 21 -14 Line Segment: (3, -7) to (21, -14) The length of the line segment is: 19.31 The line segment is completely in Quadrant 4 Would you like to enter another line segment (y/n): n You entered a total of 3 line segments
Information for finding Quadrants Information for finding distance ???????? ??????? ??? ?????? = √(?2 − ?1 ) 2 + (?2 − ?1 ) 2 You may also need the method in the Math class: Math.sqrt(num) and/or Math.pow(base, exponent)
In: Computer Science
Smitley and Davis studied the changes in gypsy moth egg mass density over one generation as a function of the initial egg mass density in a control plot and two treated plots. The data below are for the control plot.
| Initial Egg Mass (per 0.04 ha) | 50 | 75 | 100 | 160 | 175 | 180 | 200 |
| Change in Egg Mass Density (%) | 250 | -100 | -25 | -25 | -50 | 50 | 0 |
A. On the basis of the data given in the table, find the
best-fitting logarithmic function using least squares. State the
square of the correlation coefficient. (Note that the authors used
logarithms to the base 10.) (Use 4 decimal places in your
answers.)
y(x) =
r2 =
B. Use this model to estimate the change in egg mass density with
an initial egg mass of 120 per 0.04 ha. (Use 4 decimal places in
your answer.)
With an initial egg mass of 120 per 0.04ha, the change in mass
density is
%
In: Math
Describe how the general price level adjusted (GPLA) model accounts for changes in the general purchasing power of the reporting currency over time. 3 What are the strengths and weaknesses of the GPLA model?
MUST BE ORIGNAL WRITING!
In: Accounting
In: Operations Management
. Given the changes stated, predict new market equilibrium price and quantity demanded. For each question below, show your answer on a well-labeled supply-demand graph.
(a) Housing Market: There is a shortage of construction workers and, at the same time, mortgage rate
has increased substantially.
(b) Electronics Market: Government increased tariffs on foreign imports (i.e. foreign electronics products).
(c) Manufacturing labor market: Manufacturing companies rely more on robots and AIs in their production.
(d) Ice cream Market: Summer temperature reaches all-time high, and at the same time, price of dairy products (such
as milk) goes down substantially.
In: Economics
Compute the daily interest (yield) changes, ∆y = y(t) − y(t − 1), for the 10 year constant yields over time. Also, please show the calculations you use for the first 5 answers
| Date | 10 year Treasury Constant Maturity Rate | △Y |
| 2015-01-02 | 2.12 | |
| 2015-01-05 | 2.04 | |
| 2015-01-06 | 1.97 | |
| 2015-01-07 | 1.96 | |
| 2015-01-08 | 2.03 | |
| 2015-01-09 | 1.98 | |
| 2015-01-12 | 1.92 | |
| 2015-01-13 | 1.91 | |
| 2015-01-14 | 1.86 | |
| 2015-01-15 | 1.77 | |
| 2015-01-16 | 1.83 | |
| 2015-01-19 | #N/A | |
| 2015-01-20 | 1.82 | |
| 2015-01-21 | 1.87 | |
| 2015-01-22 | 1.90 | |
| 2015-01-23 | 1.81 | |
| 2015-01-26 | 1.83 | |
| 2015-01-27 | 1.83 | |
| 2015-01-28 | 1.73 | |
| 2015-01-29 | 1.77 | |
| 2015-01-30 | 1.68 | |
| 2015-02-02 | 1.68 | |
In: Finance
Burns Corporation's net income last year was $97,400. Changes in the company's balance sheet accounts for the year appear below:
| Increases (Decreases) |
|||
| Asset and Contra-Asset Accounts: | |||
| Cash and cash equivalents | $ | 22,700 | |
| Accounts receivable | $ | 13,800 | |
| Inventory | $ | (16,800 | ) |
| Prepaid expenses | $ | 4,400 | |
| Long-term investments | $ | 10,400 | |
| Property, plant, and equipment | $ | 71,400 | |
| Accumulated depreciation | $ | 32,600 | |
| Liability and Equity Accounts: | |||
| Accounts payable | $ | (19,400 | ) |
| Accrued liabilities | $ | 17,100 | |
| Income taxes payable | $ | 4,100 | |
| Bonds payable | $ | (64,800 | ) |
| Common stock | $ | 43,200 | |
| Retained earnings | $ | 93,100 | |
The company did not dispose of any property, plant, and equipment, sell any long-term investments, issue any bonds payable, or repurchase any of its own common stock during the year. The company declared and paid a cash dividend of $4,300.
Required:
a. Prepare the operating activities section of the company's statement of cash flows for the year. (Use the indirect method.)
b. Prepare the investing activities section of the company's statement of cash flows for the year.
c. Prepare the financing activities section of the company's statement of cash flows for the year.
In: Accounting
In each of the following balanced oxidation-reduction equations, identify those elements that undergo changes in oxidation number and indicate the magnitude of the change in each case.
2MnO4−(aq)+3S2−(aq)+4H2O(l)→3S(s)+2MnO2(s)+8OH−(aq)
4H2O2(aq)+Cl2O7(g)+2OH−(aq)→2ClO2−(aq)+5H2O(l)+4O2(g)
Ba2+(aq)+2OH−(aq)+H2O2(aq)+2ClO2(aq)→Ba(ClO2)2(s)+2H2O(l)+O2(g)
In: Chemistry
What changes in children’s school and other socialization experiences will enable girls to acquire different occupational skills? Please explain with sufficient detail.
What are the key biological, psychological, sociocultural, and life-cycle forces that should inform training programs concerning sexual harassment in the workplace? Please address this question with sufficient detail.
In: Psychology
1. Explain how changes are handled in Qatar construction projects. How is BOQ (Bill of Quantities) related to change order payment?
2. Explain if owner has direct relationship with the subcontractors. What happens if owner interferes into the work of the subcontractors.
In: Civil Engineering