Tuesday, December 9, 2014

JAVA CLASSES

JAVA CLASSES

June 2013. First day of my online class in Java. I bought the Java textbook and it cost a lot of money, compared to the other books of other subjects.

I realized Computer Science books are more expensive than other subjects because publishers are expecting students to pay more since when Computer Science students graduate they will earn higher salaries compared to those who majored in other subjects.

My Java book cost me I think about $170 from the college bookstore.  The book was "Starting Out with Java: Early Objects."  And the book of the other programming related class that I was taking, Project Management, also cost more than $100, but I used a $50 textbook voucher the college has given me for working 8 hours in the college library.

Here’s some segments of the program I submitted to my professor in my Beginning Java course. The following code defines a class’s instance variables, a constructor, mutator, and accessor methods. I have used ellipsis to indicate some parts of the original code that are not shown here.

class Book
{
   // Declare class fields with private access.
   private String title, author, publisher;
   private int numPages;
   // Class default constructor accepting no argument.
   public Book()
   {
      // Initialize class fields of default constructor.
      title = "Project Java";
      author = "John Sindayen";
      publisher = "Random House";
      numPages = 300;
   }
   /* ... */
   // Mutator method to assign user input to title field.
   public void setTitle()
   {
      Scanner keyboard = new Scanner(System.in);
      title = keyboard.nextLine ();
   }
   /* ... */
   // Accessor method to return value of title field.
   public String getTitle()
   {
      return title;
   }
   /* ... */
}

Welcome to Java, class!

John Sindayen

Reference:
http://www.pearsonhighered.com/product?ISBN=0132164760

No comments:

Post a Comment