Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Declare a Vector to hold the names of courses offered in theCSC department fo

ID: 3610740 • Letter: 1

Question

1. Declare a Vector to hold the names of courses offered in theCSC department for a given semester. Example, "CSC160 Java","CSC126 Game Design", "CSC116 Logic and Design", etc.

2. Let the user do one of the following options:

    1. Print back the list of courses offeredalong with the number of courses offered  

      (number of elements inVector).

2. Lookup some courses. The user can enter something like Javaand the program will print back any course that has the word Javain it (if any). You might be using some of the String methods suchas the ones used in table 10-3 pg.622.

3. Add a course. The user can add a new course name to the endof the list.

4. Remove a course from the list.

Explanation / Answer

import java.io.*; import java.util.*; import java.lang.*; public class Courses{ public static Vector courses= newVector(); public static void main(String args[]) {    int input = 0;   do{ System.out.println(" type 1 to print the list of courses type 2to lookup some course " +            " type 3to add a course to the end of the list type 4 to remove a coursefrom the list type 5 to exit the program"); //System.out.print("Enter the number for the opearation you want todo: "); try{    input = Integer.parseInt (newBufferedReader(new InputStreamReader(System.in)).readLine()); } catch (Exception e){    e.printStackTrace(); } //input = Integer.parseInt (new BufferedReader(newInputStreamReader(System.in)).readLine()); System.out.println(); if(input ==1) { int length = courses.size(); int c=0; System.out.println("Printing the courses in the list"); while(c