Implement the following classes: 1. class Course that includes two instance variables: private String Name; //...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Implement the following classes: 1. class Course that includes two instance variables: private String Name; // the course name private int ID; // the course ID Your class should have the following: • A constructor that initializes the two instance variables ID and Name. • Set and get methods for each instance variable. • toString method that returns a String representation of the Course as (ID Name) 2. class Department that includes three instance variables: private String deptName; private Course CRS[]: private int noofCourses: Your class should have the following: . • a constructor that initializes the department name, set noorCourses and creates the array with size noofCourses • public boolean exist(int id) that checks whether the course object with id passed as parameter exists in the array or not. public void addCourse (int id, String name) creates and adds the course if the course with id passed as parameter does not exist in the array. • public void deleteCourse (int id) to delete a course if it exists in the array and displays a proper message. • public void printCourses () that prints the department name and all the courses in the array. • public void printCoursesRecursively () that prints the department name and all the courses in the array recursively. [Hint: write an additional private helper method] • public Course maxRecursive () that searches the courses array in the department class for the course with max id. [Hint: write an additional private helper method] Write the expected time and space complexity as a comment at the beginning of each method of your class. Implement the following classes: 1. class Course that includes two instance variables: private String Name; // the course name private int ID; // the course ID Your class should have the following: • A constructor that initializes the two instance variables ID and Name. • Set and get methods for each instance variable. • toString method that returns a String representation of the Course as (ID Name) 2. class Department that includes three instance variables: private String deptName; private Course CRS[]: private int noofCourses: Your class should have the following: . • a constructor that initializes the department name, set noorCourses and creates the array with size noofCourses • public boolean exist(int id) that checks whether the course object with id passed as parameter exists in the array or not. public void addCourse (int id, String name) creates and adds the course if the course with id passed as parameter does not exist in the array. • public void deleteCourse (int id) to delete a course if it exists in the array and displays a proper message. • public void printCourses () that prints the department name and all the courses in the array. • public void printCoursesRecursively () that prints the department name and all the courses in the array recursively. [Hint: write an additional private helper method] • public Course maxRecursive () that searches the courses array in the department class for the course with max id. [Hint: write an additional private helper method] Write the expected time and space complexity as a comment at the beginning of each method of your class.
Expert Answer:
Answer rating: 100% (QA)
It appears you have an assignment to implement two classes Course and Department Below are the implementations for the classes based on the requiremen... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Suppose that a monopolist sells a product to men and women. If the firm sets a single price, the monopolist would produce 100,000 units and sell them at a price of $5.00 per unit. Suppose that at...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Solve this in python. **[70 pts]** You will be writing code for recording the menuitems and daily sales of a lemonade stand. It will have theseclasses: MenuItem, SalesForDay, and LemonadeStand. All...
-
1. Suppose that a stoichiometric mixture of isooctane (C8H18) and air is burned in an engine and then the fuel is changed to 10% (by liquid volume) ethanol and 90% by liquid volume isooctane. If the...
-
Draw the shear and moment diagrams for the shaft. The support at A is a thrust bearing and at B it is a journal bearing. Units Used: kN = 103 N Given: w = 2kN/m F = 4 kN a = 0.8 m b = 0.2 m B
-
2. The City of Odessa maintains its books so as to prepare fund accounting statements and prepares worksheet adjustments in order to prepare government-wide statements. As such, the City's internal...
-
The concentration of $\mathrm{NbOCl}_{3}$ in a tube-flow reactor as a function of several controllable variables is shown in Table B.6. a. Fit a multiple regression model relating concentration of...
-
Ann McCutcheon is hired as a consultant to a firm producing ball bearings. This firm sells in two distinct markets, each of which is completely sealed off from the other. The demand curve for the...
-
dditional questions 1. Boris is a trader in fresh fruits. During June 2017, he reported sales of $120,000. His opening stock was $26,000 and purchases for the month was $114,000. Mark up is 50%. What...
-
A new chemical production facility that is under construction is expected to be in full commercial operation one year from now. Once in full operation, the facility will generate $95,000 cash profit...
-
34-1 Signals g1(t) = 10*n(10*r) and 82(1) = 6(1) are applied at the inputs of the ideal low-pass filters H; (f) = nf/20,000) and H2(f) = 1( /10,000) (Fig. P3.4-1). The outputs y (1) and y2(0) of...
-
Identify two inappropriate themes in the partners set. Justify your response. Karen Swanson and Gabriel Russell recently co-founded Green Savanah Securities, an asset management firm conducting...
-
Which of the following qualitative considerations is most associated with determining whether investment manager selection will result in superior repeatable performance? A. Transparency B....
-
Which of the following is most likely a key consideration in investment due diligence? A. Suitability of the investment vehicle B. Back office processes and procedures C. Depth of expertise and...
-
Determine the veracity of each comment. Justify each response. Beatrice Minchow designs and implements algorithmic trading strategies for Enlightenment Era Partners LLC (EEP). Minchow is working with...
-
A decision-making investor is most likely to worry more about making a Type I error than a Type II error because: A. Type II errors are errors of commission. B. Type I errors are more easily...
-
O O O Which is corresponded to zoom mouse wheel? zoom in / zoom out pan & scan scale extents / all
-
What do you think?
-
Repeat Exercise 18 in Chapter 1, but define and use named constants. Exercise 18 Write statements that can be used in a JavaFX application to draw the five interlocking rings that are the symbol of...
-
Create a JavaFX application that will draw a spiral using line segments. The equations for the points on a spiral are: You should draw 150 points. Start at 0 and increase it by 0.1 for each new...
-
Repeat Exercises 6 and 7 in Chapter 7, but use an instance of ArrayList instead of an array. We will no longer need to know the maximum number of sales, so the methods will change to reflect this....
-
You are to open the books of F. Polk, a trader, via the journal to record the assets and liabilities, and are then to record the dialy transactions for the month of May. A trial balance is to be...
-
Show the journal entries necessary to record the following items: 2017 Apr 1 Bought office furniture on credit from Durham Brothers Ltd 1,400. 4 We take goods costing 270 out of the business...
-
You are to show the journal entries necessary to record the following items which occured in 2016: (a) May 1 Bought a motor bike on credit from Lakeside Garage for 5,500. (b) May 3 A debt of 347...
Study smarter with the SolutionInn App