Here are the solutions to both problems:
Problem 1:
```java
import java.util.Scanner;
public class AirlineTicket {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the name of traveler: ");
String name = scanner.nextLine();
System.out.print("Enter the ticket price and the weight: ");
double ticketPrice = scanner.nextDouble();
int weight = scanner.nextInt();
double newPrice = weightPrice(weight, ticketPrice);
System.out.println("Dear " + name + ", your new balance is: $" + newPrice);
}
public static double weightPrice(int weight, double ticketPrice) {
if (weight < 30) {
double discount = 0.08 * ticketPrice;
return ticketPrice - discount;
} else if (weight >= 30 && weight <= 50) {
return ticketPrice;
} else {
double extraWeight = weight - 50;
double extraCost = 20 * extraWeight;
return ticketPrice + extraCost;
}
}
}
```
Problem 2:
```java
import java.util.Scanner;
public class LineChecker {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the coordinates (x,y) for point 1:");
int x1 = scanner.nextInt();
int y1 = scanner.nextInt();
System.out.println("Enter the coordinates (x,y) for point 2:");
int x2 = scanner.nextInt();
int y2 = scanner.nextInt();
System.out.println("Enter the coordinates (x,y) for point 3:");
int x3 = scanner.nextInt();
int y3 = scanner.nextInt();
System.out.println("Enter the coordinates (x,y) for point 4:");
int x4 = scanner.nextInt();
int y4 = scanner.nextInt();
double slopeAB = calculateSlope(x1, y1, x2, y2);
double slopeCD = calculateSlope(x3, y3, x4, y4);
System.out.println("Slope of Line (AB) = " + slopeAB);
System.out.println("Slope of Line (CD) = " + slopeCD);
if (slopeAB == slopeCD) {
System.out.println("Lines are parallel");
} else if (slopeAB * slopeCD == -1) {
System.out.println("Lines are perpendicular");
} else {
System.out.println("Lines are neither parallel nor perpendicular");
}
}
public static double calculateSlope(int x1, int y1, int x2, int y2) {
return (double) (y2 - y1) / (x2 - x1);
}
}
```
These programs should address the problems as described. If you
help with Java assignment and any further issues or need more clarification, feel free to ask There are resources online where you can find guidance for programming tasks, such as the one you're facing. You might consider exploring various programming forums or seeking help from online assignment help platforms like
ProgrammingHomeworkHelp.com to navigate through your challenges effectively.