Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 13, Problem 13.13PE
Program Plan Intro

Course.Java

Program Plan:

  • Include a class name named ““Exercise_13_13”.
    • Declare package.
    • Declare main method.
    • A Course object “course1” is created referencing “course” class..
    • Three students are added into the course.
    • “course1” is cloned using “clone()” method and named as “course2”.
    • Two students are added to “course2”.
    • The names of students in “course1” are displayed.
      • Display names by traversing through the course array.
    • The names of students in “course2” are displayed.
      • Display names by traversing through the course array.
    • Close the main method.
  • Close the class.
  • Include a class name named “Course”.
    • Declare package.
    • Declare main method.
    • Declare string “courseName”.
    • Declare a String array with size 100.
    • Declare an integer “numberOfStudents”.
    • Declare a constructor.
    • Declare a method “addStudent” to add the number of students.
    • Declare a method “GetStudents” to return students.
    • Declare a method to return number of students.
    • Declare a method to return course name.
    • The protected clone method defined in the Object class is overridden and its accessibility is strengthened.
      • A shallow copy using clone() method is done.
      • Deep copy on students using clone() method from Course class is performed.
    • Declare a string method to drop Student names.
    • Close the main method.
  • Close the class.

Blurred answer
Students have asked these similar questions
(Java) Open up Eclipse and create a new class called ArrayListPractice.java Next, copy and paste the below program into your file and run the code. Your job is to take the given code, remove all the arrays and replace them with the identical ArrayLists. There should be no arrays in your program. You will need to call the ArrayList methods as defined in the lesson notes above. Note that you will not be able to do method overloading with ArrayLists so you should assign different names to your methods. Once you have made the changes, you should get identical output as the given version of the program. Submit your program when you are finished. /**   * @author  * CIS 36B  * Activity 5.2   */ import java.util.ArrayList; import java.util.Scanner; public class ArrayListPractice {     public static void main(String[] args) {                  int scores[] = {95, 96, 97, 98, 99};         System.out.println("Integer test scores:");         print(scores);          System.out.println();…
(Java) Open up Eclipse and create a new class called ArrayListPractice.java Next, copy and paste the below program into your file and run the code. Your job is to take the given code, remove all the arrays and replace them with the identical ArrayLists. There should be no arrays in your program. You will need to call the ArrayList methods as defined in the lesson notes above. Note that you will not be able to do method overloading with ArrayLists so you should assign different names to your methods. Once you have made the changes, you should get identical output as the given version of the program. Submit your program when you are finished. /** * @author * CIS 36B * Activity 5.2 */import java.util.ArrayList;import java.util.Scanner;public class ArrayListPractice {    public static void main(String[] args) {                int scores[] = {95, 96, 97, 98, 99};        System.out.println("Integer exam scores:");        print(scores);        System.out.println();…
(Geometry: MyRectangle2D class)  Define the  MyRectangle2D class that contains:  Two double data fields named x and y that specify the center of the rectangle with getter and setter methods. (Assume the rectangle sides are parallel to the x- or y-axis.) The data fields width and height with getter and setter methods. A no-arg constructor that creates a default rectangle with (0, 0) for (x, y) and 1 for both width and height. A Constructor that creates a rectangle with the specified x, y, width, and height. A method getArea() that returns the area of the rectangle. A method getPerimeter() that returns the perimeter of the rectangle. A method contains(double x, double y) that returns true if the specified point (x, y) is inside this rectangle (see Figure 10.24a ). A method contains(MyRectangle2D r) that returns true if the specified rectangle is inside this rectangle (see Figure 10.24b ). A method overlaps(MyRectangle2D r) that returns true if the specified rectangle overlaps with this…

Chapter 13 Solutions

Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)

Ch. 13.4 - How do you create a Calendar object for the...Ch. 13.4 - For a Calendar object c, how do you get its year,...Ch. 13.5 - Prob. 13.5.1CPCh. 13.5 - Prob. 13.5.2CPCh. 13.5 - Prob. 13.5.3CPCh. 13.5 - Prob. 13.5.4CPCh. 13.6 - Prob. 13.6.1CPCh. 13.6 - Prob. 13.6.2CPCh. 13.6 - Can the following code be compiled? Why? Integer...Ch. 13.6 - Prob. 13.6.4CPCh. 13.6 - What is wrong in the following code? public class...Ch. 13.6 - Prob. 13.6.6CPCh. 13.6 - Listing 13.5 has an error. If you add list.add...Ch. 13.7 - Can a class invoke the super.clone() when...Ch. 13.7 - Prob. 13.7.2CPCh. 13.7 - Show the output of the following code:...Ch. 13.7 - Prob. 13.7.4CPCh. 13.7 - What is wrong in the following code? public class...Ch. 13.7 - Show the output of the following code: public...Ch. 13.8 - Prob. 13.8.1CPCh. 13.8 - Prob. 13.8.2CPCh. 13.8 - Prob. 13.8.3CPCh. 13.9 - Show the output of the following code: Rational r1...Ch. 13.9 - Prob. 13.9.2CPCh. 13.9 - Prob. 13.9.3CPCh. 13.9 - Simplify the code in lines 8285 in Listing 13.13...Ch. 13.9 - Prob. 13.9.5CPCh. 13.9 - The preceding question shows a bug in the toString...Ch. 13.10 - Describe class-design guidelines.Ch. 13 - (Triangle class) Design a new Triangle class that...Ch. 13 - (Shuffle ArrayList) Write the following method...Ch. 13 - (Sort ArrayList) Write the following method that...Ch. 13 - (Display calendars) Rewrite the PrintCalendar...Ch. 13 - (Enable GeometricObject comparable) Modify the...Ch. 13 - Prob. 13.6PECh. 13 - (The Colorable interface) Design an interface...Ch. 13 - (Revise the MyStack class) Rewrite the MyStack...Ch. 13 - Prob. 13.9PECh. 13 - Prob. 13.10PECh. 13 - (The Octagon class) Write a class named Octagon...Ch. 13 - Prob. 13.12PECh. 13 - Prob. 13.13PECh. 13 - (Demonstrate the benefits of encapsulation)...Ch. 13 - Prob. 13.15PECh. 13 - (Math: The Complex class) A complex number is a...Ch. 13 - (Use the Rational class) Write a program that...Ch. 13 - (Convert decimals to fractious) Write a program...Ch. 13 - (Algebra: solve quadratic equations) Rewrite...Ch. 13 - (Algebra: vertex form equations) The equation of a...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education