-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path28th_december_IPA_code.java
91 lines (85 loc) · 1.77 KB
/
28th_december_IPA_code.java
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
Movie[] movie=new Movie[4];
for(int i=0;i<4;i++)
{
String movieName=sc.nextLine();
String company=sc.nextLine();
String genre=sc.nextLine();
int budget=sc.nextInt();sc.nextLine();
movie[i]=new Movie(movieName,company,genre,budget);
}
String check=sc.nextLine();
Movie movie2[]= getMovieByGenre(movie,check);
for(int i=0;i<movie2.length;i++)
{
if(movie2[i].getBudget()<80000000)
{
System.out.println("Low Budget Movie");
}
else{
System.out.println("High Budget Movie");
}
}
}
public static Movie[] getMovieByGenre(Movie[] movie, String check){
Movie[] movie1=new Movie[0];
for(int j=0;j<4;j++)
{
if(movie[j].getGenre().equalsIgnoreCase(check))
{
movie1=Arrays.copyOf(movie1,movie1.length+1);
movie1[movie1.length-1]=movie[j];
}
}
return movie1;
}
}
class Movie
{
private String movieName;
private String company;
private String genre;
private int budget;
public Movie(String movieName,String company,String genre,int budget)
{
this.movieName=movieName;
this.company=company;
this.genre=genre;
this.budget=budget;
}
public String getMovieName()
{
return movieName;
}
public void setMovieName(String movieName)
{
this.movieName=movieName;
}
public String getCompany()
{
return company;
}
public void setCompany(String company)
{
this.company=company;
}
public String getGenre()
{
return genre;
}
public void setGenre(String genre)
{
this.genre=genre;
}
public int getBudget()
{
return budget;
}
public void setBudget(int budget)
{
this.budget=budget;
}
}