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


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Really need help on assignment

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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
               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
    Last edited by helloworld922; January 7th, 2011 at 12:54 AM.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default 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. #3
    Junior Member
    Join Date
    Jan 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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...)

Similar Threads

  1. Assignment
    By Polly2010 in forum Java Theory & Questions
    Replies: 3
    Last Post: November 30th, 2010, 03:42 PM
  2. please help me in my assignment :(
    By asdfg in forum What's Wrong With My Code?
    Replies: 5
    Last Post: May 18th, 2010, 07:59 AM
  3. need help on an assignment :(
    By gamfreak in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 23rd, 2010, 04:20 PM
  4. Replies: 1
    Last Post: February 22nd, 2010, 08:20 AM
  5. Need help with assignment
    By TonyL in forum Loops & Control Statements
    Replies: 2
    Last Post: February 20th, 2010, 09:44 PM