Question

We learn arrays (and Arrays class) in Chapter 10 and ArrayList collection in Chapter 14. This...

We learn arrays (and Arrays class) in Chapter 10 and ArrayList collection in Chapter 14.

This assignment asks you to re-do Assignment 4 by using arrays and ArrayList collections to deliver exactly the same output. The input also stays the same, which are two argument values entered at the command line when 'java' command is issued.

With the use of these data structures that help to store data in certain way, you are not going to print each character immediately but store it in the array of array of ArrayList, then, when it's time to print them out, you retrieve elements of the array or array of ArrayList and print (or process) them. Therefore, one advantage of using a data structure is you are able to hold or memorize all data and take the data structure anywhere it is needed (e.g., passing an array to a method to be processed or modified as seen in some of the practice problems for Chapter 10). Until the program execution ends, all data are available from the data structure used. **If data needs to be available from one execution to another, then, a file or database needs to be used for permanent storage.

Your work for this assignment should be saved in a folder 'Assignment5' containing only two files: Assignment5_1.java and Assignment5_2.java. Then zip the entire folder to Assignment5.zip and upload it for grading.

General Grading Requirements

For full credit of 60 points of this assignment, your submission must satisfy all of the following:

  1. Using JDK or NetBeans is still up to you, but the zip file uploaded must meet the above description and submit on time.
  2. Good coding style in each .java source file. So far, good coding style is not addressed by each assignment, but, starting this one, it is a requirement for full credit. You will lose up to 20% of the possible total because of poor coding style presented, depending on how bad the style your code is written and formatted. Coding style is not a "standard". Every example program in the textbook shows a popular and good coding style that you can follow. Or, you may reference one defined and used by Google at Google Java Style Guide (Links to an external site.)Links to an external site..
  3. Each .java file must compile with no errors and execute to meet all requirements specified below. Like other assignments and quizzes, you receive zero credit if file(s) cannot compile successfully.

Coding Requirements of Assignment5_1.java

Based on Assignment4.java, re-do all 7 methods from triangle_0 to triangle_6 by storing characters (which could be symbols or digits) in a 2D "square" array, meaning it has equal number of rows and columns. Using such a square array makes the code easier because there is no need to declare arrays of different sizes for rows of the triangle. However, because each triangle is supposed to contain rows filled with different number of characters, you are required to fill each row with only required number of characters in this square array. For example, in an up-side-down 8-row triangle of "@", the 3rd row from top should be filled with only 6 "@" and leave two not assigned with anything (i.e., each is null).

This assignment also requires to change all while-loop statements to for-loop statements, or the other way around, depending which you used in Assignment4. For example, if you used 16 while-loop statements and 8 for-loop statements in Assignment4, they should be changed to 16 for-loop statements and 8 while-loop statements in each program of in Assignment 5. For each method of triangle_x, you should comment out the entire block of statements of the method you did in Assignment4, and write new statements on top of the comment. This allows your old method to be compared and verified with the new one developed in this work.

Finally, because you won't print every character and line as in Assignment4, instead, you store them in arrays. So, to print the array to show the triangle at the end of each triangle_x method, you are particularly required to use only enhanced for-loop statements, i.e., the one using ":" with no counter or index variables.

Coding Requirements of Assignment5_2.java

Based on Assignment4.java, re-do all 7 methods from triangle_0 to triangle_6 by storing characters in an array of ArrayList, meaning each element of the array is an ArrayList, and each ArrayList represents one line or row of a triangle.

We discussed array and ArrayList in class but separately, how to create and use an array of ArrayList becomes a part of your own research. There are many books or online materials can help. For your convenience, you may read 'Array of ArrayList in Java (Links to an external site.)Links to an external site.' for helpful information and examples. There are many others you could find online. Be sure you don't get confused by array of ArrayList andArrayList of array, which are two very different data structures. Also, be sure you construct and initialize not only array but also every ArrayList contained in the array. If you don't, your code won't even compile. This is because there are two structures, one in the other, and they both need to be constructed and initialized (even with no explicit data assigned.)

Because each triangle is supposed to contain lines filled with different number of characters, every ArrayList in the array will be populated with different number of elements (ranged from 1 to the number entered in command line). From the array's view, it is an one-dimensional array, but, because each element is an ArrayList of unique size, this array of ArrayList makes a "triangle" data structure. Compared to the "square" arrays used in Assignment5_1, which wastes 50% unfilled elements, the array of ArrayList is more efficient in memory usage of your computer.

Like Assignment5_1, this assignment also requires to change all while-loop statements to for-loop statements, or the other way around, depending which you used in Assignment4. For each method of triangle_x, you should comment out the entire block of statements of the method you did in Assignment4, and write new statements on top of the comment. This allows your old method to be compared and verified with the new one in this work.

Also like Assignment5_1, to print the array of ArrayList to show the triangle at the end of each triangle_x method, you are particularly required to use only enhanced for-loop statements, i.e., the one using ":" with no counter or index variable.

Assignment 4:

public class Assignment4 {
public static void main(String args[]) {
int Tlines;
Tlines = Integer.parseInt(args[0]);
  
triangle0(Tlines);
  

triangle_1(Tlines, args[1]);
triangle_2(Tlines);
triangle_3(Tlines);
triangle_4(Tlines, args[1]);
triangle_5(Tlines);
triangle_6(Tlines);
}
  
private static void triangle0(int params) {
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle0\n");
while (Tlines <= params) {
while (x >= 1) {
if (x == 1) {
System.out.println(">");
} else
System.out.print(">");
x -= 1;
}
Tlines += 1;
x = params - Tlines;
}
}
  

private static void triangle_1(int params, String paramString)
{
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle 1\n");
while (Tlines <= params) {
while (x >= 1) {
if (x == 1) {
System.out.println(paramString);
} else
System.out.print(paramString);
x -= 1;
}
Tlines += 1;
x = params - Tlines;
}
}
  
private static void triangle_2(int params) {
int Tlines = params;int x = params;
  
System.out.println("\ntriangle 2\n");
while (Tlines >= 1) {
while (x >= 1) {
if (x == 1) {
System.out.println(Tlines);
} else
System.out.print(Tlines);
x -= 1;
}
Tlines -= 1;
x = Tlines;
}
}
  
private static void triangle_3(int params) {
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle 3\n");
while (Tlines <= params) {
while (x >= 1) {
if (x == 1) {
System.out.println("%");
} else
System.out.print("%");
x -= 1;
}
Tlines += 1;
x = params - Tlines;
}
}
  
private static void triangle_4(int params, String paramString) {
int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 4\n");
while (Tlines <= params) {
while (x <= Tlines) {
if (x == Tlines) {
System.out.println(paramString);
} else
System.out.print(paramString);
x += 1;
}
Tlines += 1;
x = 1;
}
}
  
private static void triangle_5(int params) {
int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 5\n");
while (Tlines <= params) {
while (x <= Tlines) {
if (x == Tlines) {
System.out.println(Tlines);
} else
System.out.print(Tlines);
x += 1;
}
Tlines += 1;
x = 1;
}
}
  
private static void triangle_6(int params) {
int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 6\n");
while (Tlines <= params) {
while (x <= Tlines) {
if (x == Tlines) {
System.out.println(x);
} else
System.out.print(x);
x += 1;
}
Tlines += 1;
x = 1;
}
}
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

here is the code for the first assignment

public class Assignment5_1 {
public static void main(String args[]) {
int Tlines;
Tlines = nteger.parseInt(args[0]);
  
triangle0(Tlines);
  

triangle_1(Tlines, args[1]);
triangle_2(Tlines);
triangle_3(Tlines);
triangle_4(Tlines, args[1]);
triangle_5(Tlines);
triangle_6(Tlines);
}
  
private static void triangle0(int params) {
char [][]arr= new char[params][params];
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle0\n");
for( Tlines=0;Tlines<params;Tlines++){
for( x=params-Tlines-1;x>=0;x--)
{
arr[Tlines][x]='>';
}
}
for(char[] i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}
/*
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle0\n");
while (Tlines <= params) {
while (x >= 1) {
if (x == 1) {
System.out.println(">");
} else
System.out.print(">");
x -= 1;
}
Tlines += 1;
x = params - Tlines;
}
*/
}
  

private static void triangle_1(int params, String paramString)
{
char [][]arr= new char[params][params];
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle 1\n");
for(;Tlines<params;Tlines++) {
for(x=params-Tlines-1;x>=0;x--) {

arr[Tlines][x]=paramString.charAt(0);

}
}


for(char[] i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}
/*
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle 1\n");
while (Tlines <= params) {
while (x >= 1) {
if (x == 1) {
System.out.println(paramString);
} else
System.out.print(paramString);
x -= 1;
}
Tlines += 1;
x = params - Tlines;
}*/
}
  
private static void triangle_2(int params) {
char [][]arr= new char[params][params];
int Tlines = params;int x = params;
  
System.out.println("\ntriangle 2\n");
for(Tlines=params;Tlines>=1;Tlines--) {
for(x=Tlines;x>=1;x--) {
arr[params-Tlines][x-1]=Character.forDigit(Tlines,10);
}
}
for(char[] i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}
/*
int Tlines = params;int x = params;
  
System.out.println("\ntriangle 2\n");
while (Tlines >= 1) {
while (x >= 1) {
if (x == 1) {
System.out.println(Tlines);
} else
System.out.print(Tlines);
x -= 1;
}
Tlines -= 1;
x = Tlines;
}
*/
}
  
private static void triangle_3(int params) {
char [][]arr= new char[params][params];

int Tlines = 0;int x = params;
  
System.out.println("\ntriangle 3\n");
for( Tlines=0;Tlines<params;Tlines++){
for( x=params-Tlines-1;x>=0;x--)
{
arr[Tlines][x]='%';
}
}
for(char[] i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}


/*
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle 3\n");
while (Tlines <= params) {
while (x >= 1) {
if (x == 1) {
System.out.println("%");
} else
System.out.print("%");
x -= 1;
}
Tlines += 1;
x = params - Tlines;
}
*/
}
  
private static void triangle_4(int params, String paramString) {
char [][]arr= new char[params][params];
int Tlines = 0;int x = 1;
  
System.out.println("\ntriangle 4\n");
for(;Tlines<params;Tlines++) {
for(x=0;x<=Tlines;x++) {
arr[Tlines][x]=paramString.charAt(0);
}}
for(char[] i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}

/*
int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 4\n");
while (Tlines <= params) {
while (x <= Tlines) {
if (x == Tlines) {
System.out.println(paramString);
} else
System.out.print(paramString);
x += 1;
}
Tlines += 1;
x = 1;
}*/
}
  
private static void triangle_5(int params) {
char [][]arr= new char[params][params];

int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 5\n");
for(Tlines=1;Tlines<=params;Tlines++) {
for(x=1;x<=Tlines;x++){
arr[Tlines-1][x-1]=Character.forDigit(Tlines,10);
}}
for(char[] i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}
/*
int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 5\n");
while (Tlines <= params) {
while (x <= Tlines) {
if (x == Tlines) {
System.out.println(Tlines);
} else
System.out.print(Tlines);
x += 1;
}
Tlines += 1;
x = 1;
}*/
}
  
private static void triangle_6(int params) {
char [][]arr= new char[params][params];

int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 6\n");
for(Tlines=1;Tlines<=params;Tlines++) {
for(x=1;x<=Tlines;x++) {
arr[Tlines-1][x-1]=Character.forDigit(x,10);
}
}
for(char[] i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}


/*
int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 6\n");
while (Tlines <= params) {
while (x <= Tlines) {
if (x == Tlines) {
System.out.println(x);
} else
System.out.print(x);
x += 1;
}
Tlines += 1;
x = 1;
}*/
}
}

Here is the code for the second assignment

import java.util.*;
public class Assignment5_2 {
public static void main(String args[]) {
int Tlines;
Tlines = Integer.parseInt(args[0]);
  
triangle0(Tlines);
  

triangle_1(Tlines, args[1]);
triangle_2(Tlines);
triangle_3(Tlines);
triangle_4(Tlines, args[1]);
triangle_5(Tlines);
triangle_6(Tlines);
}
  
private static void triangle0(int params) {
ArrayList<Character>[] arr = new ArrayList[params];
  
// initializing
for (int i = 0; i < params; i++) {
arr[i] = new ArrayList<Character>();
}
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle0\n");
for( Tlines=0;Tlines<params;Tlines++){
for( x=params-Tlines-1;x>=0;x--)
{
arr[Tlines].add('>');
}
}
for(ArrayList<Character> i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}
/*
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle0\n");
while (Tlines <= params) {
while (x >= 1) {
if (x == 1) {
System.out.println(">");
} else
System.out.print(">");
x -= 1;
}
Tlines += 1;
x = params - Tlines;
}
*/
}
  

private static void triangle_1(int params, String paramString)
{
ArrayList<Character>[] arr = new ArrayList[params];
  
// initializing
for (int i = 0; i < params; i++) {
arr[i] = new ArrayList<Character>();
}
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle 1\n");
for(;Tlines<params;Tlines++) {
for(x=params-Tlines-1;x>=0;x--) {

arr[Tlines].add(paramString.charAt(0));

}
}


for(ArrayList<Character> i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}
/*
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle 1\n");
while (Tlines <= params) {
while (x >= 1) {
if (x == 1) {
System.out.println(paramString);
} else
System.out.print(paramString);
x -= 1;
}
Tlines += 1;
x = params - Tlines;
}*/
}
  
private static void triangle_2(int params) {
ArrayList<Character>[] arr = new ArrayList[params];
  
// initializing
for (int i = 0; i < params; i++) {
arr[i] = new ArrayList<Character>();
}
int Tlines = params;int x = params;
  
System.out.println("\ntriangle 2\n");
for(Tlines=params;Tlines>=1;Tlines--) {
for(x=Tlines;x>=1;x--) {
arr[params-Tlines].add(Character.forDigit(Tlines,10));
}
}
for(ArrayList<Character> i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}
/*
int Tlines = params;int x = params;
  
System.out.println("\ntriangle 2\n");
while (Tlines >= 1) {
while (x >= 1) {
if (x == 1) {
System.out.println(Tlines);
} else
System.out.print(Tlines);
x -= 1;
}
Tlines -= 1;
x = Tlines;
}
*/
}
  
private static void triangle_3(int params) {
ArrayList<Character>[] arr = new ArrayList[params];
  
// initializing
for (int i = 0; i < params; i++) {
arr[i] = new ArrayList<Character>();
}

int Tlines = 0;int x = params;
  
System.out.println("\ntriangle 3\n");
for( Tlines=0;Tlines<params;Tlines++){
for( x=params-Tlines-1;x>=0;x--)
{
arr[Tlines].add('%');
}
}
for(ArrayList<Character> i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}


/*
int Tlines = 0;int x = params;
  
System.out.println("\ntriangle 3\n");
while (Tlines <= params) {
while (x >= 1) {
if (x == 1) {
System.out.println("%");
} else
System.out.print("%");
x -= 1;
}
Tlines += 1;
x = params - Tlines;
}
*/
}
  
private static void triangle_4(int params, String paramString) {
ArrayList<Character>[] arr = new ArrayList[params];
  
// initializing
for (int i = 0; i < params; i++) {
arr[i] = new ArrayList<Character>();
}
int Tlines = 0;int x = 1;
  
System.out.println("\ntriangle 4\n");
for(;Tlines<params;Tlines++) {
for(x=0;x<=Tlines;x++) {
arr[Tlines].add(paramString.charAt(0));
}}
for(ArrayList<Character> i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}

/*
int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 4\n");
while (Tlines <= params) {
while (x <= Tlines) {
if (x == Tlines) {
System.out.println(paramString);
} else
System.out.print(paramString);
x += 1;
}
Tlines += 1;
x = 1;
}*/
}
  
private static void triangle_5(int params) {
ArrayList<Character>[] arr = new ArrayList[params];
  
// initializing
for (int i = 0; i < params; i++) {
arr[i] = new ArrayList<Character>();
}

int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 5\n");
for(Tlines=1;Tlines<=params;Tlines++) {
for(x=1;x<=Tlines;x++){
arr[Tlines-1].add(Character.forDigit(Tlines,10));
}}
for(ArrayList<Character> i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}
/*
int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 5\n");
while (Tlines <= params) {
while (x <= Tlines) {
if (x == Tlines) {
System.out.println(Tlines);
} else
System.out.print(Tlines);
x += 1;
}
Tlines += 1;
x = 1;
}*/
}
  
private static void triangle_6(int params) {
ArrayList<Character>[] arr = new ArrayList[params];
  
// initializing
for (int i = 0; i < params; i++) {
arr[i] = new ArrayList<Character>();
}

int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 6\n");
for(Tlines=1;Tlines<=params;Tlines++) {
for(x=1;x<=Tlines;x++) {
arr[Tlines-1].add(Character.forDigit(x,10));
}
}
for(ArrayList<Character> i:arr){
for(char j:i){
System.out.print(j);
}
System.out.println();
}


/*
int Tlines = 1;int x = 1;
  
System.out.println("\ntriangle 6\n");
while (Tlines <= params) {
while (x <= Tlines) {
if (x == Tlines) {
System.out.println(x);
} else
System.out.print(x);
x += 1;
}
Tlines += 1;
x = 1;
}*/
}
}

Here is the output associated with both the file

i hope this will help you so please give positive ratings :))))))

Add a comment
Know the answer?
Add Answer to:
We learn arrays (and Arrays class) in Chapter 10 and ArrayList collection in Chapter 14. This...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Coding Requirements for Assignment2_1.java: Based on Assignment1.java, re-do all 7 methods from triangle_0 to triangle_6 by...

    Coding Requirements for Assignment2_1.java: Based on Assignment1.java, re-do all 7 methods from triangle_0 to triangle_6 by storing characters (which could be symbols or digits) in a 2D "square" array, meaning it has equal number of rows and columns. Now, because each triangle is supposed to contain rows filled with different number of characters, you are required to fill each row with only required number of characters in this square array. For example, in an up-side-down 8-row triangle of "$", the...

  • (How do I remove the STATIC ArrayList from the public class Accounts, and move it to...

    (How do I remove the STATIC ArrayList from the public class Accounts, and move it to the MAIN?) import java.util.ArrayList; import java.util.Scanner; public class Accounts { static ArrayList<String> accounts = new ArrayList<>(); static Scanner scanner = new Scanner(System.in);    public static void main(String[] args) { Scanner scanner = new Scanner(System.in);    int option = 0; do { System.out.println("0->quit\n1->add\n2->overwirte\n3->remove\n4->display"); System.out.println("Enter your option"); option = scanner.nextInt(); if (option == 0) { break; } else if (option == 1) { add(); } else...

  • Please Refactor this Assignment by using Arraylist instead of Array. import java.util.Scanner; public class DaysOfWeeks {...

    Please Refactor this Assignment by using Arraylist instead of Array. import java.util.Scanner; public class DaysOfWeeks { public static void main(String[] args) { String DAY_OF_WEEKS[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; char ch; int n; Scanner scanner = new Scanner(System.in); do { System.out.print("Enter the day of the Week: "); n = scanner.nextInt() - 1; if (n >= 0 && n <= 6) System.out.println("The day of the week is " + DAY_OF_WEEKS[n] + "."); else System.out.println("Invalid Entry"); System.out.print("Try again (Y/N): "); ch = scanner.next().charAt(0); }while(ch=='Y'); }...

  • PART 1 Modify the class ArrayList given in Exercise 1 by using expandable arrays. That is,...

    PART 1 Modify the class ArrayList given in Exercise 1 by using expandable arrays. That is, if the list is full when an item is being added to this list, the elements will be moved to a larger array. The new array should have twice the size of the original array. Using the new class ArrayList, write a program to store 1,000 random numbers, each in the interval [0, 500]. The initial size of the array in the class should...

  • Now, your objective is to rewrite the same Stack class with a Generic ArrayList and make...

    Now, your objective is to rewrite the same Stack class with a Generic ArrayList and make the entire class support using Generic types. You should be able to create a Stack of any primitive wrapper class, and show us that your Generic Stack implementation (push, pop, search, display, etc.) works with: • Character (Stack) • Integer (Stack) • Float (Stack • Double (Stack) • String (Stack) You can create these Stack objects in main() and perform operations on them to...

  • Write a method public static ArrayList merge(ArrayList a, ArrayList b) that merges two array lists, alternating...

    Write a method public static ArrayList merge(ArrayList a, ArrayList b) that merges two array lists, alternating elements from both array lists. If one array list is shorter than the other, then alternate as long as you can and then append the remaining elements from the longer array list. For example, if a is 1 4 9 16 and b is 9 7 4 9 11 then merge returns the array list 1 9 4 7 9 4 16 9 11...

  • my goal is to generate a random number every 10 seconds and store in arraylist. when...

    my goal is to generate a random number every 10 seconds and store in arraylist. when I generate the new number every 10 second I want to update the previous number from the arraylist. currently it gets the first current number in main method but when I store after 10 second i'm not getting the update current number. I would appreciate any help. NOTE: ***I want the Runnable to be in the same class, Not in main method. my goal...

  • Need help debugging. Create an application that keeps track of the items that a wizard can...

    Need help debugging. Create an application that keeps track of the items that a wizard can carry. console application which has no errors: import java.util.Scanner; public class Console {        private static Scanner sc = new Scanner(System.in);     public static String getString(String prompt) {         System.out.print(prompt);         String s = sc.nextLine();         return s;     }     public static int getInt(String prompt) {         int i = 0;         boolean isValid = false;         while (!isValid) {             System.out.print(prompt);...

  • Below, you can find the description of your labwork for today. You can also find the...

    Below, you can find the description of your labwork for today. You can also find the expected output of this code in the Application Walkthrough section. You are going to improve your existing Money & Stock Trading Platform on previous week’s labwork by incorporating Collections. In previous labworks, you have used arrays for holding Customer and Item objects. For this labwork you need to use ArrayList for holding these objects. So, rather than defining Customer[] array, you need to define...

  • my goal is to generate a random number every 10 seconds and store in arraylist. when...

    my goal is to generate a random number every 10 seconds and store in arraylist. when I generate the new number every 10 second I want to update the previous number from the arraylist. currently it gets the first current number in main method but when I store after 10 second i'm not getting the update current number. I would appreciate any help. NOTE: ***I want the Runnable to be in the same class, Not in main method. my goal...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT