View Full Version : How can I do this?

12-09-2009, 12:05 AM
How can I add multiple classes to this or change it to include the following? One that contains the accessor and mutator
methods, a readInput() method and a writeOutput() method.

import java.util.Collections;
import java.util.ArrayList;
import java.util.List;

public class PowerBall
public static void main(String[] args)

ArrayList<Integer> numbers = new ArrayList<Integer>();

for(int i=0; i<59; i++)
numbers.add(i + 1);
ArrayList<Integer> powerball = new ArrayList<Integer>();
for(int i=0; i<39; i++)
List <Integer> sorted = numbers.subList(0,5);
System.out.print("The powerball numbers are: ");
for (int j=0; j<5; j++)
System.out.print(sorted.get(j) + " ");
System.out.print(" and the powerball is: ");
for (int k=0; k<1; k++)
System.out.print(powerball.get(k) + " ");

12-09-2009, 01:22 AM
That's Java. You've posted in the Javascript forum. Yes, they're different languages. You should PM a mod to request a move to the correct forum where you can get appropriate assistance.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum