Archive

Archive for the ‘WJ1101A – Introduction to the Java Programming Language’ Category

Exercise 1 – Writing compiling and testing a program in Java

November 7, 2009 1 comment

 

 

Exercise for Introduction To Java Programming language:

 

This post has the exercise  for module 3 of  Introduction To Java Programming language. Let’s practice what we have learnt. Before practicing the exercise, follow the instructions below which will give you a step-by-step instruction: 

 

 

 

 

You can download the source code (WJ-1101A-exercise.zip) for this exercise from the Box widget in the sidebar. Follow the video tutorial below if you ever get stuck while executing the programs: Read more…

Advertisements

Developing & Testing a program in Java

November 6, 2009 Leave a comment

 

 

Module 3: Developing & Testing a Java Technology program.

 

Objectives:

1. Identify  4 components of class.
2. Use main method in a test class to run a java program from command line.
3. Compile & execute a java program.

 

1. Identify  4 components of class:

Going back to what we discussed before about classes, to construct a house you will first need a blueprint. Same thing applies for classes & objects. Similarly once you have a class blueprint, you  can have as many objects of that class as u like. These objects are called instances of a class. i.e., a shirt object is an instance of a shirt class.

 

27. class and its objs

 

Lets take a look at our first class:

Class is a blueprint that tells the computer how to make objects. This class blueprint – Shirt, tells the computer how to make Shirt objects.

 

28. 1st class

 

 

Structuring classes:

There are 4 major components of class that you will find more often:

  • class declaration – required
  • attribute variable declaration & initialization – optional
  • methods – optional
  • comments – optional

1. Class declaration is required, and this is all that you need to make a class valid. If all you had was this, then the class and its objects would be uninteresting serving no purpose. You will be needing some attributes and operations to jazz up the object.

2. Variables are characterstics of your objects. As we discussed in previous posts, these are characterstics /  properties and they are also data holders. They hold the data for the object.

3. In this Shirt class, only one method is defined. Methods are operations. They tell the class what to do.  Its what the class can do.  This method is printing all its information to the command window.

4. Comments are for developers to understand what the code is doing, they dont influence the execution in anyway.

 

Class declaration: Read more…

Analyze a problem & design a solution in Java

November 6, 2009 4 comments

  

Module 2 – Analyze a problem & design a solution.

 

Objective:

Analyzing a problem & designing a solution using object oriented concepts:

1. Analyse a problem using object oriented analysis
2. Design classes from which objects will be created

 

1. Analyze a problem using object oriented analysis:

In this process, the first step is to understand your domain & the domain will probably be the business you are trying to solve the pblm for, or the area to create new product.

 Case study:

A company called Direct Clothing  sells shirts from thier catalog.  We have to develop a product for this company for the same catalog. So initially we have to understand few points about thier shirts
ex:

  • Each shirt has an item identity(ID) – bar code
  • One or more colors – blue, green etc
  • One or more sizes
  • Have description – type of material, style etc
  • Price
  • Direct Clothing accepts cheques & credit card payments.

 

11. case study

 

 

The current system:

During analysis stage, you also have to learn about the current system if there is one. Currently, say there are 2 ways in which a customer can place thier order with Direct Clothing

  • Call customer care over phone and place the order.
  • Mail or Fax an order form to place the order.

 

12. current system

 

The proposed system: Read more…

Explaining Java Technology

November 6, 2009 Leave a comment

  

Module 1 – Explaining Java Technology.

 

Objective:

Upon completion of reading this post, you should be able to know:

  • Key concepts of Java programming language.
  • Three Java technology product groups.
  • Seven stages of product life cycle.

 

 

Key concepts of Java programming language:

Java programming language originated in Sun Microsystems in 1999 as part of a research project to develop a programming language calld oak that would bridge the communication gap between many consumer devices such as video casette recorders & TV. Specifically, a team called green team wanted to create a software programming language enabling consumer devices with different CPU to share same software enhnacements.

 

 

1. green team

 

Initial concept failed as several deals with consumer companies were unsuccessful. So green team had to find another market. At that time www was becoming popular, and green team recognized tht the Oak language was perfect for developing web multimedia components to enhance web pages. Initially, small programs called applets became extensively used and gradually internet developers adopted what now is known as Java.

2. green team with internet

 

 

Java was designed to be: Read more…