|
-
October 13th, 2011, 09:31 PM
#1
Cannot find Symbol Error
Hi, first I would like to say that it is a pleasure to be part of this forum.
Anyways I have an assignment due, and I am a perfectionist, so it is bugging me that it will not compile properly.
Here is the assignment: You are planning to transport a large number of people on a trip. You have 45-passenger buses and 16-passenger vans at your disposal. Any bus you use must be completely filled, and any remaining passengers transported by van.
You must write a Java program that returns the necessary numbers or each type of vehicle given the number of students to be transported. There should be methods to determine the number of buses, the number of vans and a main method to test them.
Here is what I have done so far:
public class bAndV{
public static void main (String args[]) {
System.out.println (bus(151));
System.out.println (vans());
}
public static int bus(int bus){
return bus/45;
}
public static int vans(int vans){
int rem = bus % 45;
if (rem % 45== 0)
return (0);
else
return ((rem/16)+1);
}
}
Error i recieve: cannot find symbol - variable bus
What must I do for the second method to identify bus as a variable from the first method? Thank you for the help.
Tags for this Thread
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
|