page1
8/30/2023
1
COMP 210 – Data Structures and Analysis (Sections 1 & 2)
Assignment #1 – Part 2 – Getting Started
Issue Date: August 30, 2023.
Due Date: Wednesday September 6
th
, 11:55pm
Total Points: 5. Part 3 = 4 Points.
Student Name: Rushil Umaretiya
Student PID: 730677144
Rules for ALL HWs (in addition to any statements in the syllabus):
You are encouraged to discuss the homework assignments and study together in groups,
but when it comes to formulating/writing/coding solutions you must work alone and
independently. If required, you should be able to explain your answer clearly to TAs/LAs.
Copying homework solutions from another student, from the Internet, solution sets of
friends, or other sources will be considered cheating and treated accordingly.
Part 2 (4 Points)
In this part you are required to write an additional Java program and answer questions
given below. This part will be manually graded and you should provide your responses in
the spaces below and then upload this file as a pdf in Gradescope “Assignment 1 –
Part 2”.
i)
In the same package (assn01) create another java class called “Part2”, with a
“main” method that does the following:
•
Declares a variable short sh, which is to be set to the largest short integer.
•
Then calls another static method “method2”.
ii)
Create “method2” that:
•
Declares a (Hex) int n2 = 0xABC, and prints out the number as a decimal.
•
Calls another static method “method3”.
iii)
Create “method3” that:
•
Declares an array int[] a3 = {‘a’, ‘z’}
•
Runs the following statement: System.out.println(a3[0]+" "+ a3[1]);