Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 BufferedReader problem.
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
GDoughtUpInIt




PostPosted: Sat Aug 14, 2004 1:07 am   Post subject: BufferedReader problem.

The interpreter brings back 3 errors involving the BufferedReader in the PieStore class. Cannot resolve symbols.

code:
class Pie {
String flavour;
int slices;
double price;
public void addFlavour(String f) {
flavour = f;
}
public void addSlices(int s) {
slices = s;
}
public void addPrice(double p) {
price = p;
}
public String showPrices() {
return "you can by a " + flavour + " pie with " + slices + " slices for " +

price;
}
}
// Main class
class PieStore {
public static void main (String[] args) {
Pie pieOB = new Pie();
BufferedReader reader = new BufferedReader(new

InputStreamReader(System.in));
System.out.println("What flavour of pie would you like to add to the

store's inventory?");
pieOB.addFlavour(reader.readLine());
System.out.println("How many slices are in this particular pie?");
pieOB.addSlices(Integer.parseInt(reader.readLine()));
System.out.println("How much will this pie cost?");
pieOB.addPrice(Double.parseDouble(reader.readLine()));
System.out.println(pieOB.showPrices());
}
}


Help always appreciated. Thanks.
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Sat Aug 14, 2004 10:40 am   Post subject: (No subject)

Did you inculde the api that has BufferedReader in it? I think that it is java.io.* you need to use BufferedReader.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: