Home Answers Viewqa Java-Beginners movie class..(dr java)

 
 


ola
movie class..(dr java)
1 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners

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 Pages:
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
youtube movie
youtube movie  how to get you tube movie in java please help me for code thanks in advance raman
Movie clip in flex
Movie clip in flex  Hi... What is a MovieClip? IUIMovieClip? please give me an example. Thanks   Ans: MovieClip: The MovieClip class... be either a MovieClip object or extend from the MovieClip class. While ActionScript can
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
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
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
Class
Class, Object and Methods       Class : Whatever we can see in this world all the things... is termed as a class. All the objects are direct interacted with its class
Pyramid Multiplex Online movie ticket booking
Pyramid Multiplex Online movie ticket booking  Pyramid multiplex is setting up itsā?? online movie ticket booking to enhance the audience experience... to add movies for each theatre which contains movie name, star cast, director
Java class
Java class  What is the purpose of the Runtime class
Class
C:\roseindia>java Classtest It's a example of class... Class       This section explores the concept of a class in reference to object oriented programming
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
Explain final class, abstract class and super class.
Explain final class, abstract class and super class.  Explain final class, abstract class and super class.   Explain final class, abstract class and super class. A final class cannot be extended. A final class
class file
class file  how to convert java classfile into java sourcefile
super class
super class  which is the super base class in java
Nested class
Nested class  What is nested class?  when a class is defined within another class then such a class is called a nested class. Nested classes are a feature of Java that is included in jdk1.1. The reasons of why we use
abstract class
abstract class   Explain the concept of abstract class and it?s use with a sample program.   Java Abstract Class An abstract class is a class that is declared by using the abstract keyword. It may or may not have
Wrapper Class
Wrapper Class  what is wrapper class in java and why we use it   Hi Friend, Wrapper class is a wrapper around a primitive data type... as a Boolean class instance. All of the primitive wrapper classes in Java
Class Loader
;The Java ClassLoader is a an abstract class which extends the Object class. Java class loader is a part of the Java Runtime Environment that dynamically loads... a concept to understand when learning about class loaders. Libraries in java
Class Loader
;The Java ClassLoader is a an abstract class which extends the Object class. Java class loader is a part of the Java Runtime Environment that dynamically loads... a concept to understand when learning about class loaders. Libraries in java
abstract class
abstract class  what is abstract class .why we use it or what is the need of this class?   Abstract class is like base class which... the following links: http://www.roseindia.net/help/java/a/java-abstract-class.shtml
Abstract class
Abstract class  j   An Abstract class is a base class which...://www.roseindia.net/help/java/a/java-abstract-class.shtml http://www.roseindia.net/java/master-java/abstract-class.shtml
wrapper class.
wrapper class.  Write short note on character wrapper class.   Java Character Wrapper class The Character class wraps a value of the primitive type char in an object. An object of type Character contains a single field
robot class
provide the class Robot. It gives the java program much power. It can perform all... in the programming. where exactly robot class is useful. why is it necessary... of Java Automated Implementations. Thanks
Scanner class
; Here your code works fine..Which java version you are using? Actually Scanner class was introduced in java 5...Scanner class  import java.util.*; class Dd { public static void
Choose a class
Choose a class  Hi, I am working with java. I was wondering what to type in the start of a program so I can choose between all the classes in the program? How to choose to use only "class A" for example? Thanks for a quick
coolection class
max & min method of collection class   Here is an example of ArrayList which finds the maximum and minimum value element from the ArrayList. Java... class i.e max() and min() respectively. import java.util.*; class
Inner class
Inner class  when we use inner classed in java
Calculator class
for this generated file go to * Window - Preferences - Java - Code Style - Code Templates... type comment go to * Window - Preferences - Java - Code Style - Code Templates... class Calculator extends JFrame implements ActionListener { JTextField text
Class names don't identify a class - Java Tutorials
, The output of the above class is as, C:\>java -cp .;directory2...Class names don't identify a class In JDK 1.2 the Sum Microsystems have added a new feature that allows you to identify a class not only by its name
Java Class Size
Java Class Size  How to determine size of java class
java class - Java Beginners
java class  How to run a java class(Mail.java) automatically in tomcat server for a particular time
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 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 anonymous class
java anonymous class  Can an anonymous class be declared as implementing an interface and extending a class
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
Class Loader
; The Java ClassLoader is a an abstract class which extends the Object class. Java class loader is a part of the Java Runtime Environment that dynamically loads Java... to understand when learning about class loaders. Libraries in java are usually
class - Java Beginners
Class java.lang.nullpointerexception  When the class java.lang.nullpointerexception occurs
java class - Java Beginners
java class  Define a class product with the following data members 1.Product number int(Auto generated) 2.Product name char [20] 3.Price float... program to execute the above class ad functions for 5 products
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.