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 4 of 4

Thread: HELPPPP!!!

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default HELPPPP!!!

    True or false: A class provides a description of the layout of data values?

    A class provides a description of how object actions are performed?

    A class provides a description of how object actions are available?

    Each object has its own copy of instance variables defined in the corresponding class?

    A static method may access instance variables?

    An instance method may access static variables

    It is possible for two array variables to alias the same data

    It is possible for two double variables to alias the same data

    Why do we call a list an abstract data type whereas we call an array a data structure?

    Question one prizes to be won all all three what is the output of all three. Show work.


    Question 1:
    trace and describe whats happening...
    public class TestQuestionOne{

    public static void main(String[]args){

    int []data={5,2,6,1};
    int y=17;
    int z= y%10
    int temp= testMethod(y,z,data);

    for (int i=data.lenth; i>=0; i--)
    System.out.print(data[i]+ "");
    System.out.println(y+ ""+z++temp);
    }

    public static int testMethod(int x, int y, int a[]){
    int temp=x;
    for (int i=0; i<a.length; i++){
    temp-= a[i];
    }
    x-=y;
    y%= temp;
    int [] data= new int[3];
    data[1]=13;
    a=data;
    return y;
    }

    /////new question question 2 What is the output:

    public class TestQuestionTwo{
    public static double doesWhat(double x, int terms){
    if (terms==0) return 0;
    else if (terms ==1) return 1;
    else if (terms ==2) return 1-x;
    else return 1-z* doesWhat(x, terms/2);
    }
    public static void main(String[]args){
    System.out.println(doesWhat (2,13)0;
    }
    }


    Last question ! Extra prizes!

    Consider the following rectangle class:

    public class Rectangle {
    private int x;
    private int y;
    private int width
    private int height;
    private Rectangle (int xPos, int yPos, int w, int h){
    this.x = xPos; this.y=yPos; this.width=w; this.height=h;

    public String toString{
    String s="Rectangle Top left ("; s+- this.x + "," this.y +") Bottom Right =("; s += (this.x +this.width)+ "," (this.y+this.height)+ )"

    public void move to (int newX, int newY){
    this.x=newX; this.y= newY;
    }
    public boolean equals (Rectangle r)
    {

    **** create two rectangle objects
    one starting at location (3,3) and has height 8 and width 2
    the other starting at location (0,0) and has height 3 and width 2.
    moves the second rectangle to location to (9,9)
    Output each rectangle


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: HELPPPP!!!

    Where are your answers to these questions?

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: HELPPPP!!!

    OK, I've solved the questions. Now what -- how do I turn it in for a grade?

  4. #4
    Member
    Join Date
    Feb 2013
    Location
    earth
    Posts
    88
    Thanks
    12
    Thanked 9 Times in 9 Posts

    Default Re: HELPPPP!!!

    .

Similar Threads

  1. I'M ABOUT TO FAIL MY CLASS... PLEASE HELPPPP!!!!
    By redbull in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 13th, 2012, 04:38 AM
  2. [SOLVED] Helpppp meeeee, I am stuckkkk and probably going to get violent any minute!!!!
    By redbull in forum What's Wrong With My Code?
    Replies: 18
    Last Post: September 26th, 2012, 12:10 AM
  3. Game Program HELPPPP
    By nitwit3 in forum What's Wrong With My Code?
    Replies: 19
    Last Post: July 20th, 2011, 03:26 AM