Search This Blog

Saturday 15 October 2016

JAVA program for rating movie(MOVIEMAGIC)

import java.io.*;
class moviemagic
{
    int year;
    String title;
    float rating;
    moviemagic()
    { year=0;
     title="";
     rating=0.00f;
    }
     void input() throws IOException
   
     {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("enter the movie name");
        title=br.readLine();
        System.out.println("enter the year of release");
        year = Integer.parseInt(br.readLine());
        System.out.println("enter the ratings of the movie");
        rating=Float.parseFloat(br.readLine());

    }
    void calculate ()
    {
        if(rating>=0.0 && rating <=2.0)
        {
            System.out.println("the m,ovie is flop");
          
        }
             else if(rating >=2.1&&rating<=3.4)
          {
             System.out.println("the m,ovie is semi hit");
            }  
            else if(rating >=3.5&&rating<=4.5)
           {     System.out.println("the m,ovie is hit");
           
            }   
            else if(rating >=4.6&& rating <=5.0)
        {  
           
            System.out.println("the m,ovie is blockbusterr");
               
               
               
               
            }
       
        }
        void display()
        {
         System.out.println("movie name\t"+"year\t"+"ratings");
         System.out.println(title+"\t"+year+"\t"+rating);
        }
     public static void main (String []args)  throws IOException
     {
         moviemagic obj= new moviemagic ();
         obj.input();
         obj.calculate();
         obj.display();
        
        }
    }

No comments:

Post a Comment

Make a JAVA program for a Toystore. This program suggest the toy based on the inputs users gives like age , gender , etc

 //editor used - IntelliJ IDEA package ToyStore; import javax.swing.*; import java.awt.event.*; import java.util.Scanner; //here you can edi...