I put in my while loop, and now it has caused my col, num, and tol variables to come out as errors and I don't know why. public static void main(String[] args) {          int min = 19;            int num1=0, num2=0, num3=0;          int tol1=0, tol2=0, tol3=0;          int max = 50;      int i = 0;     while (i < 49) {     int col[]=new int[49];         i++;     }     int ran = (int)(Math.random() * (max - min + 1) + min);      if( ran <= 20 && ran < 30){         num1 += 1;         tol1 += ran;     }     if(ran <= 30 && ran < 40){         num2 += 1; tol2 += ran;     }     if(ran <= 40 && ran < 50){         num3 += 1; tol3 += ran;     }     int col(i)= ran;     }     {      for(int i = 0; i < 49; i++ ){         if(i == 7 || i == 14 || i == 21 || i == 28 || i == 35 ||i == 42){                 System.out.println("\n");          }          System.out.printf(("%7d"),+ col[i]);      }       System.out.printf("\n");      System.out.printf("Found "+ num1 +" number(s) in the 20s "+ "totaling "+ tol1);      System.out.printf("\nFound "+ num2 +" number(s) in the 30s "+ "totaling "+ tol2);      System.out.printf("\nFound "+ num3 +" number(s) in the 40s "+ "totaling "+ tol3);           } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I put in my while loop, and now it has caused my col, num, and tol variables to come out as errors and I don't know why.

public static void main(String[] args) {
         int min = 19;  
         int num1=0, num2=0, num3=0;
         int tol1=0, tol2=0, tol3=0;
         int max = 50; 

    int i = 0;
    while (i < 49) {
    int col[]=new int[49];    
    i++;
    }
    int ran = (int)(Math.random() * (max - min + 1) + min); 
    if( ran <= 20 && ran < 30){
        num1 += 1;
        tol1 += ran;
    }
    if(ran <= 30 && ran < 40){
        num2 += 1; tol2 += ran;
    }
    if(ran <= 40 && ran < 50){
        num3 += 1; tol3 += ran;
    }
    int col(i)= ran;
    }
    {
     for(int i = 0; i < 49; i++ ){
        if(i == 7 || i == 14 || i == 21 || i == 28 || i == 35 ||i == 42){
                System.out.println("\n");
         }
         System.out.printf(("%7d"),+ col[i]);
     } 
     System.out.printf("\n");
     System.out.printf("Found "+ num1 +" number(s) in the 20s "+ "totaling "+ tol1);
     System.out.printf("\nFound "+ num2 +" number(s) in the 30s "+ "totaling "+ tol2);
     System.out.printf("\nFound "+ num3 +" number(s) in the 40s "+ "totaling "+ tol3);
     

    }

}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education