# Really need help on assignment

• January 6th, 2011, 11:25 PM
coorscollector
Really need help on assignment
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.
Code Java:

```public 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]; }     }```
Please someone help I am completely panicking right now :eek:
• January 6th, 2011, 11:56 PM
copeg
Re: Really need help on assignment
Sorry, but no one is going to do this for you. I suggest you make an attempt to complete the assignment and if you have a problem along the way post again with some code and specific questions with any and all errors in their entirety.
• January 16th, 2012, 06:08 PM
anonymous67905
Re: Really need help on assignment
Hmm.. why does this look oddly familiar? I suggest you start with carRentalCode because it's the simplest (I'd say about 10 minutes once you get where to start...)