DOWNLOAD
CSE205 Object Oriented Programming and Data Structures
Homework 1 :: 25 pts
1 Submission Instructions
Create a document using your favorite word processor and type your exercise solutions. At the top of the document be
sure to include your name and the homework assignment number, e.g. HW1. Convert this document into Adobe PDF
format and name the PDF file <asuriteid>.pdf where <asuriteid> is your ASURITE user id (for example, my ASURITE
user id is kburger2 so my file would be named kburger2.pdf). To convert your document into PDF format, Microsoft Office
versions 2008 and newer will export the document into PDF format by selecting the proper menu item from the File
menu. The same is true of Open Office and Libre Office. Otherwise, you may use a freeware PDF converter program, e.g.,
CutePDF is one such program.
Next, create a folder named <asuriteid> and copy <asuriteid>.pdf to that folder. Copy any Java source code files to this
folder (note: Java source code files are the files with a .java file name extension; do not copy the .class files as we do not
need those).
Next, compress the <asuriteid> folder creating a zip archive file named <asuriteid>.zip. Upload <asuriteid>.zip to the
Homework Assignment 1 dropbox by the assignment deadline. The deadline is 11:59pm Wed 26 Mar. Consult the online
syllabus for the late and academic integrity policies.
Note: not all of these exercises will be graded, i.e., random ones will be selected for grading.
2 Learning Objectives
1.
2.
3.
4.
5.
6.
7.
Use the Integer and Double wrapper classes.
Declare and use ArrayList class objects.
Write code to read from, and write to, text files.
Write an exception handler for an I/O exception.
Write Java classes and instantiate objects of those classes.
Read UML class diagrams and convert the diagram into Java classes.
Identify and implement dependency, aggregation, inheritance, and composition relationships.
3 ArrayLists
3.1
Write code that creates an ArrayList<Integer> object named list and fills list with these numbers (using one or a
pair of for or while loops):
0
3.2
1
2
3
4
0
1
2
3
4
Consider the ArrayList<Integer> object named list containing these Integers:
list = { 1, 2, 3, 4, 5, 4, 3, 2, 1, 0 }
What are the contents of list after this loop completes?
for (int i = 1; i < 10; ++i) {
CSE205 Object Oriented Programming and Data Structures
Homework 1 :: 25 pts
1 Submission Instructions
Create a document using your favorite word processor and type your exercise solutions. At the top of the document be
sure to include your name and the homework assignment number, e.g. HW1. Convert this document into Adobe PDF
format and name the PDF file <asuriteid>.pdf where <asuriteid> is your ASURITE user id (for example, my ASURITE
user id is kburger2 so my file would be named kburger2.pdf). To convert your document into PDF format, Microsoft Office
versions 2008 and newer will export the document into PDF format by selecting the proper menu item from the File
menu. The same is true of Open Office and Libre Office. Otherwise, you may use a freeware PDF converter program, e.g.,
CutePDF is one such program.
Next, create a folder named <asuriteid> and copy <asuriteid>.pdf to that folder. Copy any Java source code files to this
folder (note: Java source code files are the files with a .java file name extension; do not copy the .class files as we do not
need those).
Next, compress the <asuriteid> folder creating a zip archive file named <asuriteid>.zip. Upload <asuriteid>.zip to the
Homework Assignment 1 dropbox by the assignment deadline. The deadline is 11:59pm Wed 26 Mar. Consult the online
syllabus for the late and academic integrity policies.
Note: not all of these exercises will be graded, i.e., random ones will be selected for grading.
2 Learning Objectives
1.
2.
3.
4.
5.
6.
7.
Use the Integer and Double wrapper classes.
Declare and use ArrayList class objects.
Write code to read from, and write to, text files.
Write an exception handler for an I/O exception.
Write Java classes and instantiate objects of those classes.
Read UML class diagrams and convert the diagram into Java classes.
Identify and implement dependency, aggregation, inheritance, and composition relationships.
3 ArrayLists
3.1
Write code that creates an ArrayList<Integer> object named list and fills list with these numbers (using one or a
pair of for or while loops):
0
3.2
1
2
3
4
0
1
2
3
4
Consider the ArrayList<Integer> object named list containing these Integers:
list = { 1, 2, 3, 4, 5, 4, 3, 2, 1, 0 }
What are the contents of list after this loop completes?
for (int i = 1; i < 10; ++i) {
Комментариев нет:
Отправить комментарий