Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2004

Tip: Looking for answers? Try searching our database.

Need help - newbie

Thread view: 
Chris Woods - 15 Mar 2004 05:47 GMT
I having problems with the my code, I am getting the following error:
----------
C:\Documents and Settings\Chris Woods\My
Documents\ICS140\Lab5\MovieTester.java:10: cannot resolve symbol
symbol  : constructor Movie ()
location: class Movie
        Movie nMovie = new Movie();
                              ^
1 error

Tool completed with exit code 1

---------
public class Movie
{
    // DATA FIELDS
        private String name;
        private String type;
        private int length;
        private double productionCost;

    // METHODS
        public Movie(String name, String type, int length, double
productionCost)
        {
            this.name = name;
            this.type = type;
            this.length = length;
            this.productionCost = productionCost;

        }

        public String getName()
        {
            return name;
        }

        public String getType()
        {
            return type;
        }

        public void setLength(int len)
        {
            length = len;
        }

        public void setProductionCost(double prod)
        {
            productionCost = prod;
        }

        public String toString()
        {
            return "Name " + name + " Genre " + type + " Length " + length +
"min" + " Production Cost: " + productionCost;
        }
}
----------
import javax.swing.*;

public class MovieTester

{
    public static void main(String[] args)
    {
        Movie nMovie = new Movie();

            String name = JOptionPane.showInputDialog("Movie Title");
            nMovie.getName();

            String type = JOptionPane.showInputDialog("Genre");
            nMovie.getType();

            String numStr = JOptionPane.showInputDialog("Length in minutes");
            int num = Integer.parseInt(numStr);
            nMovie.setLength(num);

            numStr = JOptionPane.showInputDialog("Production Cost");
            double num1 = Double.parseDouble(numStr);
            nMovie.setProductionCost(num1);

            JOptionPane.showMessageDialog(null, nMovie.toString());
    }
}
Jens - 15 Mar 2004 07:28 GMT
Call your constructor with arguments (name, type, lenght, production costs)
or add a constructor that takes no arguments in your Movie class.

> I having problems with the my code, I am getting the following error:
> ----------
[quoted text clipped - 81 lines]
> }
> }
Mark Haase - 16 Mar 2004 03:59 GMT
why are there so many posts these days where people just say "i'm having
a problem, fix it for me" and then post 3 pages of code?

learn to be self-sufficient people! come here with specific questions,
not your own work to pawn off on others

jeepers

|\/|  /|  |2  |<
mehaase(at)sas(dot)upenn(dot)edu


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.