Lab guideJava

Lab2: The Software Development Process

Last updated 2 December 2023

The process of creating a program is often broken down into stages according to the information that is produced in each phase. In a nutshell, here’s what you should do.

Formulate Requirements: Figure out exactly what the problem to be solved is. Try to understand as much as possible about it. Until you really know what the problem is, you cannot begin to solve it.

Determine Specifications: Describe exactly what your program will do. For simple programs, this involves carefully describing what the inputs and outputs of the program will be and how they relate to each other.

Create a Design: Formulate the overall structure of the program. This is where, how of the program gets worked out. The main task is to design the algorithm(s) that will meet the specifications.

Implement the Design: Translate the design into a computer language and put it into the computer. In this book, we will be implementing our algorithms as Java programs.

Maintain the Program: Continue developing the program in response to the needs of your users. Most programs are never really finished; they keep evolving over years of use.

Project: Build Temperature Converter Application

Algorithm for converting temperature
  • Step 1: Input the temperature in degrees Celsius (call it Celsius)
  • Step 2: Calculate Fahrenheit as (9/5 )* Celsius + 32
  • Step 3: Output in Fahrenheit

The next step is to translate this design into a Java program. This is straightforward, as each line of the algorithm turns into a corresponding line of java code.

import java.util.Scanner;

public class TempeartureConverter {

    public static void main(String\[\] args) {
        // we will discuss later in details for now this syntax
        // used to take input through keyboard
        Scanner sc = new Scanner(System.in);
        System.out.println("enter temperature in degree celcius");
        // Takes input of integer type by user
        int celcius = sc.nextInt();
        double Fahrenheit = (9.0 / 5.0) \* celcius + 32; 
        // display result
        System.out.println("the temperature is : " +Fahrenheit + "degree Fahrenheit" );  

    }

}
Output
F:\\coreJAVA\\3Objects>java TempeartureConverter  
enter temperature in degree celcius  
28  
the temperature is : 82.4degree Fahrenheit  
F:\\coreJAVA\\3Objects>java TempeartureConverter  
enter temperature in degree celcius  
27  
the temperature is : 80.6degree Fahrenheit,
Learn this on the racks

Reading it is one thing. Configuring it is another.

Our batches run labs like this one end to end on real kit, in the Mumbai classroom or live online, taught by practicing engineers.