Question
create program in Java, make sure to write 2 solutions for the problem using 2 different approches as mentioned in the problem statment Here are
create program in Java, make sure to write 2 solutions for the problem using 2 different approches as mentioned in the problem statment
Here are the classes in the starter file:
import java.util.LinkedList;
1- class Show {
String title;
double broadcastTime;
LinkedList
double avgLength;
boolean isSpecial;
public Show(String title, double broadcastTime, LinkedList
{
this.title = title;
this.broadcastTime = broadcastTime;
this.episodes = episodes;
this.isSpecial = isSpecial;
}
public void setAvgLength(double avgLength)
{
this.avgLength = avgLength;
}
}
2-
import java.util.LinkedList;
class ShowSummary {
LinkedList
LinkedList
LinkedList
ShowSummary()
{
this.daytime = new LinkedList
this.primetime = new LinkedList
this.latenight = new LinkedList
}
ShowSummary(LinkedList
{
this.daytime = daytime;
this.primetime = primetime;
this.latenight = latenight;
}
// the equals method for use in testing
public boolean equals(Object other)
{
if(!(other instanceof ShowSummary))
{
return false;
}
ShowSummary otherS = (ShowSummary) other;
return this.equalsHelper(this.daytime, otherS.daytime) &&
this.equalsHelper(this.primetime, otherS.primetime) &&
this.equalsHelper(this.latenight, otherS.latenight);
}
private boolean equalsHelper(LinkedList
{
if(theseShows.size() != otherShows.size())
{
return false;
}
for(int i = 0; i
{
Show thisShow = theseShows.get(i);
Show otherShow = otherShows.get(i);
if(!thisShow.title.equals(otherShow.title))
{
return false;
}
else if(thisShow.broadcastTime != otherShow.broadcastTime)
{
return false;
}
}
return true;
}
// the toString method so that reports display when tests fail
public String toString()
{
return this.toStringHelper(this.daytime) + "--- " + this.toStringHelper(this.primetime) + "--- " + this.toStringHelper(this.latenight);
}
private String toStringHelper(LinkedList
{
String output = "";
for(Show thisShow : theseShows)
{
output = output +
"Title: " + thisShow.title + " | " +
"Broadcast Time: " + thisShow.broadcastTime + " ";
for(Episode thisEp : thisShow.episodes)
{
output = output +
"Episode Title: " + thisEp.epTitle + " | " +
"Runtime: " + thisEp.runTime + " ";
}
output = output + " ";
}
return output;
}
}
3-
import java.util.LinkedList;
class ShowManager1 {
ShowManager1() {}
public ShowSummary organizeShows(LinkedList
{
return null;
}
}
4-
import java.util.LinkedList;
class ShowManager2 {
ShowManager2() {}
public ShowSummary organizeShows(LinkedList
{
return null;
}
}
Problem Statement For each of the following problems, write two solutions, where each solution solves the problem using a different approach. Approaches count as different if they cluster at least some subtasks of the problems diflerently (like we saw for Uhe Rainfall solutions in lecture); mere syntactic diflerences, such as replacing an element-based for-loop with an index-based neor ovng code into a helper without changing the order of the underlying computation, don't count as different For cach problem, you will be asked to identify (in a comment) the (sub)tasks that make up that problem. For Rainfall, we'd be looking for a sequencc of phrascs such as "summing clements, counting clements, ignoring negative elements, stopping at the -999", This wording doesn't need to be exact (it'l be graded by humans) - they just need to convey the core computational tasks within the problem Please download and use this set ot starter casses. The starter files contain all the classes needed for this assignment, as well as the classes in which to put your answers (to aid us in grading). You may add whatever methods you wish to these classes, but please don't rename any classes, fields, or methods. The section below on "Using the Starter Files" explains the starter files and where you should edit them with your solutions. Programming Problems Cable providers maintain lists of TV shows, their episodes, and their airdates. The starter files include a Show class and an Episode class. A Show contains a list of Episodes. The first two programming problems will refer to these classes. Problem 1: The Show Sorter A cable provider wants to organize its schedule into lists of daytime, primetime, late night, overnight, and special shows. Daytime shows have a start time at or after 6:00 am and before 5:00 pm. Primetime shows have a start time at or after 5:00 pm and before 10:00 pm. Late night shows have a start time at or after 10:00 pm and before 1:00 am. All other non-special shows are overnight. Specials are one-time shows that can be on any time of day. At the moment, the cable provider is interested in non-special daytime, primetime, and late night shows but none of the others Design a program called organizeshows that consumes a list of Shows and produces a report containing all of the daytime, primetime, and late night shows in the list that are not specials. The shows within each list in the report should be in the same order as in the original list. You may assume that no two shows have the same name. Use the showSummary class in the starter files for the report. A show's broadcast time is expressed in military (24-hour) time. For instance, if a show starts at 7:00 pm, then the value of hroadcastTime wil be 1900 The starter files provide a concrete test case for ths method In a comment at the bottom of the ShouExamples-java file, identify the subtasks for Problem I. Your comment will be graded. NOTE: Please do not modify the Show, Episode, or ShowSummary files. All of your functionality should be in ShowManagerl and ShowManager2, and all of your cxamples should be in ShowExamples Problem Statement For each of the following problems, write two solutions, where each solution solves the problem using a different approach. Approaches count as different if they cluster at least some subtasks of the problems diflerently (like we saw for Uhe Rainfall solutions in lecture); mere syntactic diflerences, such as replacing an element-based for-loop with an index-based neor ovng code into a helper without changing the order of the underlying computation, don't count as different For cach problem, you will be asked to identify (in a comment) the (sub)tasks that make up that problem. For Rainfall, we'd be looking for a sequencc of phrascs such as "summing clements, counting clements, ignoring negative elements, stopping at the -999", This wording doesn't need to be exact (it'l be graded by humans) - they just need to convey the core computational tasks within the problem Please download and use this set ot starter casses. The starter files contain all the classes needed for this assignment, as well as the classes in which to put your answers (to aid us in grading). You may add whatever methods you wish to these classes, but please don't rename any classes, fields, or methods. The section below on "Using the Starter Files" explains the starter files and where you should edit them with your solutions. Programming Problems Cable providers maintain lists of TV shows, their episodes, and their airdates. The starter files include a Show class and an Episode class. A Show contains a list of Episodes. The first two programming problems will refer to these classes. Problem 1: The Show Sorter A cable provider wants to organize its schedule into lists of daytime, primetime, late night, overnight, and special shows. Daytime shows have a start time at or after 6:00 am and before 5:00 pm. Primetime shows have a start time at or after 5:00 pm and before 10:00 pm. Late night shows have a start time at or after 10:00 pm and before 1:00 am. All other non-special shows are overnight. Specials are one-time shows that can be on any time of day. At the moment, the cable provider is interested in non-special daytime, primetime, and late night shows but none of the others Design a program called organizeshows that consumes a list of Shows and produces a report containing all of the daytime, primetime, and late night shows in the list that are not specials. The shows within each list in the report should be in the same order as in the original list. You may assume that no two shows have the same name. Use the showSummary class in the starter files for the report. A show's broadcast time is expressed in military (24-hour) time. For instance, if a show starts at 7:00 pm, then the value of hroadcastTime wil be 1900 The starter files provide a concrete test case for ths method In a comment at the bottom of the ShouExamples-java file, identify the subtasks for Problem I. Your comment will be graded. NOTE: Please do not modify the Show, Episode, or ShowSummary files. All of your functionality should be in ShowManagerl and ShowManager2, and all of your cxamples should be in ShowExamplesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started