1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
bonufazy [111]
3 years ago
12

Write a class named Episode. An instance of this episode class will represent a single episode of a TV show, with a title, a sea

son 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
Computers and Technology
1 answer:
gavmur [86]3 years ago
7 0

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

}

}

You might be interested in
What was the second phone?
ivanzaharov [21]
What is the question for !!!!!!!!!!!!
7 0
3 years ago
Where is the third vanishing point in the three point perspective
Naya [18.7K]

Answer:

The third vanishing point is placed under or above the horizon line

Explanation:

The third vanishing point in three point perspective is not placed on the horizon line. Instead the third vanishing point is placed under or above the horizon line. Often the bottom vanishing point is placed off of the picture plane.

5 0
2 years ago
A small company has hired you to take over its IT needs. The company currently has seven on-site employees and 12 remote employe
Alex787 [66]
The answer should be c if not it’s b
7 0
2 years ago
A(n) monitoring vulnerability scanner is one that listens in on the network and determines vulnerable versions of both server an
Tom [10]

Answer: Passive

Explanation: Passive scanning is the process that scans the possibility of the risk that can arise while data is received starting port to the destination. It does the scanning between the server and the client software to define vulnerability .

It cannot work in those network which don't persist the traffic.No false data that is present in the application is detected by it if the data is unclear.

5 0
3 years ago
What is a tax exemption (also known as a tax allowance)?
KengaRu [80]
<span>Tax exemption refers to a monetary exemption which reduces taxable income. Tax exempt status can provide complete relief from taxes, reduced rates, or tax on only a portion of items.</span>
4 0
2 years ago
Other questions:
  • A new company is upgrading a media workstation. The computer will be predominantly used for graphic intensive presentations, sli
    13·1 answer
  • Computers heat resistant materials breathing systems for fire fighters food-growing technologies improvements in all of the item
    14·1 answer
  • ¿Ha existido en la historia de nuestra humanidad alguien que hubiera hecho posible el sueño del ser humano en obtener energía li
    11·1 answer
  • A proprietary operating system designed for mobile devices, with associated libraries, user interface, frameworks and reference
    9·1 answer
  • ............................... ?
    11·1 answer
  • From Blown to Bits why is it important to know what children are doing on the Web Tonight?
    7·1 answer
  • How is science and technology used in the society​
    11·1 answer
  • Cite an early photographic pioneer or invention. Explain their/its impact on photography as we know it today.
    14·1 answer
  • What would a system unit that is integrated with the display and keyboard would be considered?
    6·1 answer
  • computer is an electronic machine that is used for data processing to produce meaningful information explain in statement​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!