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();
}
}
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