1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Blababa [14]
4 years ago
7

Write a program that creates an ArrayList and adds a Loan object, a Date object, a string, and a Circle object to the list, and

use a loop to display all the elements in the list by invoking the object’s toString() method. Hint: Remember every class in Java is descended from the java.lang.Object class. Define Generic Type E appropriately for the ArrayList.
Computers and Technology
1 answer:
12345 [234]4 years ago
6 0

Answer:

//importing package java.util.ArrayList to use ArrayList in the program

import java.util.ArrayList;

import java.util.Date;

public class test_array_list {

// Main method

public static void main(String[] args) {

 // Create an array list of objects

 ArrayList<Object> s = new ArrayList<Object>();

 s.add(new Loan());  

 s.add(new Date());  

 s.add(new String("String class"));

 s.add(new Circle());

 // Display all the elements in the list by

 // invoking the object’s to String() method

 for (int element = 0; element < o.size(); element++) {

  System.out.println((s.get(element)).toString());

 }

}

}

Explanation:

The Above code has proper comments to which is self explanatory.

You might be interested in
you are researching the Holocaust for a school paper and have located several Web sites for information. In a paragraph of no le
jeka94
1. .com .org .edu those have a big part because .com is profit and .org is non profit. 
2. It shows who wrote it 
3. It shows a bio of who wrote it (So you know their actually qualified) 
4. And it has sources to back up for what they say.
7 0
3 years ago
Which magazie can help the public determine the best technology to use
wariber [46]
Well you can read about technology in maybe tec company magazines like apple magazines or samsung magazines on which are best to buy Hope this helps:)
3 0
4 years ago
Write a program that accepts an integer value called multiplier as user input. Create an array of integers with ARRAY_SIZE eleme
Tasya [4]

Answer:

The program in C++ is as follows:

#include <iostream>

using namespace std;

void PrintForward(int myarray[], int size){

   for(int i = 0; i<size;i++){        cout<<myarray[i]<<" ";    }

}

void PrintBackward(int myarray[], int size){

   for(int i = size-1; i>=0;i--){        cout<<myarray[i]<<" ";    }

}

int main(){

   const int ARRAY_SIZE = 12;

   int multiplier;

   cout<<"Multiplier: ";

   cin>>multiplier;

   int myarray [ARRAY_SIZE];

   for(int i = 0; i<ARRAY_SIZE;i++){        myarray[i] = i * multiplier;    }

   PrintForward(myarray,ARRAY_SIZE);

   PrintBackward(myarray,ARRAY_SIZE);

   return 0;}

Explanation:

The PrintForward function begins here

void PrintForward(int myarray[], int size){

This iterates through the array in ascending order and print each array element

<em>    for(int i = 0; i<size;i++){        cout<<myarray[i]<<" ";    }</em>

}

The PrintBackward function begins here

void PrintBackward(int myarray[], int size){

This iterates through the array in descending order and print each array element

<em>    for(int i = size-1; i>=0;i--){        cout<<myarray[i]<<" ";    }</em>

}

The main begins here

int main(){

This declares and initializes the array size

   const int ARRAY_SIZE = 12;

This declares the multiplier as an integer

   int multiplier;

This gets input for the multiplier

   cout<<"Multiplier: ";    cin>>multiplier;

This declares the array

   int myarray [ARRAY_SIZE];

This iterates through the array and populate the array by i * multiplier

<em>    for(int i = 0; i<ARRAY_SIZE;i++){        myarray[i] = i * multiplier;    }</em>

This calls the PrintForward method

   PrintForward(myarray,ARRAY_SIZE);

This calls the PrintBackward method

   PrintBackward(myarray,ARRAY_SIZE);

   return 0;}

6 0
3 years ago
Some problems are better solved by a computer and some are better solved by humans.
aalyn [17]

Answer:

I say when u don't know the answer completly.

3 0
3 years ago
Cleo received a message from Joline that was sent to her as well as two other coworkers named Sam and Thomas. Cleo
babymother [125]

Answer:

Cleo would choose the option "Forward"

Explanation:

Reply means reply to a single person

Reply All means to reply to the entire thread

Forward means to send the email to another

Copy means to copy the email, but it doesn't send

7 0
3 years ago
Read 2 more answers
Other questions:
  • WILL GIVE BRAINLIEST! An ________________ is a list of steps needed to answer a problem or finish a task. When the code is execu
    14·2 answers
  • Someone plzzzzz help me!!!
    6·1 answer
  • Clicking a _____ name opens a drop-down list of commands and options. Select one: a. menu b. status bar c. ribbon d. toolbar
    15·1 answer
  • _____ is a technique in which computers are designed with many microprocessors that work together, simultaneously, to solve prob
    15·1 answer
  • For local patterns that change quickly, these methods are preferred 1. data driven 2. model drive 3. trend and seasonality drive
    10·1 answer
  • Stages of reverse engineering
    8·1 answer
  • If you Buy my group clothing in R.o.b.l.o.x for a donation i will make you brainliest
    14·2 answers
  • Kelly has always used "P4ssw0rd” as her password on her online accounts. Why should she change this? Check all that apply.
    8·2 answers
  • Your company is getting negative feedback on the current customer service process. It’s your job to make sure customers are happ
    10·1 answer
  • What type of loop allows you to indicate the starting value for the loop control variable, the test condition that controls loop
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!