Minggu, 15 Desember 2013

Question:

Make a pseudocode to display a pascal triangle


Answer


Begin
public class Task Pascal Triangle
{

    public static void main(String[] args)
    {
        int deret[][];
        int level;

        level = 9;
        deret = new int[level + 1][];

        deret[0] = new int[level + 1];
        for (int i = 0; i < deret.length; i++)
        {
            deret[0][i] = 0;
        }
        deret[0][0] = 1;
        System.out.printf("%1$5d", 1);
        System.out.println("");

        for (int i = 1; i <= level; i++)
        {
            deret[i] = new int[level + 1];
            deret[i][0] = 1;
            System.out.printf("%1$5d", deret[i][0]);

            for (int j = 1; j <= level; j++)
            {
                deret[i][j] = deret[i - 1][j - 1] + deret[i - 1][j];
                if (deret[i][j] > 0)
                {
                    System.out.printf("%1$5d", deret[i][j]);
                }
            }
            System.out.println("");
        }

    }
}

End

Senin, 11 November 2013

Flowchart 

A flowchart is a type of diagram that represents an algorithm or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows. This diagrammatic representation illustrates a solution to a given problem. Process operations are represented in these boxes, and arrows; rather, they are implied by the sequencing of operations. Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields.


Task:

Make two flowcharts that will process the data input continuously until the value is null or below the null !
a. Create a flowchart to look for the average !
b. Create a flowchart to find the highest value !

Answer:

a. Average Value


Click here to view the Portable Document Format

b. Max Value


Click here to view Portable Document Format

Selasa, 08 Oktober 2013

Pseudecode

Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm.
It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading. Pseudocode typically omits details that are not essential for human understanding of the algorithm, such as variable declarations, system-specific code and some subroutines. The programming language is augmented with natural language description details, where convenient, or with compact mathematical notation. The purpose of using pseudocode is that it is easier for people to understand than conventional programming language code, and that it is an efficient and environment-independent description of the key principles of an algorithm. It is commonly used in textbooks and scientific publications that are documenting various algorithms, and also in planning of computer program development, for sketching out the structure of the program before the actual coding takes place.
No standard for pseudocode syntax exists, as a program in pseudocode is not an executable program. Pseudocode resembles, but should not be confused with skeleton programs, including dummy code, which can be compiled without errors. Flowcharts and Unified Modeling Language (UML) charts can be thought of as a graphical alternative to pseudocode, but are more spacious on paper.

Task:

Create the pseudocode to accept item name , price , and quantity . You need to calculate value as the product of price and quantity. And display the calculated!  

Answer:

  begin
       string name ;
       byte quantity ;
       float price, value ;


  display "input name of product" ;
  accept name ;
  display "input quantity" ;
  accept quantity ;
  display "input price" ;
  accept price ;


  end
Follow me on Twitter!