Objective: The objective of this lab is to get you some experience in using generic classes, enums, foreach loops and the Java class library.The Java class library: The Java Class Library is a set of dynamically loadable libraries that Java application programs can call at runtime. Like other standard code libraries, Java class library provides the programmer a well-known set of functions to perform common tasks, such as maintaining lists of items or performing complex string parsing. For Java 1.5 or later, some generic classes and generic interfaces are included in the Java class library. Examples:import java.util.*;public class Stack public Stack(); // constructorpublic Boolean empty();public E peek();public E pop();public E push(E item);}public class LinkedList implements List<E, Queue<E, Cloneable, Serializable {public LinkedList(); // constructorpublic E getFirst();public E removeFirst();public void addLast(E item);public Boolean isEmpty();}The programming assignment: In your lab07,1. Replace your stack of Object with the generic class Stack<E.2. Replace your queue of Object with the generic class LinkedList<E.3. Replace Post.toString() method with a for-each loop.4. Replace your exception classes with the following exception class.5. Remove all unnecessary type casts.enum errorType { ExcessLeftParenthesis, ExcessRightParenthesis, ExcessOperator, ExcessOperand};class infixException extends Exception {private errorType etype;public infixException(errorType et) { // constructoretype = et;}public String toString() {return etype.name();}}
Java
[Solved] SOLVED:Lab 10 generic classes, enums, foreach loops Solution
$25
File Name: SOLVED:Lab_10_generic_classes,_enums,_foreach_loops_Solution.zip
File Size: 565.2 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.