Reference no: EM132336798
Question
Translate the pseudocode in the text into Java and insert the proper code after each comment in BookClub.java. You should be able to compile the code without error and run it with correct results.
How does my java code look? If there are any errors please let me know whats wrong.
import java.util.Scanner;
class BookClub
{
public static void main (String[] args)
{
// Creat a Scanner object for keyboard input
Scanner keyboard = new Scanner(System.in);
//Delcare variables here
int bookNumber;
//Prompt the user and get the number of books from user
System.out.print("Enter the number of books want to purchase? ");
bookNumber=keyboard.nextInt();
//Use a selection control to determine the number of books purchased
if(bookNumber<0){
// and display the proper message
System.out.println("Cannot buy a negative number of books.");
}
else{
System.out.println("Purchased "+bookNumber+" number of books.");
}
} // end main()
} //end class