Java
Task 2:
Write a program where you create an ArrayList object that can store letters. Show how can you add a letter to the ArrayList, remove a letter from theArrayList, replace a letter in the ArrayList, insert a letter in a specific location in the ArrayList, and display all the letters in the ArrayList.
Task 3:
Write a program where you create an ArrayList object that can store Circle object (you created circle class in your previous PAs). Create three circle objects with different radius. Show how can you add circle objects to the ArrayList, remove a circle object from theArrayList, replace circle objects in the ArrayList, insert circle objects in a specific location in the ArrayList, and call the methods of circle objects in the ArrayList.
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
Java Task 2: Write a program where you create an ArrayList object that can store letters....
Create a Java program that will store 10 student objects in an ArrayList, ArrayList<Student>. A student object consists of the following fields: int rollno String name String address Implement two comparator classes to sort student objects by name and by rollno (roll number). Implement your own selection sort method and place your code in a separate Java source file. Do not use a sort method from the Java collections library.
JAVA In this PoD you will use an ArrayList to store different pet names (there are no repeats in this list). This PoD can be done in your demo program (where your main method is) – you don’t have to create a separate class for today. Details Create an arraylist of Strings, then using a Scanner object you will first read in a number that will tell you how many pet names (one word) you will add to the arraylist....
Write a code in Java where: Create two subclasses for the geometric objects: a circle, and a rectangle. They must invoke the displayGeometricObject method to display the objects. The displayGeometricObject displays the area and diameter if the object is a circle, and displays area if the object is a rectangle.
3. Create a program named TestArrayList, and declare an ArrayList with an initial capacity of 10. Insert one copy of the string "Python", five copies of the string "Java" followed by four copies of the string "C++" so that your vector is now filled to сараcity. Add a class method named printArrayList to print out all the elements stored within an ArrayList on separate lines. Test your method to be sure it works a) Add a class method named delete...
Create the following program in java please Write a class Store which includes the attributes: store name and sales tax rate. Write another class encapsulating a Book Store, which inherits from Store. A Book Store has the following additional attributes: how many books are sold every year and the average price per book. Code the constructor, accessors, mutators, toString and equals method of the super class Store and the subclass Book Store; In the Book Store class, also code a...
Task 1: 1. Write a generic class named MyList, with a type parameter T. The type parameter T should be constrained to an upper bound: the Number class. The class should have as a field an ArrayList of type T. Write the class constructor to create the ArrayList. 2. Write a public method named add, which accepts a parameter of type T. When an argument is passed to the method, add it to the ArrayList. 3. Write a public method...
JAVA In this PoD you will use an ArrayList to store different cities). This PoD can be done in one file. Details Create an arraylist of Strings, then using a Scanner object you will first read in a number that will tell you how many cities you will add to the arraylist. You should make sure as your read in cities, that you do not add cities that are already in the list (e.g., don’t allow any repeats). Once you...
What if you had to write a program that would keep track of a
list of rectangles? This might be for a house painter to use in
calculating square footage of walls that need paint, or for an
advertising agency to keep track of the space available on
billboards.
The first step would be to define a class where one object
represents one rectangle's length and width. Once we have class
Rectangle, then we can make as many objects of...
Write a c# console program called “ArrayOfThings” where you create a class called Staff with private fields for StaffID and StaffName. Create Properties that can write data and retrieve data from these private fields. Create a Staff array that can hold up to ten Staff objects. Create ten objects using a for loop that automatically creates a new (empty) Staff object at each iteration of the loop and adds that object into the Staff array. Write data into the first...
C++ program Create a class Time having data members HH, MM, SS of type integer. Write a C++ program to do the following: 1. Use a Constructor to initialize HH, MM, SS to 0. 2. Create two Objects of this class and read the values of HH, MM, SS from the user for both objects (Using proper member functions). 3. Use a binary + operator to add these two objects created (Store & display result using separate object). 4. Use...