Sam Gavis

Greenhorn
+ Follow
since Oct 27, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sam Gavis

What is wrong with this program?



class Movie {
String title;
String genre;
int rating;

void playIt() {
System.out.println("Playing the movie");
}
}

public class MovieTestDrive {
public static void main(String[] args) {
Movie one = new Movie();
one.title = "Gone with the Stock";
one.genre = "Tragic";
one.rating = -2;
Movie two = new Movie();
two.title = "Lost in Cubicle Space";
two.genre = "Comedy";
two.rating = 5;
Movie three = new Movie();
three.title = "Byte Club";
three.genre = "Tragic but ultimately uplifting";
three.rating = 127;
}
}
16 years ago
Could someone tell me what is wrong with this program?





class BeerSong{
public static void main (String[] args) {
int beerNum = 99;
String word = "bottles";

While(beerNum > 0); {

if (beerNum ==1) {
word = "bottle"; //singular, as in one bottle
}
System.out.println(beerNum + "" + word + "of beer on the wall");
System.out.println(beerNum + "" + word + "of beer");
System.out.println("Take one down.");
System.out.println("Pass it around");
beerNum = beerNum - 1;

if (beerNum > O) {
System.out.println(beerNum + "" +word + "of beer on the wall");
} else {
System.out.println("No more bottles of beer on the wall");
}//end else
}//end while loop
}//end main method
}//end class
[ October 27, 2007: Message edited by: Sam G-H ]
16 years ago