Java Programming

coding help needed

Page 1 of 1

2 Replies - 1217 Views - Last Post: 09 October 2005 - 07:19 PM Rate Topic: -----

#1 bahwow  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-October 05

Java Programming

Posted 09 October 2005 - 06:09 PM

Can someone show me how to code this assignment from the very beginning part ? I am quite lost as to how to compare strings and creating driver programs.


Create a Java class named Book that has the following attributes:

private String title = “” ;

private String authorLastName = “” ;

authorFirstName

publisher

copyrightDate (use an in YYYYMMDD format)

isbn

and the following two constructor methods:

public Book()

public Book( String title, String authorLastName, String authorFirstName, String publisher, int copyrightDate, String isbn )

The default constructor Book() must use the keyword “this” to invoke the constructor with all the attribute parameters.

and “set” and “get” methods for all of the attributes.:

plus an equals method and a toString method.

An “equals” methods returns a boolean value depending on whether two objects of a class are equal. It receives an object parameter, determines whether that object is a member of the class to which the invoking object beloongs, then uses criteria established by the class designer to determine whether two objects are equal.

Create a “driver” program to create an array objects of this class, set the values of their attributes, and display these values using toString(). Lastly compare two of these objects using equals.

Is This A Good Question/Topic? 0
  • +

Replies To: Java Programming

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Java Programming

Posted 09 October 2005 - 07:10 PM

A driver program, in this case, is nothing more than the program that will instantiate a couple of instances of the class...essentially, your main function?
Have you written a main function before?

As for the class itself, it is relatively easy to code up...have you made an attempt at it? We try not to give code for assignments without seeing the users attempt at it. Please post what you have, and we'd be glad to provide some guidance.
Was This Post Helpful? 0
  • +
  • -

#3 bahwow  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-October 05

Re: Java Programming

Posted 09 October 2005 - 07:19 PM

i started writing it and this is what i have so far. what do i put in to the empty parentheses? and what is my next step? i really don't have any idea what he is asking for.

public class Book
{
private string title = "";
private string lastName ="";
private string firstName = "";
private string publisher = "";
private java.util.Date copyrightDate;
private string isbn = "";


public Book ( )
{
this ( );
}

public Book (string title, lastName, firsrName, publisher, isbn, int copyrightDate)
{


}
}

public static void main(String [] arg)
{
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1