SlideShare a Scribd company logo
1 of 8
Download to read offline
The following classes are to complete the 'TODO' to fit the task, output and the overview
package lesson;
import java.util.Collection;
import java.util.Deque;
import java.util.Queue;
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
/**
* Allows user to enter filename containing courses to display courses
* in a particular order
*
* @author krodgers
* @author TODO
*/
public class App {
public static void main(String[] args) {
Scanner userScan = new Scanner(System.in);
int userInput = 0;
boolean done = false;
while(!done){
switch(userInput){
case 0:
// Print menu - Get prereqs, list courses, quit
System.out.println("Your choices:");
System.out.println("0. Print Menu");
System.out.println("1. Get prereqs");
System.out.println("2. List courses");
System.out.println("3. Quit");
break;
case 1:
try{
// Get Prerequisite classes
System.out.println("Listing the prerequisites");
System.out.println("Enter the course for which to get prereqs (dept courseNo credits): " );
Scanner lineScan = new Scanner(userScan.nextLine());
CreditCourse target = new CreditCourse(lineScan.next(),
lineScan.nextInt(), lineScan.nextInt());
lineScan.close();
System.out.println("Enter filename (x.txt): ");
String filename = userScan.nextLine();
Scanner fileScan = new Scanner(new File(filename));
Deque<CreditCourse> prereqs = CoursePlanner.organizePrereqs(target, fileScan);
System.out.println("To take " + target + ", you must take the following classes: " );
printStructure(prereqs);
fileScan.close();
} catch(FileNotFoundException e){
System.out.println("Tried to open file, but couldn't find it");
}
break;
case 2:
// TODO
// Ask for the order in which courses should be printed
// Ask for the order in which courses are listed in the file
// Ask for filename
// Print courses by using either chronologicalOrder or
// revChronologicalOrder and printStructure
break;
case 3:
done = true;
break;
default:
System.out.println("Invalid menu option - enter 1, 2, or 3");
}
System.out.print("Enter Option: ");
userInput = Integer.parseInt(userScan.nextLine());
}
}
/**
* Prints the contents of a Queue or Deque by popping items. This
* method will modify the data structure - courses will be empty
* when this method returns
* DO NOT MODIFY THIS METHOD
* @param courses - the data structure to print
*/
public static void printStructure(Queue<CreditCourse> courses){
while(courses.size() > 0){
System.out.println(courses.remove());
}
}
}
package lesson;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Deque;
import java.util.Scanner;
import java.io.File;
/**
* Contains methods to organize courses.
*
* All methods take course information input in the form
* <pre>
* <dept> <courseNo> <credits>
* <dept> <courseNo> <credits>
* ...
* </pre>
*
* @author
*/
public class CoursePlanner{
/**
Returns data structure that will list courses in the order they
must be taken in order to take target course
Classes with the same last digit are in a series and must be
taken in series order. For example, EDU 101, EDU 221, EDU 251,
EDU 321, EDU 451 form a series.
Hint: Use modulus division to extract the last digit from the course number
@param prereqs - file containing courses from 500 level to 100 level
@param courses - a Scanner object already opened to input containing classes in numerical order
*/
public static Deque<CreditCourse> organizePrereqs(CreditCourse target, Scanner courses){
return null;
}
/**
* Returns a Deque that will list courses from earliest taken
* taken to most recently taken
*
* @param transcript - Scanner open to input containing courses ordered
* most recently taken to earliest taken
*/
public static Deque<CreditCourse> chronologicalOrder(Scanner transcript){
return null;
}
/**
* Returns a Queue that will list courses from most
* recently taken to earliest taken
*
* @param transcript - Scanner open to input containing courses ordered
* most recently taken to earliest taken
*/
public static Queue<CreditCourse> revChronologicalOrder(Scanner transcript){
return null;
}
}
Second test files
Here is an overview of the total task to do
Task 1 - Read all provided code Read through README.md and all provided source and test
files. Pay particular attention to the datafiles and the description of the datafiles in
README.md. Read the javadoc comments! For this lab, the tests have been provided for you.
Task 2 - Update CreditCourse Copy Creditcourse. j ava from your last lab into app / src / main /
java / lesson with the rest of the source files. Run Creditcoursetest.java and fix any tests that fail.
Take a look through the test file and note the test cases; in general, you want to test for valid
cases, invalid cases, and boundary cases. Task 2 - Implement CoursePlanner Class Use the
javadocs in courseplanner. java to implement the methods. Note all methods are static methods -
you don't have to create an object to call the methods (like the Math class). Each method will
return either a Deque or a queue. Do not create, open, or close any Scanners in this class. Do not
open any files in this class. Just use the Scanner parameter - it should be an initialized Scanner
object. You can use it in the exact same way as any Scanner you created yourself. Refer to Code
Examples for Using Scanners Task 3 - Implement App.java The file App.java contains
comments that outline an algorithm (something you should do when you write your own
algorithms). Complete the TODOs. Example Output User input is in green text Your choices: 0.
Print Menu 1. Get prereqs 2. Iist courses 3. Quit Enter Option: 2 M - most recent to least recent L
- least recent to most recent In what order should courses be displayed? M/L L In what order are
courses listed in the file? M/L M Enter filename (x.txt): yearCourses.txt (1) CS HU 310 (1) CS
HU 271 (1) CS HU 250 (4) ECE 230 (3) CS 253 (3) CS 321 (1) CS HU 153 (3) UF 200 (3)
ENGL 212 (3) CS 221 (4) MATH 189 Enter Option: 2 M - most recent to least recent I - least
recent to most recent In what order should courses be displayed? M/I M In what order are
courses listed in the file? M/L M Enter filename (x.txt) : yearCourses.txt (4) MATH 189 (3) CS
221 (3) ENGL 212 (3) UF 200 (1) CS HU 153 (3) CS 321 (3) CS 253 (4) ECE 230 (1) CS-HU
250 (1) CS-HU 271 (1) CS-HU 310 Enter Option: 1 Listing the prerequisites Enter the course for
which to get prereqs (dept courseno credits): EDU 4943 Enter filename (x.txt): courses.txt To
take (3) EDU 494, you must take the following classes: (6) EDU 184 (4) EDU 194 (4) EDU 364
(5) EDU 384 (6) EDU 464 (1) EDU 484 (3) EDU 494 Enter Option: 3 purseTest.java 9 + X ##
Learning objectives - Use generic methods and classes - Understand generic classes - Understand
how to choose the appropriate linear data structure for a particular application - Use a Stack
(Deque) and Queue ## Overview This project contains the following source files: - App.java -
Driver class; Allows the user to choose options from a menu to search and display courses;
partially implemented, you need to finish the rest. - CoursePlanner.java - Contains methods you
need to implement. The methods process input and returns a data structure of courses in the
correct order. You should not be opening files or creating Scanners in this file - use the
parameter objects to process the input. You may assume the data in the input is in the correct
format. This is a bad assumption, but adequate for the purposes of this lab. the following test
files: - CreditcourseTest.java - contains complete tests for CreditCourse.java; do not modify. Do
look through the tests to see what is being tested, how the tests are structured, etc. -
CoursePlannerTest.java - contains complete tests for CoursePlanner. Do not modify.
The following classes are to complete the 'TODO' to fit the task- outp.pdf

More Related Content

Similar to The following classes are to complete the 'TODO' to fit the task- outp.pdf

Java For beginners and CSIT and IT students
Java  For beginners and CSIT and IT studentsJava  For beginners and CSIT and IT students
Java For beginners and CSIT and IT studentsPartnered Health
 
Unit3 part3-packages and interfaces
Unit3 part3-packages and interfacesUnit3 part3-packages and interfaces
Unit3 part3-packages and interfacesDevaKumari Vijay
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1stConnex
 
9781439035665 ppt ch08
9781439035665 ppt ch089781439035665 ppt ch08
9781439035665 ppt ch08Terry Yoast
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rdConnex
 
Ive posted 3 classes after the instruction that were given at star.pdf
Ive posted 3 classes after the instruction that were given at star.pdfIve posted 3 classes after the instruction that were given at star.pdf
Ive posted 3 classes after the instruction that were given at star.pdfdeepaarora22
 
API workshop: Deep dive into Java
API workshop: Deep dive into JavaAPI workshop: Deep dive into Java
API workshop: Deep dive into JavaTom Johnson
 
JavaBasicsCore1.ppt
JavaBasicsCore1.pptJavaBasicsCore1.ppt
JavaBasicsCore1.pptbuvanabala
 
Introduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptxIntroduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptxPoonam60376
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective cSunny Shaikh
 
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...Sagar Verma
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAVINASH KUMAR
 
Best Core Java Training In Bangalore
Best Core Java Training In BangaloreBest Core Java Training In Bangalore
Best Core Java Training In Bangalorerajkamaltibacademy
 
Introduction
IntroductionIntroduction
Introductionrichsoden
 

Similar to The following classes are to complete the 'TODO' to fit the task- outp.pdf (20)

3 j unit
3 j unit3 j unit
3 j unit
 
Java For beginners and CSIT and IT students
Java  For beginners and CSIT and IT studentsJava  For beginners and CSIT and IT students
Java For beginners and CSIT and IT students
 
Passing java arrays in oracle stored procedure from mule esb flow
Passing java arrays in oracle stored procedure from mule esb flowPassing java arrays in oracle stored procedure from mule esb flow
Passing java arrays in oracle stored procedure from mule esb flow
 
Unit3 part3-packages and interfaces
Unit3 part3-packages and interfacesUnit3 part3-packages and interfaces
Unit3 part3-packages and interfaces
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
 
9781439035665 ppt ch08
9781439035665 ppt ch089781439035665 ppt ch08
9781439035665 ppt ch08
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rd
 
Ive posted 3 classes after the instruction that were given at star.pdf
Ive posted 3 classes after the instruction that were given at star.pdfIve posted 3 classes after the instruction that were given at star.pdf
Ive posted 3 classes after the instruction that were given at star.pdf
 
API workshop: Deep dive into Java
API workshop: Deep dive into JavaAPI workshop: Deep dive into Java
API workshop: Deep dive into Java
 
JavaBasicsCore1.ppt
JavaBasicsCore1.pptJavaBasicsCore1.ppt
JavaBasicsCore1.ppt
 
Introduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptxIntroduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptx
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective c
 
Chap08
Chap08Chap08
Chap08
 
Understanding Annotations in Java
Understanding Annotations in JavaUnderstanding Annotations in Java
Understanding Annotations in Java
 
Java notes
Java notesJava notes
Java notes
 
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
 
Inheritance
InheritanceInheritance
Inheritance
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sir
 
Best Core Java Training In Bangalore
Best Core Java Training In BangaloreBest Core Java Training In Bangalore
Best Core Java Training In Bangalore
 
Introduction
IntroductionIntroduction
Introduction
 

More from JustinxitMillero

Tissue necrosis in STEMI heart attack typically affects A- whole thic.pdf
Tissue necrosis in STEMI heart attack typically affects  A- whole thic.pdfTissue necrosis in STEMI heart attack typically affects  A- whole thic.pdf
Tissue necrosis in STEMI heart attack typically affects A- whole thic.pdfJustinxitMillero
 
This week- create a discussion thread using the subject- The Art of St.pdf
This week- create a discussion thread using the subject- The Art of St.pdfThis week- create a discussion thread using the subject- The Art of St.pdf
This week- create a discussion thread using the subject- The Art of St.pdfJustinxitMillero
 
This data is from a sample- Calculate the mean- standard deviation- an (2).pdf
This data is from a sample- Calculate the mean- standard deviation- an (2).pdfThis data is from a sample- Calculate the mean- standard deviation- an (2).pdf
This data is from a sample- Calculate the mean- standard deviation- an (2).pdfJustinxitMillero
 
This week- create a discussion thread using the subject- Sources of Po.pdf
This week- create a discussion thread using the subject- Sources of Po.pdfThis week- create a discussion thread using the subject- Sources of Po.pdf
This week- create a discussion thread using the subject- Sources of Po.pdfJustinxitMillero
 
This data is from a sample- Calculate the mean- standard deviation- an (3).pdf
This data is from a sample- Calculate the mean- standard deviation- an (3).pdfThis data is from a sample- Calculate the mean- standard deviation- an (3).pdf
This data is from a sample- Calculate the mean- standard deviation- an (3).pdfJustinxitMillero
 
Use Array instead of vectors- Implement following classes and required.pdf
Use Array instead of vectors- Implement following classes and required.pdfUse Array instead of vectors- Implement following classes and required.pdf
Use Array instead of vectors- Implement following classes and required.pdfJustinxitMillero
 
Use examples from YOUR life or work experiences- or use a commonly kno.pdf
Use examples from YOUR life or work experiences- or use a commonly kno.pdfUse examples from YOUR life or work experiences- or use a commonly kno.pdf
Use examples from YOUR life or work experiences- or use a commonly kno.pdfJustinxitMillero
 
These items are taken from the financial statements of Ayayai Co- at D.pdf
These items are taken from the financial statements of Ayayai Co- at D.pdfThese items are taken from the financial statements of Ayayai Co- at D.pdf
These items are taken from the financial statements of Ayayai Co- at D.pdfJustinxitMillero
 
Understanding the importance of passing the NCLEX for my profession wa.pdf
Understanding the importance of passing the NCLEX for my profession wa.pdfUnderstanding the importance of passing the NCLEX for my profession wa.pdf
Understanding the importance of passing the NCLEX for my profession wa.pdfJustinxitMillero
 
Un cambio en la entidad que informa contable ocurre principalmente cua.pdf
Un cambio en la entidad que informa contable ocurre principalmente cua.pdfUn cambio en la entidad que informa contable ocurre principalmente cua.pdf
Un cambio en la entidad que informa contable ocurre principalmente cua.pdfJustinxitMillero
 
Type 2 diabetes accounts for about 90- to 95- of all diagnosed cases o.pdf
Type 2 diabetes accounts for about 90- to 95- of all diagnosed cases o.pdfType 2 diabetes accounts for about 90- to 95- of all diagnosed cases o.pdf
Type 2 diabetes accounts for about 90- to 95- of all diagnosed cases o.pdfJustinxitMillero
 
Type 1 diabetes accounts for 5- to 10- of all diagnosed cases of diabe.pdf
Type 1 diabetes accounts for 5- to 10- of all diagnosed cases of diabe.pdfType 1 diabetes accounts for 5- to 10- of all diagnosed cases of diabe.pdf
Type 1 diabetes accounts for 5- to 10- of all diagnosed cases of diabe.pdfJustinxitMillero
 
Trying to import txt file - Month and Year is the first column and the.pdf
Trying to import txt file - Month and Year is the first column and the.pdfTrying to import txt file - Month and Year is the first column and the.pdf
Trying to import txt file - Month and Year is the first column and the.pdfJustinxitMillero
 
True-False- 1- Microbial growth means an increase in cell size- 2- Mic.pdf
True-False- 1- Microbial growth means an increase in cell size- 2- Mic.pdfTrue-False- 1- Microbial growth means an increase in cell size- 2- Mic.pdf
True-False- 1- Microbial growth means an increase in cell size- 2- Mic.pdfJustinxitMillero
 
TRUE OR FALSE-Arteries and veins have both internal and external elast.pdf
TRUE OR FALSE-Arteries and veins have both internal and external elast.pdfTRUE OR FALSE-Arteries and veins have both internal and external elast.pdf
TRUE OR FALSE-Arteries and veins have both internal and external elast.pdfJustinxitMillero
 
True or False- Practice variations refer to variations in treatment pa.pdf
True or False- Practice variations refer to variations in treatment pa.pdfTrue or False- Practice variations refer to variations in treatment pa.pdf
True or False- Practice variations refer to variations in treatment pa.pdfJustinxitMillero
 
True or False- Normally- the percentage of soil saturation with water.pdf
True or False- Normally- the percentage of soil saturation with water.pdfTrue or False- Normally- the percentage of soil saturation with water.pdf
True or False- Normally- the percentage of soil saturation with water.pdfJustinxitMillero
 
True or false- In the XXXY sex-determining system- males are the homog.pdf
True or false- In the XXXY sex-determining system- males are the homog.pdfTrue or false- In the XXXY sex-determining system- males are the homog.pdf
True or false- In the XXXY sex-determining system- males are the homog.pdfJustinxitMillero
 
True or False- Give reasoning- 1) Alpine Meadows above high elevations.pdf
True or False- Give reasoning- 1) Alpine Meadows above high elevations.pdfTrue or False- Give reasoning- 1) Alpine Meadows above high elevations.pdf
True or False- Give reasoning- 1) Alpine Meadows above high elevations.pdfJustinxitMillero
 

More from JustinxitMillero (20)

Tissue necrosis in STEMI heart attack typically affects A- whole thic.pdf
Tissue necrosis in STEMI heart attack typically affects  A- whole thic.pdfTissue necrosis in STEMI heart attack typically affects  A- whole thic.pdf
Tissue necrosis in STEMI heart attack typically affects A- whole thic.pdf
 
This week- create a discussion thread using the subject- The Art of St.pdf
This week- create a discussion thread using the subject- The Art of St.pdfThis week- create a discussion thread using the subject- The Art of St.pdf
This week- create a discussion thread using the subject- The Art of St.pdf
 
This data is from a sample- Calculate the mean- standard deviation- an (2).pdf
This data is from a sample- Calculate the mean- standard deviation- an (2).pdfThis data is from a sample- Calculate the mean- standard deviation- an (2).pdf
This data is from a sample- Calculate the mean- standard deviation- an (2).pdf
 
This week- create a discussion thread using the subject- Sources of Po.pdf
This week- create a discussion thread using the subject- Sources of Po.pdfThis week- create a discussion thread using the subject- Sources of Po.pdf
This week- create a discussion thread using the subject- Sources of Po.pdf
 
This data is from a sample- Calculate the mean- standard deviation- an (3).pdf
This data is from a sample- Calculate the mean- standard deviation- an (3).pdfThis data is from a sample- Calculate the mean- standard deviation- an (3).pdf
This data is from a sample- Calculate the mean- standard deviation- an (3).pdf
 
Use Array instead of vectors- Implement following classes and required.pdf
Use Array instead of vectors- Implement following classes and required.pdfUse Array instead of vectors- Implement following classes and required.pdf
Use Array instead of vectors- Implement following classes and required.pdf
 
Use examples from YOUR life or work experiences- or use a commonly kno.pdf
Use examples from YOUR life or work experiences- or use a commonly kno.pdfUse examples from YOUR life or work experiences- or use a commonly kno.pdf
Use examples from YOUR life or work experiences- or use a commonly kno.pdf
 
These items are taken from the financial statements of Ayayai Co- at D.pdf
These items are taken from the financial statements of Ayayai Co- at D.pdfThese items are taken from the financial statements of Ayayai Co- at D.pdf
These items are taken from the financial statements of Ayayai Co- at D.pdf
 
Understanding the importance of passing the NCLEX for my profession wa.pdf
Understanding the importance of passing the NCLEX for my profession wa.pdfUnderstanding the importance of passing the NCLEX for my profession wa.pdf
Understanding the importance of passing the NCLEX for my profession wa.pdf
 
Un cambio en la entidad que informa contable ocurre principalmente cua.pdf
Un cambio en la entidad que informa contable ocurre principalmente cua.pdfUn cambio en la entidad que informa contable ocurre principalmente cua.pdf
Un cambio en la entidad que informa contable ocurre principalmente cua.pdf
 
Type 2 diabetes accounts for about 90- to 95- of all diagnosed cases o.pdf
Type 2 diabetes accounts for about 90- to 95- of all diagnosed cases o.pdfType 2 diabetes accounts for about 90- to 95- of all diagnosed cases o.pdf
Type 2 diabetes accounts for about 90- to 95- of all diagnosed cases o.pdf
 
Type 1 diabetes accounts for 5- to 10- of all diagnosed cases of diabe.pdf
Type 1 diabetes accounts for 5- to 10- of all diagnosed cases of diabe.pdfType 1 diabetes accounts for 5- to 10- of all diagnosed cases of diabe.pdf
Type 1 diabetes accounts for 5- to 10- of all diagnosed cases of diabe.pdf
 
tst.pdf
tst.pdftst.pdf
tst.pdf
 
Trying to import txt file - Month and Year is the first column and the.pdf
Trying to import txt file - Month and Year is the first column and the.pdfTrying to import txt file - Month and Year is the first column and the.pdf
Trying to import txt file - Month and Year is the first column and the.pdf
 
True-False- 1- Microbial growth means an increase in cell size- 2- Mic.pdf
True-False- 1- Microbial growth means an increase in cell size- 2- Mic.pdfTrue-False- 1- Microbial growth means an increase in cell size- 2- Mic.pdf
True-False- 1- Microbial growth means an increase in cell size- 2- Mic.pdf
 
TRUE OR FALSE-Arteries and veins have both internal and external elast.pdf
TRUE OR FALSE-Arteries and veins have both internal and external elast.pdfTRUE OR FALSE-Arteries and veins have both internal and external elast.pdf
TRUE OR FALSE-Arteries and veins have both internal and external elast.pdf
 
True or False- Practice variations refer to variations in treatment pa.pdf
True or False- Practice variations refer to variations in treatment pa.pdfTrue or False- Practice variations refer to variations in treatment pa.pdf
True or False- Practice variations refer to variations in treatment pa.pdf
 
True or False- Normally- the percentage of soil saturation with water.pdf
True or False- Normally- the percentage of soil saturation with water.pdfTrue or False- Normally- the percentage of soil saturation with water.pdf
True or False- Normally- the percentage of soil saturation with water.pdf
 
True or false- In the XXXY sex-determining system- males are the homog.pdf
True or false- In the XXXY sex-determining system- males are the homog.pdfTrue or false- In the XXXY sex-determining system- males are the homog.pdf
True or false- In the XXXY sex-determining system- males are the homog.pdf
 
True or False- Give reasoning- 1) Alpine Meadows above high elevations.pdf
True or False- Give reasoning- 1) Alpine Meadows above high elevations.pdfTrue or False- Give reasoning- 1) Alpine Meadows above high elevations.pdf
True or False- Give reasoning- 1) Alpine Meadows above high elevations.pdf
 

Recently uploaded

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 

Recently uploaded (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

The following classes are to complete the 'TODO' to fit the task- outp.pdf

  • 1. The following classes are to complete the 'TODO' to fit the task, output and the overview package lesson; import java.util.Collection; import java.util.Deque; import java.util.Queue; import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; /** * Allows user to enter filename containing courses to display courses * in a particular order * * @author krodgers * @author TODO */ public class App { public static void main(String[] args) { Scanner userScan = new Scanner(System.in); int userInput = 0; boolean done = false;
  • 2. while(!done){ switch(userInput){ case 0: // Print menu - Get prereqs, list courses, quit System.out.println("Your choices:"); System.out.println("0. Print Menu"); System.out.println("1. Get prereqs"); System.out.println("2. List courses"); System.out.println("3. Quit"); break; case 1: try{ // Get Prerequisite classes System.out.println("Listing the prerequisites"); System.out.println("Enter the course for which to get prereqs (dept courseNo credits): " ); Scanner lineScan = new Scanner(userScan.nextLine()); CreditCourse target = new CreditCourse(lineScan.next(), lineScan.nextInt(), lineScan.nextInt()); lineScan.close(); System.out.println("Enter filename (x.txt): "); String filename = userScan.nextLine(); Scanner fileScan = new Scanner(new File(filename)); Deque<CreditCourse> prereqs = CoursePlanner.organizePrereqs(target, fileScan);
  • 3. System.out.println("To take " + target + ", you must take the following classes: " ); printStructure(prereqs); fileScan.close(); } catch(FileNotFoundException e){ System.out.println("Tried to open file, but couldn't find it"); } break; case 2: // TODO // Ask for the order in which courses should be printed // Ask for the order in which courses are listed in the file // Ask for filename // Print courses by using either chronologicalOrder or // revChronologicalOrder and printStructure break; case 3: done = true; break; default: System.out.println("Invalid menu option - enter 1, 2, or 3"); } System.out.print("Enter Option: "); userInput = Integer.parseInt(userScan.nextLine());
  • 4. } } /** * Prints the contents of a Queue or Deque by popping items. This * method will modify the data structure - courses will be empty * when this method returns * DO NOT MODIFY THIS METHOD * @param courses - the data structure to print */ public static void printStructure(Queue<CreditCourse> courses){ while(courses.size() > 0){ System.out.println(courses.remove()); } } } package lesson; import java.util.LinkedList; import java.util.Queue; import java.util.Deque; import java.util.Scanner; import java.io.File; /**
  • 5. * Contains methods to organize courses. * * All methods take course information input in the form * <pre> * <dept> <courseNo> <credits> * <dept> <courseNo> <credits> * ... * </pre> * * @author */ public class CoursePlanner{ /** Returns data structure that will list courses in the order they must be taken in order to take target course Classes with the same last digit are in a series and must be taken in series order. For example, EDU 101, EDU 221, EDU 251, EDU 321, EDU 451 form a series. Hint: Use modulus division to extract the last digit from the course number @param prereqs - file containing courses from 500 level to 100 level @param courses - a Scanner object already opened to input containing classes in numerical order */ public static Deque<CreditCourse> organizePrereqs(CreditCourse target, Scanner courses){
  • 6. return null; } /** * Returns a Deque that will list courses from earliest taken * taken to most recently taken * * @param transcript - Scanner open to input containing courses ordered * most recently taken to earliest taken */ public static Deque<CreditCourse> chronologicalOrder(Scanner transcript){ return null; } /** * Returns a Queue that will list courses from most * recently taken to earliest taken * * @param transcript - Scanner open to input containing courses ordered * most recently taken to earliest taken */ public static Queue<CreditCourse> revChronologicalOrder(Scanner transcript){ return null; } }
  • 7. Second test files Here is an overview of the total task to do Task 1 - Read all provided code Read through README.md and all provided source and test files. Pay particular attention to the datafiles and the description of the datafiles in README.md. Read the javadoc comments! For this lab, the tests have been provided for you. Task 2 - Update CreditCourse Copy Creditcourse. j ava from your last lab into app / src / main / java / lesson with the rest of the source files. Run Creditcoursetest.java and fix any tests that fail. Take a look through the test file and note the test cases; in general, you want to test for valid cases, invalid cases, and boundary cases. Task 2 - Implement CoursePlanner Class Use the javadocs in courseplanner. java to implement the methods. Note all methods are static methods - you don't have to create an object to call the methods (like the Math class). Each method will return either a Deque or a queue. Do not create, open, or close any Scanners in this class. Do not open any files in this class. Just use the Scanner parameter - it should be an initialized Scanner object. You can use it in the exact same way as any Scanner you created yourself. Refer to Code Examples for Using Scanners Task 3 - Implement App.java The file App.java contains comments that outline an algorithm (something you should do when you write your own algorithms). Complete the TODOs. Example Output User input is in green text Your choices: 0. Print Menu 1. Get prereqs 2. Iist courses 3. Quit Enter Option: 2 M - most recent to least recent L - least recent to most recent In what order should courses be displayed? M/L L In what order are courses listed in the file? M/L M Enter filename (x.txt): yearCourses.txt (1) CS HU 310 (1) CS HU 271 (1) CS HU 250 (4) ECE 230 (3) CS 253 (3) CS 321 (1) CS HU 153 (3) UF 200 (3) ENGL 212 (3) CS 221 (4) MATH 189 Enter Option: 2 M - most recent to least recent I - least recent to most recent In what order should courses be displayed? M/I M In what order are courses listed in the file? M/L M Enter filename (x.txt) : yearCourses.txt (4) MATH 189 (3) CS 221 (3) ENGL 212 (3) UF 200 (1) CS HU 153 (3) CS 321 (3) CS 253 (4) ECE 230 (1) CS-HU 250 (1) CS-HU 271 (1) CS-HU 310 Enter Option: 1 Listing the prerequisites Enter the course for which to get prereqs (dept courseno credits): EDU 4943 Enter filename (x.txt): courses.txt To take (3) EDU 494, you must take the following classes: (6) EDU 184 (4) EDU 194 (4) EDU 364 (5) EDU 384 (6) EDU 464 (1) EDU 484 (3) EDU 494 Enter Option: 3 purseTest.java 9 + X ## Learning objectives - Use generic methods and classes - Understand generic classes - Understand how to choose the appropriate linear data structure for a particular application - Use a Stack (Deque) and Queue ## Overview This project contains the following source files: - App.java - Driver class; Allows the user to choose options from a menu to search and display courses; partially implemented, you need to finish the rest. - CoursePlanner.java - Contains methods you need to implement. The methods process input and returns a data structure of courses in the correct order. You should not be opening files or creating Scanners in this file - use the parameter objects to process the input. You may assume the data in the input is in the correct format. This is a bad assumption, but adequate for the purposes of this lab. the following test files: - CreditcourseTest.java - contains complete tests for CreditCourse.java; do not modify. Do look through the tests to see what is being tested, how the tests are structured, etc. - CoursePlannerTest.java - contains complete tests for CoursePlanner. Do not modify.