0

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.

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

4
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by Akill10
0

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

Edited by Akill10: n/a

0

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! :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.