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
Which is NOT true?<br> 9 + 4 = 17 - 4<br> 8 + 7 = 14 + 3<br> 11 = 19 - 8<br> 5 + 8 = 20 - 7
Fudgin [204]

Answer:

B 8 + 7 = 14 + 3

Explanation:

7 0
3 years ago
This diagram shows some peripheral devices for a computer: which of the following is true
CaHeK987 [17]

Where is the diagram and answers?

4 0
3 years ago
What countermeasures would you recommend to defend against routing attacks?
Alla [95]

Answer:

 The countermeasure is basically recommended against the attackers for defending various routing attacks. Routing is one of the most generally assaulted segments in a system and a lot of system the executives work centers around checking conduct of switches.

The single router has more than one unit for bundle handling. This encourages quicker handling. This preparing unit is finished programming which can be undermined by an aggressor.

So an additional free equipment is implanted into the switch which can do observing to recognize the product assaults. Maintain a strategic distance from over composition the addresses.

Be movement at time when all of a sudden if anything incorrectly happens we should be in a situation to deal with and deal with the issue since it causes more harm when time runs.

3 0
3 years ago
Write the definition of a function typing_speed, that receives two parameters. The first is the number of words that a person ha
m_a_m_a [10]

Answer:

The function code and the formula for the above question is listed below:

Explanation:

Function:

float typing_speed(int Number_of_words, int Time_in_seconds)

{

float time= Time_in_seconds/60;

float speed= Number_of_words/time;

return speed;

}

Formula for this algorithm or program:

Number of words per minute= number of words/ Time(in minutes).

Function Explanation

  • The above function defined in the c-language code, which is used to return the typing speed for any user when he enters the number of words and the time in seconds.
  • The speed is calculated with the help of the above-defined formula.
  • The first statement of the code is used to change the time in a minute.
  • The second statement of the code is used to calculate the speed by the help of speed formula.
  • Then the third statement returns the value of the speed variable.

6 0
3 years ago
Why is weather forecast so important for hang gliders?
professor190 [17]
Well, it wouldn't be such a good idea if they got caught up in a storm, would it? :p

Strong winds could blow them off-course, or even lightning has a chance of striking the hand glider, causing damage to the glider, the person, or even both.

Additionally, a weather forecast can help in my generic situations. For example, knowing whether to wrap up warm for cold weather, or wear something a bit more loose and breathable for hot weather.
6 0
4 years ago
Other questions:
  • What is the cheapest type of printer to buy and run?
    11·2 answers
  • (PLS HELP 99 POINTS) In a paragraph of no less than 125 words, explain the three aspects involved in gaining a true appreciation
    14·2 answers
  • Sending a busy manager a long email represents a problem in which area of the communication process
    7·1 answer
  • Assume that an array of Integers named a that contains exactly five elements has been declared and initialized. In addition, an
    12·1 answer
  • Simone frequently downloads mobile apps from Amazon Appstore. What operating system does she have on her smartphone?
    6·1 answer
  • It is desirable to provide a degree of __________ __________ among classes so that one class is not adversely affected by anothe
    8·1 answer
  • Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program sh
    6·1 answer
  • What causes the poles of the electromagnet in an audio speaker to repeatedly switch directions?
    6·2 answers
  • Which item can you add using the tag?
    10·2 answers
  • Engineers are problem-solvers who use math, science, creativity and other knowledge and skills to solve problems. They use every
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!