Hey guys, the following problems are my graded homework assignment. If any of you could help me that would be great. The code must be in java.
Thank you!
________________________
Problem 1:
problem 2:
Recall that the polygon class has a constructor that takes three parameters:
Polygon(int[] x, int[] y, int npoints)
Write a method that creates and returns a random triangle.
The x and y coordinates should satisfy:
5 <=x <=400, 50 <= y<= 500
Problem 3:
Write a method to help you figure out how to split the bill with your friends at a restaurant, A probram like this would be nice to have on a PDA or pocket PC. The program takes as input the total bill and the number of peopel who will split the bill. It adds a 15% tip and then outputs the amount of each person should pay. (tax is already included in mealCost)
Thank you!
________________________
Problem 1:
Code:
/**
counts how many values in an array are over 100.
returns the number of entries over 100 in the array.
*/
public int over100(int[] list){
(insert code here)
}
problem 2:
Recall that the polygon class has a constructor that takes three parameters:
Polygon(int[] x, int[] y, int npoints)
Write a method that creates and returns a random triangle.
The x and y coordinates should satisfy:
5 <=x <=400, 50 <= y<= 500
Code:
public Polygon randomTriangle()
{
(insert code here)
}
Problem 3:
Write a method to help you figure out how to split the bill with your friends at a restaurant, A probram like this would be nice to have on a PDA or pocket PC. The program takes as input the total bill and the number of peopel who will split the bill. It adds a 15% tip and then outputs the amount of each person should pay. (tax is already included in mealCost)
Code:
public static double divideBill(double mealCost, int numPeople)
{
(insert code here)
}