Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Really need help on assignment

1. ## 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.
```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
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

2. ## 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.

3. ## 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...)