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