0% found this document useful (0 votes)
18 views

Array Scanner Class Obj

The document contains instructions for three coding tasks: 1) Creating and manipulating arrays, 2) Defining a class with attributes/methods to store and display student data, 3) Defining a class with arrays as attributes and methods to input/output product data.

Uploaded by

Nguyên Hưng
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Array Scanner Class Obj

The document contains instructions for three coding tasks: 1) Creating and manipulating arrays, 2) Defining a class with attributes/methods to store and display student data, 3) Defining a class with arrays as attributes and methods to input/output product data.

Uploaded by

Nguyên Hưng
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Array task:

------------
1. Create an array A1 with some integers in it ... {12,34,56,89,32,4,6,78,98,21,12}
2. Print A1 on console
3. Replace the third element of A1 with 99. (56 will become 99)
4. Now create another array A2 which is equal in length to A1
5. Copy A1 to A2.
6. Print A2.
---------------------------

Class-Object task:
-----------------------
1. Create a class called Students with no main method
2. Students class has following attributes..
- s_id
- s_fname
- s_lname
- s_roll
- s_subject
3. Student class has an empty constructor method
4. Student class has the get()/set() Methods for all its attributes mentioned above
5. Student class also has an additional methods ...
- void print () .... prints details of a Student
6. Now create another Class called "TestStudents"
7. This class has a main method
8. Create three objects (s1, s2, s3) of Students class to display the info of these
3 students.
9. Remember, you need to use the setter methods to set the info for individual
students.
--------------------------------------------

Class-Object task:
--------------------
1. Craete a class called ProductList
2. Declare three arrays in it
- id [3] is an int array
- name[3] is a String array
- price[3] is a double array
3. Create a method getInfo() to Scan inputs from keyboard to fill these arrays with
3 ids 3 names and 3 prices. Use a for loop.
4. Create a method showInfo() to display the Product List with all 3 products.
5. Create aniother class CheckList with a main method
6. Create an object of class ProductList to call the above methods.

You might also like