• Support PF! Buy your school textbooks, materials and every day products Here!

Java Method Call Problems

  • Comp Sci
  • Thread starter iamjon.smith
  • Start date
  • #1
117
3
/*
* Use Ticket as the superclass. WillCall, eDelivered, and Printed are subclasses Ticket.
* All tickets have event name, date, time, event location, and ticket cost.
* WillCall tickets have booth location attribute.
* eDelivered has an email address attribute.
* Printed has a mailing address.
*
* Write a test application that instantiates at least one of each subclass type and prints the contents.
* Use an overridden toString() method to provide a readable string representation of each subclass instantiated.
*/


When I try to call the methods (Printed, eDelivered, and WillCall) I get the error:

cannot find symbol
symbol: constructor Printed(paramaters)
location: projectname.Printed

and this same error appears in all 3 method calls. the code is as follows:

Main Class
Code:
/*
 * Use Ticket as the superclass. WillCall, eDelivered, and Printed are subclasses Ticket.
 * All tickets have event name, date, time, event location, and ticket cost.
 * WillCall tickets have booth location attribute.
 * eDelivered has an email address attribute.
 * Printed has a mailing address.
 *
 * Write a test application that instantiates at least one of each subclass type and prints the contents.
 * Use an overridden toString() method to provide a readable string representation of each subclass instantiated.
 */

package ph1ipticket;

/**
 *
 * @author Jon and Jessica
 *
 * Instantiate all 3 classes, Printed, eDelivered, and willCall
 * Be sure to call toString() on all 3 object
 */
public class ticketTest {

    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

       Printed printed = new Printed("Learning Java Techniques Seminar", "January 17, 2011", "12:00:00 a.m.", "Colorado Technical University Online",
               1,500.00, 1800, "Grant Street", "Denver", "CO", 80203);

               System.out.println(printed.toString());

       eDelivered edelivered = new eDelivered("Learning Java Techniques Seminar", "January 17, 2011", "12:00:00 a.m.", "Colorado Technical University Online",
               1,500.00, "javaSeminar@CTUonline.edu" );

               System.out.println(edelivered.toString());

        WillCall willCall = new WillCall ("Learning Java Techniques Seminar", "January 17, 2011", "12:00:00 a.m.", "Colorado Technical University Online",
               1,500.00, "Main Entrance, Suite 800");

               System.out.println(willCall.toString());
         
    }

   }
Super Class (Tickets)

Code:
 /*
 * Use Ticket as the superclass. WillCall, eDelivered, and Printed are subclasses Ticket.
 * All tickets have event name, date, time, event location, and ticket cost.
 * WillCall tickets have booth location attribute.
 * eDelivered has an email address attribute.
 * Printed has a mailing address.
 *
 * Write a test application that instantiates at least one of each subclass type and prints the contents.
 * Use an overridden toString() method to provide a readable string representation of each subclass instantiated.
 */

package ph1ipticket;



public class Tickets {

    protected String eventName;
    protected String eventDate;
    protected String eventTime;
    protected String eventLocation;
    protected double ticketCost;

    public Tickets(String eventName, String eventDate, String eventTime, String eventLocation, double ticketCost) {
        this.eventName = eventName;
        this.eventDate = eventDate;
        this.eventTime = eventTime;
        this.eventLocation = eventLocation;
        this.ticketCost = ticketCost;
    }

    public Tickets () {
    }

    public String getEventDate () {
        return eventDate;
    }

    public void setEventDate (String val) {
        this.eventDate = val;
    }

    public String getEventLocation () {
        return eventLocation;
    }

    public void setEventLocation (String val) {
        this.eventLocation = val;
    }

    public String getEventName () {
        return eventName;
    }

    public void setEventName (String val) {
        this.eventName = val;
    }

    public String getEventTime () {
        return eventTime;
    }

    public void setEventTime (String val) {
        this.eventTime = val;
    }

    public double getTicketCost () {
        return ticketCost;
    }

    public void setTicketCost (double val) {
        this.ticketCost = val;
    }
    
    public String toString() {

            return ("eventName= " + eventName +
                   "eventDate= " + eventDate +
                   "eventTime= " + eventTime +
                   "eventLocation= " + eventLocation +
                   "ticketCost= " + ticketCost);
    }
}
Supporting subClasses (Printed, eDelivered, WillCall)

Printed

Code:
 /*
 * Use Ticket as the superclass. WillCall, eDelivered, and Printed are subclasses Ticket.
 * All tickets have event name, date, time, event location, and ticket cost.
 * WillCall tickets have booth location attribute.
 * eDelivered has an email address attribute.
 * Printed has a mailing address.
 *
 * Write a test application that instantiates at least one of each subclass type and prints the contents.
 * Use an overridden toString() method to provide a readable string representation of each subclass instantiated.
 */

package ph1ipticket;


public class Printed extends Tickets {

    private int streetNumber;
    private String streetName;
    private String City;
    private String State;
    private int zipCode;

    public Printed(String eventName, String eventDate, String eventTime, String eventLocation, double ticketCost, int streetNumber, String streetName, String City, String State, int zipCode) {
        super(eventName, eventDate, eventTime, eventLocation, ticketCost);
        this.streetNumber = streetNumber;
        this.streetName = streetName;
        this.City = City;
        this.State = State;
        this.zipCode = zipCode;
    }

     public String toString(){
        return (super.toString() +  "Address= "+ streetNumber + " "+ streetName + "\n " + City + ", " + State + "   " + zipCode + "\n");
    }
     public String getCity () {
        return City;
    }

    public void setCity (String val) {
        this.City = val;
    }

    public String getState () {
        return State;
    }

    public void setState (String val) {
        this.State = val;
    }

    public int getStreetNumber () {
        return streetNumber;
    }

    public void setStreetNumber (int val) {
        this.streetNumber = val;
    }

   public String getStreetName () {
        return streetName;
    }

   public void setStreetName (String val) {
        this.streetName = val;
    }

    public int getZipCode () {
        return zipCode;
    }

    public void setZipCode (int val) {
        this.zipCode = val;
    }

}
eDelivered

Code:
/*
 * Use Ticket as the superclass. WillCall, eDelivered, and Printed are subclasses Ticket.
 * All tickets have event name, date, time, event location, and ticket cost.
 * WillCall tickets have booth location attribute.
 * eDelivered has an email address attribute.
 * Printed has a mailing address.
 *
 * Write a test application that instantiates at least one of each subclass type and prints the contents.
 * Use an overridden toString() method to provide a readable string representation of each subclass instantiated.
 */

package ph1ipticket;


public class eDelivered extends Tickets {

    private String emailAddress;

    public eDelivered(String eventName, String eventDate, String eventTime, String eventLocation, double ticketCost, String emailAddress) {
        super(eventName, eventDate, eventTime, eventLocation, ticketCost);
        this.emailAddress = emailAddress;
    }

    public String toString(){
        return (super.toString() +  "emailAddress= "+ emailAddress);
    }

   
    public String getEmailAddress () {
        return emailAddress;
    }

    public void setEmailAddress (String val) {
        this.emailAddress = val;
    }

}
WillCall

Code:
/*
 * Use Ticket as the superclass. WillCall, eDelivered, and Printed are subclasses Ticket.
 * All tickets have event name, date, time, event location, and ticket cost.
 * WillCall tickets have booth location attribute.
 * eDelivered has an email address attribute.
 * Printed has a mailing address.
 *
 * Write a test application that instantiates at least one of each subclass type and prints the contents.
 * Use an overridden toString() method to provide a readable string representation of each subclass instantiated.
 */

package ph1ipticket;


public class WillCall extends Tickets {

    private String boothLocation;

    public WillCall(String eventName, String eventDate, String eventTime, String eventLocation, double ticketCost, String boothLocation) {
        super(eventName, eventDate, eventTime, eventLocation, ticketCost);
        this.boothLocation = boothLocation;
    }

    public String toString(){
        return (super.toString() +  "Booth Location= "+ boothLocation);
    }

    public String getBoothLocation () {
        return boothLocation;
    }

    public void setBoothLocation (String val) {
        this.boothLocation = val;
    }

}
Can someone please explain why my method calls are not working, I have the constructors in place, and everything seems right to me, but I must be overlooking something simple.

Homework Statement





Homework Equations





The Attempt at a Solution

 

Answers and Replies

  • #2
117
3


A parameter in each of the method calls was off just a bit. I went back through and rewrote the parameters to correctly match the method itself and now it works correctly. NO FURTHER ACTION REQUIRED. THIS THREAD MAY NOW BE CLOSED.
 

Related Threads for: Java Method Call Problems

Replies
1
Views
2K
Replies
5
Views
1K
  • Last Post
Replies
23
Views
3K
  • Last Post
Replies
11
Views
657
  • Last Post
Replies
23
Views
4K
  • Last Post
Replies
0
Views
2K
Replies
1
Views
1K
Replies
0
Views
5K
Top