-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYT30.java
More file actions
65 lines (52 loc) · 1.39 KB
/
YT30.java
File metadata and controls
65 lines (52 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import java.io.*;
public class YT30
{
String title;
int year;
float rating;
public YT30()
{
title="";
year=0;
rating=0;
}
public void accept()throws IOException
{
InputStreamReader I = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(I);
System.out.println("Enter the movie title:");
title=br.readLine();
System.out.println("Enter the movie year:");
year=Integer.parseInt(br.readLine());
System.out.println("Enter the rating:");
rating=Float.parseFloat(br.readLine());
}
public void display()
{
System.out.println("RESULT: ");
System.out.println("Title: "+title);
System.out.println("Year: "+year);
if(rating>0.0 && rating<=2.0)
{
System.out.println("Flop");
}
else if(rating>2.1 && rating<=3.4)
{
System.out.println("Semi-hit");
}
else if(rating>3.5 && rating<=4.5)
{
System.out.println("Hit");
}
else
{
System.out.println("Super Hit");
}
}
public static void main(String[] args)throws IOException
{
YT30 M1 = new YT30();
M1.accept();
M1.display();
}
}