Need help - newbie

From: Chris Woods (chris_at_woods-family.org)
Date: 03/15/04


Date: 14 Mar 2004 20:47:19 -0800

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());
        }
}



Relevant Pages

  • Need help with assignment
    ... I am very new to Java and I am having a problem with the following scripts. ... public class MovieTester ... location: class Movie ...
    (comp.lang.java.help)
  • Re: Need help with assignment
    ... > private String name; ... This is actually a constructor, ... > public class MovieTester ... > location: class Movie ...
    (comp.lang.java.help)
  • Re: Need help with assignment
    ... >>public Movie(String name, String type, int length, double productionCost) ... > This is actually a constructor, ... >>public class MovieTester ... > signature Movie(), i.e. with zero arguments. ...
    (comp.lang.java.help)
  • Biniding custom objects to DataRepeater
    ... public class Movie { ... // getters and setters ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: The Monkeys with the Big Orange Arses
    ... >Now that is a class movie. ... I don't generally watch movies because I do understand ... one thing I do know is any movie with a monkey of any kind ...
    (soc.culture.irish)