Results 1 to 4 of 4
  1. #1
    cmps280CD is offline Member
    Join Date
    Sep 2010
    Posts
    4
    Rep Power
    0

    Default CMPS280 hmwk help please

    I have some homework to do and I need some help. We use jgrasp to write our programs! Please let me know if you can help!!

    It consists of 4 problems. They are as follows

    1.)Make a class called HW0.java. In this class, write the following A method called print with an int parameter that prints the number to the screen using System.out
    A main method that calls the print method for the number 10 and 100.

    2.)Make a class called HW1.java. In this class, write the following:
    A method called doubleArray that has an int array as an input parameter and returns an int array in which each element has been doubled. In the main method, call this doubleArray method with input {2,5,8}. Print out the values of the array returned by the method. (This should be 4, 10, 16.)
    A method called max that has an int array as an input parameter and returns an int representing the largest value in the array. Test this method from the main method for the values {20,5,15,40}. Print the result.

    3.) Make a class called EX1.java. In this class, write the following:
    A method called getArea that has two double parameters called base and height. The method should return a double value that is the area of this triangle, which is 0.5 * base * height.
    In the main method, print the results of the getArea method for base 6, height 9 and base 5, height 5.

    4.) Make a class called Car.java. This class should have:
    An instance variable called year that is an int.
    An instance variable called name that is a String
    A constructor with parameters y and n, corresponding to the year and name. The constructor should assign y and n to the year and name variables.
    An instance method called print that prints the year and name of the Car using System.out.println.
    A main method that constructs a car with year 2010 and name "Mustang", then prints the car's information using the print method.

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    I shall simply answer your question with another question: Have you tried any of this yourself, or are you just hoping someone will do it for you?

    If you answered yes to the latter, you're at the wrong forum (you'd want to look for a rent-a-coder instead). If you genuinely want to learn your course material (which I recommend), then try each of those four components first. If you should happen to come across issues, feel free to ask for some help solving them.

    Just a quick note; if you need any help, make sure you've posted all the code in the project, any error message(s) you get (copied-and-pasted), and be specific in detailing the issue.

    Good luck!

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Agree with Zack as this is not the "do my homework for me" forum. My experience here is that if you show some effort you'll often get more help.

    Luck.

  4. #4
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    Start easy, dont get overwhelmed, start with : Make a class called HW0.java.

    Lets forget about any code just post a skeleton of a class called HW0 and we can start from there... no methods just a class called HW0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •