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...
-
Five friends-Allison, Beth, Carol, Diane, and Evelyn-have identical calculators and are studying for a statistics exam. They set their calculators down in a pile before taking a study break and then...
-
The Hagues, husband and wife, owned a 160 acre tract that they decided to sell. They entered into a listing agreement with Harvey C. Hilgendorf, a licensed real estate broker that gave Hilgendorf the...
-
Analyzing Revenues and Expenses and Preparing a Statement of Earnings LO1-1 Assume that you are the owner of The University Shop, which specializes in items that interest students. At the end of...
-
1. The U. S. Census launched an IT project to arm its census takers in the field with high- tech handheld devices that would save taxpayer money by directly beaming population data to headquarters...
-
Let f(a)
-
The shareholders equity accounts of Tmao Inc. at December 31, 2023, are as follows: Preferred shares, $3 noncumulative, unlimited number authorized, 4,000 issued ......... $400,000 Common shares,...
-
Darby has been working for 14 months at Holden Associates, a large management consulting firm. She is earning $95,000 a year, which sounds good, but does not go very far in New York City. It turns...
-
Find the derivative of (i) x2-1 x+1 (ii) (x logx)
-
A company has depreciation expense of $28,300, interest expense of 11,400, EBIT of $62,700, a price-earnings ratio of 8.6, a net profit margin of 7.2 percent, a tax rate of 21 percent, and 37,500...
-
What specifically do financial leverage ratios measure and how can these be managed toward optimizing financial decisions?
-
Conduct a search and research two to three examples in which a business transaction was underpaid. Write an essay where the following information is provided: Identify the parties and the industry....
-
Community Catering (CC) began as a "meals on wheels" agency, providing dinners to elderly people and individuals who were permanently or temporarily homebound. Almost all of its clients were single...
-
= -2x+4& For the functions f (x) g(x) = 5x, evaluate f (x) = 14 for 'x'. X digite sua resposta...
-
Calculate Total Contribution Margin for the same items. Total Revenue Total Variable Costs Total Contribution Margin $50.00 a. $116.00 $329.70 b. $275.00 $14,796.00 $7,440.00 c. $40,931.25 d....
-
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 the Chief Accountant of JKL plc, a UK company that has three wholly-owned overseas subsidiaries. - Company A is located in Spain. The company assembles computer terminals from materials...
-
Groups of companies with overseas branches and subsidiaries have problems in determining the manner in which their results are included in the consolidated and parent company accounts....
-
The balance sheets of UK plc and its subsidiary undertaking Germany GmbH at 31 March 1996 and their profit and loss accounts for the twelve months then ended are given overleaf: Germany GmbH operates...
Study smarter with the SolutionInn App