Hey Guys I don't get what I need to add Im fairly new in Java.

this is my code but it gives me these below the line errors below

import javax.swing.*;

public class Movies
{
	private String name;
	private double price;
	private int year;
	
	public Movies
	{
		name="";
		price=0.0;
		year=0;
	}
	
	public Movies(String name,double price,Int year)
	{
		this.name = name;
		this.price = price;
		this.year =year;
		
	}
	
	string getname()
	{
		return name;
	}
	
	doube getprice()
	{
		return price;
	}	
	
	int getyear()
	{
		return year;
	} ;
}
	
	public void double adjust()
	{
		
		if(year<2000)
		price = price-(price*0.15);
		
		else if(year =<2005)
		price = price-(price*0.1);
		
		else if(year =<2009)
		price = price-(price*0.05);
		
	}

________________________________________________________________________________
C:\Program Files\Xinox Software\JCreator LE\MyProjects\Object.java:10: <identifier> expected
{
^
C:\Program Files\Xinox Software\JCreator LE\MyProjects\Object.java:40: 'class' or 'interface' expected
public void double adjustPrice()
^
2 errors

Process completed.

Recommended Answers

All 5 Replies

Extra }; after return year;
Missing () after public Movies

Please post code in code tags next time.

Like JamesCherril said, you have no parentheses on your default contrsuctor.
Also,

public void double adjust()
{

Can't be void and double at the same time. Void means the method takes no arguments

Void means the method takes no arguments

Small slip of the keyboard there? Void means the method returns no value.

Void means the method takes no arguments

void means the method returns no value

Small slip of the keyboard there? Void means the method returns no value.

Ha! That's what i originally had written. I just remember thinking about empty spaces when I read 'void' and I edited accordingly! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.