Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


ola
movie class..(dr java)
1 Answer(s)      5 years and a month ago
Posted in : Java Beginners



Advertisement
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
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
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
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
Java Class Size
Java Class Size  How to determine size of java class
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 class - Java Beginners
java class  How to run a java class(Mail.java) automatically in tomcat server for a particular time
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
Java class file
Java class file  How do i open a java class file using eclipse
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 file class
Java file class  What is the purpose of the File class
abstact class - Java Beginners
abstact class  write a java program to implement an animal abstact class
Java System class
Java System class  What is the purpose of the System class
Java abstract class
Java abstract class  Can an abstract class be final
java Math class
java Math class  Why are the methods of the Math class static
Java math class
Java math class  Can you instantiate the Math class
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
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
Advertisements
 

 

 

DMCA.com