movie class..(dr java)

movie class..(dr java)

View Answers

November 27, 2009 at 3:41 PM

Hi Friend,

Try the following code:

import java.io.*;
import java.util.*;

public class movie{

private String movie_Title;
private String movie_Director;
private boolean watched_movie;
private String comment;
private int rating;


public movie(String movieTitle, String movieDirector,boolean watchMovie){

this.movie_Title = movieTitle;
this.movie_Director = movieDirector;
this.watched_movie = watchMovie;
this.comment = "";
this.rating = 0;

}
public String getMovie_Title(){
return movie_Title;
}
public String getMovie_Director(){
return movie_Director;
}
public boolean getWatched_movie(){
return watched_movie;
}


public static void main(String[]args) throws Exception{
ArrayList<movie> list=new ArrayList<movie>();
list.add(new movie("Kal Ho Na Ho","Karan Johar",true));
list.add(new movie("Jab We Met","Imtiaz Ali",true));
list.add(new movie("Taare Zamin Par","Aamir Khan",true));
list.add(new movie("DDLJ","Aditya Chopra",true));
list.add(new movie("Bhoot","Ram Gopal Verma",false));
File file = new File("C:\\movie.txt");
FileWriter fstream = new FileWriter(file,true);
BufferedWriter out = new BufferedWriter(fstream);

for (movie s : list){
if(s.getWatched_movie()==true){
System.out.println("Movie: "+s.getMovie_Title());
System.out.println("Directed by: "+s.getMovie_Director());
System.out.println("Your Comments: ");
Scanner input=new Scanner(System.in);
String com=input.nextLine();
System.out.println("Your Ratings: ");
int rate=input.nextInt();
String st=Integer.toString(rate);
out.write(s.getMovie_Title()+" "+s.getMovie_Director()+" "+com+" "+st);
out.newLine();

}
}
out.close();
}
}

Thanks









Related Tutorials/Questions & Answers:
movie class..(dr java) - Java Beginners
movie class..(dr java)  hi there.....am about to create a movie class... java.util.ArrayList; public class movie { private String movie_Title; private... the following code: import java.io.*; import java.util.*; public class movie
Movie and Cinema class - Java Beginners
Movie and Cinema class  Hi, I'm new in java. Can someone help me...: Question: 1. Create a new Movie class which has two properties, title... need your help please. //Movie class public class Movie { String
Advertisements
Need to push the combo box to flash movie - Java Beginners
Need to push the combo box to flash movie   Hi, I need to push the combo box values to the flash movie. I am succusfull in pushing the textfield using some pushand getMovie methods in java scripts and HTML[here we enter
youtube movie
youtube movie  how to get you tube movie in java please help me for code thanks in advance raman
Java Create a file that contains your favorite movie quote
Java Create a file that contains your favorite movie quote  Create a file that contains your favorite movie quote. Use a text editor such as Notepad... the user to enter the favorite movie quote. Then write it into the text file and Copy
Java class
Java class  What is the purpose of the Runtime class
ModuleNotFoundError: No module named 'movie'
ModuleNotFoundError: No module named 'movie'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'movie' How to remove the ModuleNotFoundError: No module named 'movie'
Movie clip in flex
Movie clip in flex  Hi... What is a MovieClip? IUIMovieClip? please...: The MovieClip class inherits from the following classes: Sprite... a timeline must be either a MovieClip object or extend from the MovieClip class. While
java class
java class  write a java program to display a msg "window closing" when the user attempts to close the window.(a) create a window class (b) create frame within the window class (c) extends window adapter class to display the msg
java class
java class  please send me the answer of the question which i have send according of java class assoon as possible . Write a java program to display.... a. Create a window class. b. Create frame within the window class. c. Extend
MovieRating class - Java Beginners
the movie rating. 12.Create a MovieRating class that contains a private map... class to determine whether the child can watch the movie. 14.Add... minimum age allowed to watch movie rated PG *from MovieRating class
Java inner class and static nested class
Java inner class and static nested class  Java inner class and static nested class
ModuleNotFoundError: No module named 'douban-movie'
ModuleNotFoundError: No module named 'douban-movie'  Hi, My Python... 'douban-movie' How to remove the ModuleNotFoundError: No module named 'douban-movie' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'modulo_movie'
ModuleNotFoundError: No module named 'modulo_movie'  Hi, My Python... 'modulo_movie' How to remove the ModuleNotFoundError: No module named 'modulo_movie' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'movie_list'
ModuleNotFoundError: No module named 'movie_list'  Hi, My Python... 'movie_list' How to remove the ModuleNotFoundError: No module named 'movie_list' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'movie_renamer'
ModuleNotFoundError: No module named 'movie_renamer'  Hi, My... 'movie_renamer' How to remove the ModuleNotFoundError: No module named 'movie_renamer' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'movie-search'
ModuleNotFoundError: No module named 'movie-search'  Hi, My Python... 'movie-search' How to remove the ModuleNotFoundError: No module named 'movie-search' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'movie-searcher'
ModuleNotFoundError: No module named 'movie-searcher'  Hi, My... named 'movie-searcher' How to remove the ModuleNotFoundError: No module named 'movie-searcher' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'movie_collection'
ModuleNotFoundError: No module named 'movie_collection'  Hi, My... named 'movie_collection' How to remove the ModuleNotFoundError: No module named 'movie_collection' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'movie-crawl'
ModuleNotFoundError: No module named 'movie-crawl'  Hi, My Python... 'movie-crawl' How to remove the ModuleNotFoundError: No module named 'movie-crawl' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'movie-down'
ModuleNotFoundError: No module named 'movie-down'  Hi, My Python... 'movie-down' How to remove the ModuleNotFoundError: No module named 'movie-down' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'movie-dylan'
ModuleNotFoundError: No module named 'movie-dylan'  Hi, My Python... 'movie-dylan' How to remove the ModuleNotFoundError: No module named 'movie-dylan' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'movie-info'
ModuleNotFoundError: No module named 'movie-info'  Hi, My Python... 'movie-info' How to remove the ModuleNotFoundError: No module named 'movie-info' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'movie_list'
ModuleNotFoundError: No module named 'movie_list'  Hi, My Python... 'movie_list' How to remove the ModuleNotFoundError: No module named 'movie_list' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'Movie_Nester'
ModuleNotFoundError: No module named 'Movie_Nester'  Hi, My Python... 'Movie_Nester' How to remove the ModuleNotFoundError: No module named 'Movie_Nester' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'movie_renamer'
ModuleNotFoundError: No module named 'movie_renamer'  Hi, My... 'movie_renamer' How to remove the ModuleNotFoundError: No module named 'movie_renamer' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'movie-search'
ModuleNotFoundError: No module named 'movie-search'  Hi, My Python... 'movie-search' How to remove the ModuleNotFoundError: No module named 'movie-search' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'movie-searcher'
ModuleNotFoundError: No module named 'movie-searcher'  Hi, My... named 'movie-searcher' How to remove the ModuleNotFoundError: No module named 'movie-searcher' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'douban-movie'
ModuleNotFoundError: No module named 'douban-movie'  Hi, My Python... 'douban-movie' How to remove the ModuleNotFoundError: No module named 'douban-movie' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'guess-the-movie'
ModuleNotFoundError: No module named 'guess-the-movie'  Hi, My... named 'guess-the-movie' How to remove the ModuleNotFoundError: No module named 'guess-the-movie' error? Thanks   Hi, In your python
Java Class Size
Java Class Size  How to determine size of java class
Java inner class
Java inner class  What are inner class and anonymous class
class method in java
class method in java  How to write a class method in Java?   You must read Java - Class, Object and Methods in Java
Java dictionary class
Java dictionary class  What is the Dictionary class
Java adapter class
Java adapter class  What is adapter class
Example of HashMap class in java
Example of HashMap class in java. The HashMap is a class in java collection framwork. It stores values in the form of key/value pair. It is not synchronized
Java class file
Java class file  How do i open a java class file using eclipse
java anonymous class
java anonymous class  Can an anonymous class be declared as implementing an interface and extending a class
Java nested class example
Java nested class example  Give me any example of Nested Class.   Nested Class: Class defined within another class is called nested class. Nested class is divided into two parts- 1.Static 2.Non-static Static
java object class methods
java object class methods  What are the methods in Object class?  There are lots of methods in object class. the list of some methods are as- clone equals wait finalize getClass hashCode notify notifyAll
converting java class to java fx class
converting java class to java fx class   i am working on a java project which would convert text to speech and speech to text. i have developed a java file that would work for text to speech. it is working fine as a .java file
Java System class
Java System class  What is the purpose of the System class
abstact class - Java Beginners
abstact class  write a java program to implement an animal abstact class
Java math class
Java math class  Can you instantiate the Math class
java Math class
java Math class  Why are the methods of the Math class static
Java file class
Java file class  What is the purpose of the File class
Java abstract class
Java abstract class  Can an abstract class be final
What is Calendar class in Java?
What is Calendar class in Java?  Hi, What is Calendar class in Java? I want to learn about this class to make use of it in Java programs. Thanks   Hi, java.util.Calendar is an abstract class in Java and its static
java class - Java Beginners
java class  How to run a java class(Mail.java) automatically in tomcat server for a particular time
Abstract class and interface in Java
Abstract class and interface in Java  What is the difference between abstract class and interfaces in Java?   Differences between an interface and an abstract class: At the same time multiple interfaces can

Ads