Write a class named Episode. An instance of this episode class will represent a single episode of a TV show, with a title, a season number, and an episode number. For example "Friends, season 1, episode 1", or "The Wire, season 3, episode 5." Your class should have the following constructors and methods: A constructor that accepts three arguments: a String for the title, an int for the season number, and an int for the episode number. A constructor that accepts only a String, for the title, and sets the season and episode numbers to 1. A setter and getter for the title. (never mind the season and episode numbers.) A method named "equals", that accepts an Episode, and returns true if the title, season number and episode number are the same as the receiving object's. A method named "comesBefore". This method should also accept an Episode. It should return true if the episode that receives the invocation comes before the parameter. That is only true if the two objects have the same title, and if the argument comes from a later season, or the same season, but a later episode. Write only the class. Do not write a whole program

Answers

Answer 1
Answer:

Answer:

See explaination

Explanation:

class Episode{

//Private variables

private String title;

private int seasonNumber;

private int episodeNumber;

//Argumented constructor

public Episode(String title, int seasonNumber, int episodeNumber) {

this.title = title;

this.seasonNumber = seasonNumber;

this.episodeNumber = episodeNumber;

}

//Getter and setters

public String getTitle() {

return title;

}

public void setTitle(String title) {

this.title = title;

}

public int getSeasonNumber() {

return seasonNumber;

}

public void setSeasonNumber(int seasonNumber) {

this.seasonNumber = seasonNumber;

}

public int getEpisodeNumber() {

return episodeNumber;

}

public void setEpisodeNumber(int episodeNumber) {

this.episodeNumber = episodeNumber;

}

public boolean comesBefore(Episode e){

//Check if titles' match

if(this.title.equals(e.getTitle())){

//Compare season numbers

if(this.seasonNumber<e.seasonNumber){

return true;

}

//Check if season numbers match

else if(this.seasonNumber==e.getSeasonNumber()){

return this.episodeNumber<e.getEpisodeNumber();

}

}

return false;

}

atOverride // replace the at with at symbol

public String toString() {

return title+", season "+seasonNumber+", episode "+episodeNumber;

}

}

class Main{

public static void main(String[] args) {

Episode e = new Episode("Friends",1,1);

System.out.println(e);

Episode e2 = new Episode("The Wire",3,5);

System.out.println(e2);

System.out.println(e.getTitle()+" comes before "+e2.getTitle()+" = "+e.comesBefore(e2));

}

}


Related Questions

Which of these terms best describes the type of AI used in today’s email spam filters, speech recognition, and other specific applications?A. Artificial Narrow Intelligence (ANI)B. Artificial General Intelligence (AGI)
Which is true of diagnosing and troubleshooting? Diagnosing attempts to identify the source of a problem, while troubleshooting looks for the nature of the problem. Diagnosing is used to fix problems with hardware, while troubleshooting is used to fix problems in program code. Diagnosing looks for the nature of the problem, while troubleshooting attempts to identify the source of the problem. Diagnosing is used to fix problems in program code, while troubleshooting is used to fix problems with hardware.
Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. Prompt the user for 12 months of highest and lowest. Write two methods : one to calculate and return the average high and one to calculate and return the average low of the year. These methods MUST be your original code. Your program should output all the values in the array and then output the average high and the average low.a) Function getData: This function reads and stores data in the two-dimensional array.b) Function averageHigh: This function calculates and returns the average high temperature for the year.c) Function averageLow: This function calculates and returns the average low temperature for the year.d) Function indexHighTemp: This function returns the index of the highest high temperature in the array.e) Function indexLowTemp: This function returns the index of the lowest low temperature in the array."
From an IT perspective, which of the following best describes BI and BI apps?a. Stand-aloneb. Support a specific objectivec. A collection of ISs and technologiesd. Web-based systems designed for for-profits
Write a method called allDigitsOdd that returns whether every digit of a positive integer is odd. Return true if the number consists entirely of odd digits (1, 3, 5, 7, 9) and false if any of its digits are even (0, 2, 4, 6, 8). For example, the call allDigitsOdd(135319) returns true but allDigitsOdd(9145293) returns false.

Poor quality lateral communication will result in which ofthefollowing?
a. Lack of direction
b. Lack of coordination
c. Lack of delegation
d. Lack of control

Answers

Answer:

b. Lack of coordination

Explanation:

LAteral communication in human resources and organizational communication is known as the communication that exists between peers and colleagues, so that wouldn cause a lack of cirection, delegation or control because its not between bosses and employees, what it would cause would be a lack of coordination between the employees.

Answer:

b

Explanation:

b, lack of coordination

What subnet mask or CIDR notation would be required to maximize the host counts while still meeting the following requirements: 192.168.228.0 255.255.255.128 Required Networks: 2 Required Hosts: 20

Answers

Answer:

192.168.228.0 255.255.255.224

Explanation:

192.168.228.0 255.255.255.128

subnet mask: defines the host and the network part of a ip

CIDR notation : is the shortened form for subnet mask that uses the number of host bits for defining the host and the network part of a ip

For example: 192.168.228.0 255.255.255.128 has CIDR equivalent of 192.168.228.0\25

To have atleast 20 hosts

20 ≤ (2^x) -2

x ≈5

with 5 host bits, we have 2^5-2 = 30 hosts per subnet

and 2^3 = 8 subnets

To get the subnet mask, we have 3 network bits

1110000 to base 10 = 2^7 + 2^6 +2^5= 224

192.168.228.0 255.255.255.224

How many generations of computer languages have there been since the middle of the 20th century?

Answers

4 generations hahahaha
4 hoped this helped lol

What additional hindrances do criminal investigators face when dealing with computer crimes aside from the obvious struggle with the ever-changing technological world?​

Answers

Answer:hackers

Explanation:

Write a python program to calculate and print the electric bill for Ethiopian Electricity Corporation. (consumer name meter number(mno),last month reading(Imr)and current month reading(cmr) of 50 customers and calculate the net bill amounts as follows: Number of unit(Nou)=cmr-lmr If Nou200 then bill =Nou*2 tax=bill*0.15 netbill=bill+tax Print all the details in the bill for all customers​

Answers

The electric bill program illustrates the use of loops (i.e. iteration)

Loops are used to execute repetitive operations

The electric bill program in Python where comments are used to explain each line is as follows:

#This iteration shows that the process is repeated for 50 consumers

for i in range(50):

   #This gets input for the consumer name meter number

   mno = input("Consumer name meter number: ")

   #This gets input for last month reading

   lmr = int(input("Last month reading: "))

   #This gets input for current month reading

   cmr = int(input("Current month reading: "))

   #This calculates the number of units

   Nou = cmr - lmr

   #This calculates the bills

   bill = Nou*2

   #This calculates the tax

   tax = bill*0.15

   #This calculates the netbills

   netbill = bill+tax

   #This next four lines print the electric bills

   print("Number of units:",Nou)

   print("Bills:",bill)

   print("Tax:",tax)

   print("Netbill:",netbill)

Read more about loops at:

brainly.com/question/19344465

This assignment deals with Logical Equivalences. Review section 1.7 of the text before completing the assignment. The assignment may be handed in twice before it is graded. Consider the statements in the left column of the tables below. Translate each into a propositional statement. In the box below, indicate which two statements are logically equivalent. The gray shaded box is the Equation editor that should be used to enter the propositional expression.Question 1
Statement Reason
Whenever there is a puppy in the house, I feel happy
If I am happy, then there is a puppy in the house
If there is not a puppy in the house, then I am not happy.
If I am not happy, then there is no puppy in the house
Question 2
Statement Reason
If I am in school today, then I am in CSC231 class
If I am not in school today, then I am not civics class
If I am not in CSC231 class, then I am not in school today
If I am in CSC231 class, then I am in school today

Answers

Answer:

Question (1) the statements (i) and( iv) are logically equivalent and statements (ii) and (iii) are logically equivalent. Question (2) the statements (i) and (iii) are logically equivalent.

Explanation:

Solution

Question (1)

Now,

Lets us p as puppy in the house, and q as i am happy

So,

p : puppy in the house,  and q : i am happy

Thus,

The Statements

(i) so if there is a puppy in the house, I feel happy :  p -> q

(ii) If I am happy, then there is a puppy in the house : q -> p

(iii) If there is no puppy in the house, then I am not happy.   : ~ p -> ~q

(iv) If I am not happy, then there is no puppy in the house : ~q -> ~p

Hence, the statements (i) and( iv) are logically equivalent and statements (ii) and (iii) are logically equivalent.

Question (2)

Let us denote p as i am in school today, and q as i am in CSC231 class, and r as i am in civics class,

So,

p: i am in school today, q: i am in CSC231 class, r: i am in civics class,

Now,

(i) if I am in school today, then I am in CSC231 class  :p -> q

(ii) If I am not in school today, then I am not civics class  :~p -> ~r

(iii) If I am not in CSC231 class, then I am not in school today  :~q -> ~p

(iv) If I am in CSC231 class, then I am in school today  : q -> p

Therefore, the statements i) and iii) are logically equivalent.