Dan Taylor

Greenhorn
+ Follow
since Apr 16, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dan Taylor

thank you, these are the suggestions I was looking for - I have been searching but search results can be so vast and varied that I just needed a good place to start.
8 years ago
in 2003 I took 2 semesters of Java. I also took VB.Net and C++. Last year I took courses on Python, Java, and C#. I am currently studying for my OCA Java SE 7 assoc cert.

I am 22 credits away from graduating with a degree in Software Dev. My problem is that I don't retain much of anything in regards to programming languages once I complete a course. I need a resource, a website, something that I can use daily to practice skills learned and pick up new ones. I have over 30 years experience with PCs - I learned BASIC on an Apple II in 1981. I am not as sharp a tack as I used to be and I need a little muscle memory for all the syntax.

Any suggestions?

Thanks
Dan
8 years ago
I am a newbie to JSP and frankly I don't know how to do much with it. I recently completed a semester learning Java but we didn't cover servlets, beans, or JSP.

I need some simple instructions to perform a simple task in a JSP page.

I am being supplied an XML document and I need to generate an HTML report from the data contained in it.

My question is how do I get the data from the XML doc into my JSP page?

I have been trying to find a good resource but everything seems to point to custom tag libraries to JSTL and other things that I am completely unfamiliar with. This seems like it would be a simple process of pointing my JSP to the XML doc somehow and using the XML field tags as variables.

second, once I have figured out how to all that, how do I get it to pull the info multiple times to create a table of information.

I hope this is simple and I am not asking a lot of anyone. I have a week to figure this out, code it and test it. Below is a copy of the sample XML I was provided:



thanks
Dan
[ May 24, 2004: Message edited by: Bear Bibeault ]
20 years ago
JSP
Any takers on this one? Please??
20 years ago
OK the classes A and B were defined by my teacher. They are actually classes Person and Employee. Someone else has posted in this forum from my class so I wanted to avoid posting code. The class I defined is SalesEmployee.
Below is the Person class (the comments are from the teacher to the class):

Here is the teacher defined Employee class with her comments:

Lastly this is my code for SalesEmployee class:


Thanks all
20 years ago
OK
I don't understand why I get a can't resolve symbol on my constructors.
Here is the basics of my code
3 classes -
1st class 'A' is abstract
has a default empty constructor and a constructor with A's attributes
ex:
public A( int getX )
{ this.x = getX; }

2nd class B extends A
and has default empty constructor (with a call to super()) and a constructor that calls A's constructor and adds B's attributes
ex:
public B( int getX, int getY)
{
super( getX );
this.y = getY;
}
OK so far so good, these files with their attributes and methods compile.
Now I add class 'C'.
I follow the same format as above creating 2 constructors, a default calling super(); and another that takes the B constructor and adds C's attributes.
When I try to compile I get the following error:

I also get this error on the second constructor. I don't understand why this is happening. Any help would be appreciated.
Thanks
Dan
20 years ago
Thanks
I actually figured that out late last night.
Dan
20 years ago
I get an error stating that 'void cannot be dereferenced'
20 years ago
I have determined that I can execute
System.out.println(salesEmployee.getCompany().getName());
And it works
So my getCompany() method works inside the salesEmployee object but my setCompany() method gives me the error I mentioned in the last post. My setCompany() code is listed in the Employee class file snippet listed in my first post.
20 years ago
Radha
thanks that solved the constructor in the Employee class. How would I instantiate the object?
I tried this:

But I get this build error

[ April 16, 2004: Message edited by: Dan Taylor ]
20 years ago
Ok I tried that before and I just tried it again. I get an error when I try to build the Employee Class. Below is a snippet of what I did to the Employee constructor. All other code has remained unchanged:
public Employee(String inFirstName, String inLastName, short inSeniority,
double inBaseSalary, String inAddress, String inCity,
String inState, String inZip, Company inCompany)
{
firstName = inFirstName;
lastName = inLastName;
seniority = inSeniority;
baseSalary = inBaseSalary;
address = inAddress;
city = inCity;
state = inState;
zip = inZip;
inCompany = new Company(String inName, String inAddress, String inCity, String inState, String inZip);
}
I get 2 errors

This is driving me nuts. I am taking a Java course and I haven't had any problems with any assignment till now. Thanks
Dan
[ April 16, 2004: Message edited by: Dan Taylor ]
[ April 16, 2004: Message edited by: Dan Taylor ]
20 years ago
I am new to this forum and I am desperate
I am going batty with what must be a simple problem.
I have a Company class and an Employee class. I also have a Project class that contains main() and instantiates the constructors of Company and Employee. From Project I can successfully get and set values of the private variables of the Company and Employee class. What I cannot figure out how to do is create a constructor and instantiate the constructor so that I can create a Company object within the Employee class.
Below is a snippet of the Company class:
public class Company
{ //beginning of Company class

//declare private variables and initialize values to empty strings
private String name = "";
private String address = "";
private String city = "";
private String state = "";
private String zip = "";

//constructor method
public Company()
{
}

public Company(String inName, String inAddress, String inCity,
String inState, String inZip)
{
name = inName;
address = inAddress;
city = inCity;
state = inState;
zip = inZip;
}

//define accessor methods for private local variables
public String getName()
{
return name;
}

public String getAddress()
{
return address;
}

public String getCity()
{
return city;
}

public String getState()
{
return state;
}

public String getZip()
{
return zip;
}
//end accessor methods

//begin mutator methods for private local variables
public void setName(String inName)
{
name=inName;
}

public void setAddress(String inAddress)
{
address=inAddress;
}

public void setCity(String inCity)
{
city=inCity;
}

public void setState(String inState)
{
state=inState;
}

public void setZip(String inZip)
{
zip=inZip;
}
//end mutator methods


} //end of Company class
Here is a snippet of the Employee Class:
public class Employee
{ //begin Employee class

//declare private variables and initialize values
private String firstName = "";
private String lastName = "";
private short seniority = 0;
private double baseSalary = 500.0;
private String address = "";
private String city = "";
private String state = "";
private String zip = "";
private Company company;

//constructor methods

public Employee(String inFirstName, String inLastName, short inSeniority,
double inBaseSalary, String inAddress, String inCity,
String inState, String inZip, Company inCompany)
{
firstName = inFirstName;
lastName = inLastName;
seniority = inSeniority;
baseSalary = inBaseSalary;
address = inAddress;
city = inCity;
state = inState;
zip = inZip;
company = inCompany;
}


//define accessor methods for private local variables
public String getFirstName()
{
return firstName;
}

public String getLastName()
{
return lastName;
}

public String getAddress()
{
return address;
}

public String getCity()
{
return city;
}

public String getState()
{
return state;
}

public String getZip()
{
return zip;
}

public short getSeniority()
{
return seniority;
}

public double getBaseSalary()
{
return baseSalary;
}

public Company getCompany()
{
return company;
}

//end accessor methods

//begin mutator methods for private local variables
public void setFirstName(String inFirstName)
{
firstName=inFirstName;
}

public void setLastName(String inLastName)
{
lastName=inLastName;
}

public void setAddress(String inAddress)
{
address=inAddress;
}

public void setCity(String inCity)
{
city=inCity;
}

public void setState(String inState)
{
state=inState;
}

public void setZip(String inZip)
{
zip=inZip;
}

public void setSeniority(short inSeniority)
{
seniority=inSeniority;
}
public void setBaseSalary(double inBaseSalary)
{
baseSalary=inBaseSalary;
}

public void setCompany(Company inCompany)
{
company = inCompany;
}

//end mutator methods
}//end Employee class
Now what I would like to do in Project is instantiate a Company object inside an Employee object so that I could do the following:
//create new Employee object
//this is obviously wrong, but I can figure out what to do, empCompany is
//supposed to instantiate a Company object and all its arguments

Employee salesEmployee = new Employee(empFirstName, empLastName,
empSeniority, empBaseSalary, empAddress, empCity, empState, empZip, empCompany);
salesEmployee.setCompany().setName();
salesEmployee.getCompany().getName();
Thanks in advance. If this is unclear it is due to no sleep in 48 hours, please just ask if you need clarification
Thanks
Dan
20 years ago