You are viewing our Forum Archives. To view or take place in current topics click here.
Need Help With Java assignment.
Posted:

Need Help With Java assignment.Posted:

iDisAsTerxx
  • Christmas!
Status: Offline
Joined: Nov 02, 200915Year Member
Posts: 1,000
Reputation Power: 45
Status: Offline
Joined: Nov 02, 200915Year Member
Posts: 1,000
Reputation Power: 45
I am not the greatest with Java and I have an assignment for my class that deals with it. My teacher is not available to help me so I was hoping you were!
Here are the requirements for the assignment:

1.Take your first java program (or the one provided) and create a subclass called
<LastName><FirstName>_Last.java (THIS you will submit via blackboard).

2. The subclass defines a String variable called myLastName.

3. The subclass has a constructor which creates an instance and assigns your name to the variable myName and your last name to myLastName.

4. The subclass overwrites the void method called Hello to print myName and myLastName.

5. The class has a main method that creates an instance of your parent class and one of your child class and then calls the method Hello on both.

Here is the java code for the provided base of the java program:
/**
* HW7_DaddyClass
*
* This class is a starting point for students
* in HW7.
*
* @author Jorge Diaz
* @version 1
*/
public class HW7_DaddyClass
{
// instance variables
private String myName;

/**
* Constructor for objects of class HW7_DaddyClass
*/
public HW7_DaddyClass()
{
// initialise instance variables
myName = "Jorge";
}

/**
* Void method called Hello that prints myName
*
* @param y a sample parameter for a method
*/
public void Hello()
{
// put your code here
System.out.println(myName);
}

public static void main()
{
HW7_DaddyClass test = new HW7_DaddyClass();
test.Hello();
}
}
#2. Posted:
-Negan
  • TTG Senior
Status: Offline
Joined: Dec 20, 201311Year Member
Posts: 1,621
Reputation Power: 85
Status: Offline
Joined: Dec 20, 201311Year Member
Posts: 1,621
Reputation Power: 85
There are a few forums below that'll help you a lot more than the general population on TTG.
#3. Posted:
iDisAsTerxx
  • TTG Senior
Status: Offline
Joined: Nov 02, 200915Year Member
Posts: 1,000
Reputation Power: 45
Status: Offline
Joined: Nov 02, 200915Year Member
Posts: 1,000
Reputation Power: 45
-Negan wrote There are a few forums below that'll help you a lot more than the general population on TTG.

Alright thank you, I'll look. I was just in a rush that is why I posted here.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.