Hi, I cannot for the life of me figure out why I keep getting the error message, "cannot find symbol method methodname()" when I try to call methods from another method. I have tried changing the main method so its not static but it makes no difference.
Anyone who could shed light on the issue, it would be greatly appreciated.
Thanks.
import java.io.*; //import API to allow input of characters
import java.util.Vector; //import API to allow Vector functionality
class Details {
String name = null;
String artist = null;
String year = null;
String genre = null;
String rating = null;
Vector v = new Vector();
public void newcd() {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
System.out.println("CD Name: ");
try { //Reads keyboard input and acts accordingly
name = stdin.readLine();
}catch (IOException ex) {
System.out.println("Problem reading from the keyboard"); }
System.out.println("Artist: ");
try { //Reads keyboard input and acts accordingly
artist = stdin.readLine();
}catch (IOException ex) {
System.out.println("Problem reading from the keyboard"); }
System.out.println("Year of album: ");
try { //Reads keyboard input and acts accordingly
year = stdin.readLine();
}catch (IOException ex) {
System.out.println("Problem reading from the keyboard"); }
System.out.println("Genre: ");
try { //Reads keyboard input and acts accordingly
genre = stdin.readLine();
}catch (IOException ex) {
System.out.println("Problem reading from the keyboard"); }
System.out.println("Rating: ");
try { //Reads keyboard input and acts accordingly
rating = stdin.readLine();
}catch (IOException ex) {
System.out.println("Problem reading from the keyboard"); }
Details disc = new Details ();
disc.name = name;
disc.artist = artist;
disc.year = year;
disc.genre = genre;
disc.rating = rating;
v.add(disc);
}
}
public class CDSystem { //main class
public static void main (String [] args) { //main method containing menu system
String input = null; //initialising input string
int iInput;
int ixInput;
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Welcome to your CD Collection"); //commands to display menu on screen
System.out.println("Select an option from the menu:");
System.out.println("1: Add a new CD");
System.out.println("2: Display CDs by artist");
System.out.println("3: Display CDs by genre");
System.out.println("4: Display all albums ascending by year");
System.out.println("5: Display all albums descending by rating");
System.out.println("Press any other key to exit");
try { //Reads keyboard input and acts accordingly
input = stdin.readLine();
}catch (IOException ex) {
System.out.println("Problem reading from the keyboard");
iInput = Integer.valueOf(input); // convert String to Integer
}
if (iInput == 1) {
newcd();
}
if (iInput == 2) {
artistdisplay();
}
if (iInput == 3) {
genredisplay();
}
if (iInput == 4) {
yeardisplay();
}
if (iInput == 5) {
ratingdisplay();
}
else {
System.out.println("Thank you for using CDSystem");
}
}
}