I was writing a simple programs on arrays and i dont know why these error pop up if some can explain what im doing wrong
public class CoinValues {
public static void main(String[] args) {
int[] coinValue = {5,10,25};
String[] coinWord = {"nickels","dim es","quarters"} ;
int count = IB.inputInt("Ho w many coins do you have? ");
int i = IB.inputInt("En ter 0 for nickels, 1 for dimes, 2 for quarters: ");
int cent = int count * int[i];
IB.output(count + " " + int[i] + " equals " + .cent + "cents.");
}
}
C:\IBCS\CoinVal ues.java:11: '.class' expected
int cent = int count * int[i];
^
C:\IBCS\CoinVal ues.java:13: ']' expected
IB.output(count + " " + int[i] + " equals " + .cent + "cents.");
^
C:\IBCS\CoinVal ues.java:13: '.class' expected
IB.output(count + " " + int[i] + " equals " + .cent + "cents.");
^
class expected?
and i dont know why i need a ]
if some can explain
oh the purposee is to find the value in cents of coins of one type
public class CoinValues {
public static void main(String[] args) {
int[] coinValue = {5,10,25};
String[] coinWord = {"nickels","dim es","quarters"} ;
int count = IB.inputInt("Ho w many coins do you have? ");
int i = IB.inputInt("En ter 0 for nickels, 1 for dimes, 2 for quarters: ");
int cent = int count * int[i];
IB.output(count + " " + int[i] + " equals " + .cent + "cents.");
}
}
C:\IBCS\CoinVal ues.java:11: '.class' expected
int cent = int count * int[i];
^
C:\IBCS\CoinVal ues.java:13: ']' expected
IB.output(count + " " + int[i] + " equals " + .cent + "cents.");
^
C:\IBCS\CoinVal ues.java:13: '.class' expected
IB.output(count + " " + int[i] + " equals " + .cent + "cents.");
^
class expected?
and i dont know why i need a ]
if some can explain
oh the purposee is to find the value in cents of coins of one type
Comment