Tom Hanks actor 64 Lebron James athlete 35 Anthony Hopkins actor 82 Mick Jagger musician 77 Aaron Rodgers athlete 36 Eric Clapton musician 75 Alex Rodriguez athlete 45 Sandra Bullock actor 56 Robert...

1 answer below »
The assignment instructions are linked below under PA04


Tom Hanks actor 64 Lebron James athlete 35 Anthony Hopkins actor 82 Mick Jagger musician 77 Aaron Rodgers athlete 36 Eric Clapton musician 75 Alex Rodriguez athlete 45 Sandra Bullock actor 56 Robert Plant musician 72 Julia Roberts actor 53 Serena Williams athlete 39 Mariah Carey musician 50 Michael Jordan athlete 57 Al Pacino actor 80 Billy Gibbons musician 70 Programming Assignment 4 Dr. Castañeda 1 IS 2043 Intermediate Object-Oriented Programming Programming Assignment # 4 100 points Due date November 30, 2020 On your flash drive or on your home PC create a folder called PA04. Note: you may save your workspace anywhere you want (PC, flash drive, etc). Now do the following problem: Within DrJava, you are to create the following program described below: You will/must use the following classes in your program: EntertainmentTester (has the main method) EntertainerStackADT EntertainerArrayStack LLEntertainer Node All of these classes are very similar to the in-class exercises that we did in class pertaining to stacks and linked lists, so they MUST be custom generic data structures. So please go back and review the respective exercises that we did and use them as a guide for this programming assignment. All printing will be done to the console. You are to download the file entitled entertainers.txt that is associated with this assignment. This file contains fifteen entertainers (one per line) that you will need for this assignment. The type of career that an entertainer may have are actor, athlete, or musician. Each line will consist of four items: first name, last name, career type, and age. Dr. Castañeda 2 This is Part 1 of your program. EntertainmentTester class – First, you will need to import the following: import java.util.Scanner; import java.nio.file.Paths; import java.io.IOException; You will also need to declare the following variables/objects: • EntertainerStackADT stackString = new EntertainerArrayStack(); • LLEntertainer llActors = new LLEntertainer(); • LLEntertainer llMusicians = new LLEntertainer(); • LLEntertainer llAthletes = new LLEntertainer(); • An array of strings called tokens (this array will be of size 10) • Three string variables: oneEntertainer, strList, aNode • Six integer variables all of which should be initialized to zero: countActors, countMusicians, countAthletes, totalActorAge, totalMusicianAge, and totalAthleteAge Dr. Castañeda 3 Here is what you are to do within the main method of this class: • Read in all entertainers from the file “entertainers.txt” and place each on to the stack (i.e. the stackString). You may declare your stack size to be 30 (this will be done within the EntertainerArrayStack class which is described later). However, your code should still check to make sure that the stack is not full before you push on to the stack as demonstrated in the in-class exercises. You should read them in one per line. After you have pushed an entertainer on to the stack print out that entertainer stating that you have pushed them on to the stack (look at expected output for part 1 below). Don’t forget to use the try-catch clauses • Now you are to pop the stack and then o print out each entertainer’s information to the console (look at the expected output for part 1 below) o you will now have to split the entertainer information into tokens (i.e. tokens). Insert the entertainer into the appropriate linked list based upon their career type. So, there will be three different linked lists: one for actors, one for musicians, and one for athletes o you must keep track of how many entertainers there are in each list and the running total of the ages of the entertainers on each list. Use the appropriate variables that were declared earlier to do this bookkeeping o don’t forget to make sure that stack is not empty before popping it Expected output for the first part of your program: Pushing entertainers to the stack: pushed: Tom Hanks actor 64 pushed: Lebron James athlete 35 pushed: Anthony Hopkins actor 82 Dr. Castañeda 4 pushed: Mick Jagger musician 77 pushed: Aaron Rodgers athlete 36 pushed: Eric Clapton musician 75 pushed: Alex Rodriguez athlete 45 pushed: Sandra Bullock actor 56 pushed: Robert Plant musician 72 pushed: Julia Roberts actor 53 pushed: Serena Williams athlete 39 pushed: Mariah Carey musician 50 pushed: Michael Jordan athlete 57 pushed: Al Pacino actor 80 pushed: Billy Gibbons musician 70 Popping entertainers from the stack: popped: Billy Gibbons musician 70 popped: Al Pacino actor 80 popped: Michael Jordan athlete 57 popped: Mariah Carey musician 50 popped: Serena Williams athlete 39 popped: Julia Roberts actor 53 popped: Robert Plant musician 72 popped: Sandra Bullock actor 56 popped: Alex Rodriguez athlete 45 popped: Eric Clapton musician 75 popped: Aaron Rodgers athlete 36 popped: Mick Jagger musician 77 popped: Anthony Hopkins actor 82 popped: Lebron James athlete 35 popped: Tom Hanks actor 64 Dr. Castañeda 5 This is Part 2 of your program. • Print out each linked list; calculate the average age for the entertainers on each linked list and then print it out after you have printed each linked list. Remember that you should have kept a running total of the entertainer’s age on each list in part 1 so at this point it should be very simple to do (look at the expected output for part 2 below). • Remove the first person who is on the actors linked list. Print out who was removed from the linked list. • Print out the entire actor linked list (note: the person removed from the linked list should no longer be on it; also, you do not have to re-calculate the average age again, just print the linked list • Remove the last person who is on the musicians linked list. Print out who was removed from the linked list. • Print out the entire musician linked list (note: the person removed from the linked list should no longer be on it; also, you do not have to re-calculate the average age again, just print the linked list • Remove the first person who is on the athletes linked list. Print out who was removed from the linked list. • Remove the last person who is on the athletes linked list. Print out who was removed from the linked list. • Print out the entire athlete linked list (note: the two people who were removed from the linked list should no longer be on it; also, you do not have to re-calculate the average age again, just print the linked list again Dr. Castañeda 6 Expected output for the second part of your program: Here are the linked lists: Linked list for Actors: Tom Hanks actor 64 Anthony Hopkins actor 82 Sandra Bullock actor 56 Julia Roberts actor 53 Al Pacino actor 80 Average age 67.00 Linked list for Musicians: Mick Jagger musician 77 Eric Clapton musician 75 Robert Plant musician 72 Mariah Carey musician 50 Billy Gibbons musician 70 Average age 68.80 Linked list for Athletes: Lebron James athlete 35 Aaron Rodgers athlete 36 Alex Rodriguez athlete 45 Serena Williams athlete 39 Michael Jordan athlete 57 Average age 42.40 Removed first node from actor linked list: Tom Hanks actor 64 Linked list for Actors: Anthony Hopkins actor 82 Sandra Bullock actor 56 Julia Roberts actor 53 Al Pacino actor 80 Removed last node from musician linked list: Billy Gibbons musician 70 Linked list for Musicians: Mick Jagger musician 77 Eric Clapton musician 75 Robert Plant musician 72 Mariah Carey musician 50 Removed first node from athlete linked list: Lebron James athlete 35 Removed last node from athlete linked list: Michael Jordan athlete 57 Dr. Castañeda 7 Linked list for Athletes: Aaron Rodgers athlete 36 Alex Rodriguez athlete 45 Serena Williams athlete 39 This program was written by Dr. Castaneda. End of program. Of course, your name will be in place of my name above. At the top of your program within the class EntertainmentTester make sure that you have the following header filled in: //------------------------------------------------------ // Programmer: // Course: IS 2043 Section ### // Semester: // Assignment #: // Due Date: //----------------------------------------------------- Note: You must conform to good Java programming practices (i.e. spaces where needed, indention, comments, etc.) You should have already learned this from your IS2033 (Java 1 course). Below are the remaining classes that you will need for this programming exercise. Again, you should review the respective exercises that we did and use them as a guide for this programming assignment. EntertainerStackADT interface – this is an interface that will have the following abstract methods: full() which returns a boolean value and has no parameters notEmpty() which returns a boolean value and has no parameters push() which does not return anything and has one parameter of type T pop() which returns a type T and has no parameters Dr. Castañeda 8 EntertainerArrayStack class – will have two instance variables: stack (of type T and of size 30) and stackCounter (an integer). Both will be private. Constructor EntertainerArrayStack – in this constructor, it will invoke the method initStack. No parameters will be received in this constructor Method initStack – in this method, the instance field stackCounter will be set to zero. No parameters will be received in this method Method full – in this method, if the stack is currently full then true will returned. Otherwise, false is returned (i.e. stack is not full). No parameters will be received in this method Method notEmpty – in this method, if the stack is currently not empty, then true will be returned. Otherwise, false is returned (i.e. stack is empty). No parameters will be received in this method Method push – in this method, there is one incoming parameter (element) of type T. This method will push the element on to the stack called stack. This method will not return anything Method pop – in this method, no parameters will be received. This method will pop off the stack an element of type T. This element will be returned from this method Node class – will have two instance variables: data
Answered Same DayNov 26, 2021

Answer To: Tom Hanks actor 64 Lebron James athlete 35 Anthony Hopkins actor 82 Mick Jagger musician 77 Aaron...

Mohd answered on Dec 07 2021
155 Votes
Programming Assignment # 4/.classpath

    
    
    
Programming Assignment # 4/.project

     Programming Assignment # 4
    
    
    
    
        
             org.eclipse.jdt.core.javabuilder
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
Programming As
signment # 4/bin/EntertainerArrayStack.class
public synchronized class EntertainerArrayStack extends EntertainerStackADT {
public void EntertainerArrayStack();
}
Programming Assignment # 4/bin/EntertainerStackADT.class
public synchronized class EntertainerStackADT {
public void EntertainerStackADT();
}
Programming Assignment # 4/bin/EntertainmentTester.class
public synchronized class EntertainmentTester {
EntertainerStackADT stackString;
LLEntertainer llActors;
LLEntertainer llMusicians;
LLEntertainer llAthletes;
String[] tokens;
String oneEntertainer;
String strList;
String aNode;
int countActors;
int countMusicians;
int countAthletes;
int totalActorAge;
int totalMusicianAge;
int totalAthleteAge;
public void EntertainmentTester();
public static void main(String[]);
public void readData();
public void displayList();
public void deleteCase();
}
Programming Assignment # 4/bin/LLEntertainer.class
public synchronized class LLEntertainer {
Node head;
public void LLEntertainer();
public static LLEntertainer insert(LLEntertainer, String);
public static LLEntertainer delete(LLEntertainer, String, String);
public static void printList(LLEntertainer, String, boolean);
}
Programming Assignment # 4/bin/Node.class
public synchronized class Node {
String data;
Node next;
public void Node(String);
}
Programming Assignment # 4/entertainers.txt
Tom Hanks actor 64
Lebron James athlete 35
Anthony Hopkins actor 82
Mick Jagger musician 77
Aaron Rodgers athlete 36
Eric Clapton musician 75
Alex Rodriguez athlete 45
Sandra Bullock actor 56
Robert Plant musician 72
Julia Roberts actor 53
Serena Williams athlete 39
Mariah Carey musician 50
Michael Jordan athlete 57
Al Pacino actor 80
Billy Gibbons musician 70
Programming Assignment # 4/src/EntertainerArrayStack.java
Programming Assignment # 4/src/EntertainerArrayStack.java
public class EntertainerArrayStack extends EntertainerStackADT{
}
Programming Assignment # 4/src/EntertainerStackADT.java
Programming Assignment # 4/src/EntertainerStackADT.java
public class EntertainerStackADT {
}
Programming Assignment # 4/src/EntertainmentTester.java
Programming Assignment #...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here