title: Creating a program with Book class and TestBook class in Java
body: <p>I'm trying to create java program that allows user to enter the book
  number and the program will show the price of the book chosen. I've
  created the book class and there's no syntax error in but most
  probably there's logic error and the class TestBook has errors
  in invoking the input. can you help me? im lost :( here's my code:</p>
  
  <pre><code>class Book{
  
      String title;
      String author;
      double price;
      int option;
  
      //constructor
      Book(String title, String author, double newPrice){
          title = title;
          author = author;
          price = newPrice;
  
      }
  
      public String getTitle(){
          return title;
      }
      public String getAuthor(){
          return author;
      }
      public double getPrice(){
          return price;
      }
      public int getOption(){
          return option;
      }
  
      public void setPrice(int option, double price, double newPrice){
          if (option == 1){
              price = 20.00;
              newPrice = price;
          }
          else if (option == 2){
              price = 15.00;
              newPrice = price;
          }
          else if (option == 3){
              price = 23.90;
              newPrice = price;
          }
          else if (option == 4){
              price = 27.30;
              newPrice = price;
          }
          else if (option == 5){
              price = 50.00;
              newPrice = price;
          }
          else if (option == 6){
              price = 13.50;
              newPrice = price;
          }
      }
      public void setOption(int newOption){
          option = newOption;
      }
  }
  </code></pre>
  
  <p>The TestBook class</p>
  
  <pre><code>import java.util.Scanner;
  
  public class TestBook{
      public static void main (String[]args){
  
          Scanner input = new Scanner (System.in);
  
          //The Book List
          System.out.println("The Book List");
          System.out.println("1)How to do programming 12th Edition by Liang.\n2)Malaysian Food Recipe by Nadia Bt Mahmud.\n3)What is Islam by Ustad Manzoor Malik.\n4)Urban Legend by Christine R.M.\n5)Fundamental of Calculus by Prof. Abu.\n6)How to raise your kids by Salsabila\n");
          System.out.println("Choose your book number to know the price: ");
          int option = input.nextInt();
  
          Book b1 = new Book(theOption(option);// invoke the option to get the price
          System.out.println("The price is: "+ b1.getPrice);
  
  
      }
      //Method option
      public static int theOption(int option){
          return option;
      }
  }
  </code></pre>