-
October 23rd, 2011, 05:46 PM
#1
Need help finishing this java code please help
Restriction the only structure my program is allowed to use for storage, is ArrayLists.
The link to the problem I'm trying to solve is http://docs.google.com/viewer?a=v&q=...LlsldOkXQygO1g
So far what i got is this,(note that im not putting in the ";" yet)
____________________
import sdsu.io.*;
import java.util.*;
public class Problem
{
public static void main(String args[])
{
ArrayList<String>[] list = new ArrayList[23];
for (int i=0; i<=22; i++)
{
list[i] = new ArrayList<String>();
}
for (int i = -999; i <= 999; i++)
{
int count = 0;
for(int k = 0; k <= 2; k++)
{ int a = s.charAt(k);
if(a == -){count++}
if else(a == 0){count = count + 6}
if else(a == 1){count = count + 2}
if else(a == 2)[count = count + 5}
if else(a == 3){count = count + 5}
if else(a == 4){count = count + 4}
if else(a == 5){count = count + 5}
if else(a == 6){count = count + 6}
if else(a == 7){count = count + 3}
if else(a == 8){count = count + 7}
if else(a == 9){count = count + 6}
}
int k1 = Console.readline("Input X'a milliamps:");
int k2 = Console.readline("Input Y's milliamps:");
int k3 = Console.readline("Input Z's milliamps");
k1 = k1 / 5
k2 = k2 / 5
k3 = k3 / 5;
int count = 0;
//* HERE:
// Use the k1, k2, k3, list[], etc., to examine and compute
// possible combinations for "X Op Y = Z", but use list[] to shortcut
// your combinations so your program will not examine all 31 billion.
System.out.println("Possible solutions = " + count);
} //end main
public static int calcsegments(int i)
{
//* HERE:
// Compute and return the number of segments in the number i,
// where i is of course something in the range -999 to 999.
}
} //end class
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|