I am a high school student and my I have to finish a lab by tomorrow. I would normally try to figure this out for myself however I am also studying for a AP European History exam, a chemistry exam, and working on an analysis for English. Basically I am swamped and completely panicking right now. It would really help if one of the programmers here could give me the code for the problems below.
Please someone help I am completely panicking right nowpublic class MiscCollectionOfFunMethodsII { public static String carRentalCode(String licensePlate) { // precondition: licensePlate is a valid plate as described at // [url]http://www.apcomputerscience.com/syllabus/la3_carRental.pdf[/url] // postcondition: return the car rental code for the licensePlate as described above int i = licensePlate.charAt(0)+licensePlate.charAt(1); return ""+i; } public static double[] magicSquares(int n) { // A magic square is a number that is both a perfect square, and the sum of consecutive // integers starting with 1. For example, 36 is a magic square, since 6 * 6 = 36, // and 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 36 // precondition: n is a positive integer // postcondition: return a vector whose size is exactly n // and contains, in order, the first n magic squares // The first Magic square is 1 return new double[2]; } public static int uglyNumberGetter(int n) { // precondition: n >= 1 (but not too big as to make it impossible to get the nth ugly number // I don’t know what that is yet but I won’t let it get that big) // look here: [url=http://acm.uva.es/problemset/v1/136.html]Ugly Numbers[/url] // Ugly numbers are numbers whose only prime factors are 2, 3 or 5 // postcondition: return the nth ugly number return -13121; } public static void compact (Object[] vec, Object item) { // precondition: vec contains objects; vec.length >= 1 // postcondition: all elements x in vec, s.t. x.equals(item) have been “removed”. // all remaining elements are in their same original relative order and are at the // beginning of vec the remaining locations at the end of the vec should be explicitly // set to null // put code here } public static int[ ] primeNumberGenerator(int from, int to) { // precondition: from <= to <= 10,000,000 // postcondition: a 2-element vector of ints is returned, // where location 0 contains the number of primes in the given range and // location 1 contains the last prime generated in the given range // If from && to are prime, they count as primes (inclusive range) return new int[2]; } }