This repository has been archived by the owner on Mar 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lab_exam.java
100 lines (95 loc) 路 2.47 KB
/
lab_exam.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
92
93
94
95
96
97
98
99
100
import java.util.Scanner;
interface Movies
{
void displayDetails();
int getNumberofMovies();
void displayCatagory();
}
class ActionMovies implements Movies
{
static int i = 0;
static int numberofactionmovies;
double id;
String catagory;
String title;
String studio;
double rating;
public ActionMovies(double id, String catagory, String title, double rating, String studio)
{
this.id = id;
this.catagory = catagory;
this.title = title;
this.rating = rating;
this.studio = studio;
numberofactionmovies++;
}
public ActionMovies(String title, double rating, String studio)
{
this(i++, "unset", title, rating, studio);
}
public void displayDetails()
{
System.out.println("Detail info about the movie");
System.out.println(id + " " + catagory + " " + title + " " + studio + " " + rating);
}
public int getNumberofMovies()
{
return numberofactionmovies;
}
public void displayCatagory()
{
System.out.println("Catagory: " + catagory);
}
}
class RomanticMovies implements Movies
{
static int numberofromance;
double id;
String catagory;
String title;
String studio;
double rating;
public RomanticMovies(double id, String catagory, String title, String studio, double rating)
{
this.id = id;
this.catagory = catagory;
this.title = title;
this.studio = studio;
this.rating = rating;
numberofromance++;
}
public void displayDetails()
{
System.out.println("Detail info about the movie");
System.out.println(id + " " + catagory + " " + title + " " + studio + " " + rating);
}
public int getNumberofMovies() {
return numberofromance;
}
@Override
public void displayCatagory() {
System.out.println("Catagory: " + catagory);
}
}
class ActionRomance extends RomanticMovies, ActionMovies {
ActionRomance(double id, String catagory, String title, String studio, double rating) {
super(id, catagory, title, studio, rating);
}
int calculateTotalMovies(int numberofaction, int numberofromance)
{
return (numberofaction + numberofromance);
}
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
ActionRomance movie = new ActionRomance(numberofromance, null, null, null, numberofromance);
System.out.println("Welcome to the movie store")
System.out.println("Enter movie Tittle:");
movie.title = input.nextLine();
System.out.println("Enter movie id:");
movie.id = input.nextDouble();
System.out.println("Enter movie catagory:");
movie.catagory = input.nextLine();
System.out.println("Enter movie studio")
}
}