Preview

exam

Satisfactory Essays
Open Document
Open Document
373 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
exam
Developing an algorithm

Objectives
To introduce methods of analysing a problem and developing a solution
To develop simple algorithms using the sequence control structure
To introduce methods of manually checking the developed solution

Methos of analysing a problem and developing a solution
1) Defining the problem
2) Designing a solution algorithm
3) Checking the solution algorithm

1) Defining the Problem
Problem should be divided into three separate components:
1. Input: a list of source data provided to the problem
2. Output: a list of the outputs required
3. Processing: a list of actions needed to produce the required outputs

When reading a problem statement, the input and output components are easily identified due to the use of descriptive words such as nouns and adjectives
Processing component is also identified easily as the problem statement usually describes the processing steps as actions, using verbs and adverbs

Example 1 : Add three numbers

A program is required to read three numbers add them together and print their total.

a) Underlined nouns and adjectives to identify the input and output components of this problem.

A program is required to read three numbers add them together and print their total.

b) Underlined the verbs and adverbs to identify the processing component of this program.

A program is required to read three numbers add them together and print their total.

c) Construct an IPO(Input, Processing, Output) chart.
Input
Processing
Output
number1 number2 number3
Read three numbers
Add numbers together
Print total number total 2) Designing a solution algorithm

Based on the defining IPO chat that developed in defining the problem step, a solution algorithm is design as follows:

Start read number1, number2, number3 total = number1+ number2+ number3 print total
Stop

3) Checking the solution algorithm
Based on the solution algorithm that designed in previous step, a desk

You May Also Find These Documents Helpful

  • Satisfactory Essays

    a1 script win213

    • 380 Words
    • 2 Pages

    If the user does not enter a numeric value the program should prompt for a numeric value…

    • 380 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    5. The program shall allow the user to clear all the input fields and do the calculations over.…

    • 1488 Words
    • 6 Pages
    Powerful Essays
  • Satisfactory Essays

    cout << num1 << " + " << num2 << " = " << num1+num2;…

    • 426 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    It/210 Final Exam

    • 1235 Words
    • 5 Pages

    5. The program will allow the user to clear all the input fields and do the calculations over.…

    • 1235 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    PT1420 Unit 8 Lab 8

    • 365 Words
    • 2 Pages

    Calculating a Running Total, page 201): Asks for input of a number 5 times then adds all numbers into one total sum, example 2,4,6,8,10 = 30…

    • 365 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    unit 7 assignment 1

    • 431 Words
    • 2 Pages

    7. Convert the While loop in the following code to a Do-While loop: int x;…

    • 431 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    PRG/420 Week 3

    • 1025 Words
    • 5 Pages

    User 's total compensation // Display welcome message System.out.println("Hello, welcome to the Simple Commission " + "Calculator.") ; // Insert a blank line System.out.println(); // Create a Scanner object to read input Scanner keyboard = new Scanner(System.in); // Get user credentials System.out.println("Please enter your first name.") ; firstName = keyboard.nextLine(); System.out.println("Please enter your last name.")…

    • 1025 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Nt1310 Unit 1 Assignment

    • 466 Words
    • 2 Pages

    (i) Identify and label 15 processes covering all the different basic types and a wide range of different subtypes, and also the associated participants. When labeling the process, indicate, if it applies, the subtype of process involved. Try to choose 15 processes in the same fragment or section of the text or across contiguous sections. This will facilitate the establishment of patterns afterwards; (30)…

    • 466 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Nt1310 Unit 3 Assignment

    • 256 Words
    • 2 Pages

    Write a program to read the name of 5 students through keyboard and store them in a file “name.txt”.…

    • 256 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Display the contents of the file GRADES created in Problem 1. Each student’s record should appear on a separate line and include the total score (the sum of the three tests) for that student. For example a line output might be:…

    • 349 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    Program Lovecs.Java

    • 422 Words
    • 2 Pages

    import java.util. Scanner; public class LoveCS { public static void main(String[] args) { Scanner scan=new Scanner(System.in); System.out.println("Enter how many times you wish the message to be printed."); int limit = 0; limit= scan.nextInt(); int sum=0; int count=1; while (count <=limit) { System.out.println(count+" I love Computer Science!!"); sum+=count; count++; } System.out.println("Printed this message " + limit + " times."); System.out.println("The sum of the numbers from 1 to "+limit+" is "+sum); } } import java.util. Scanner; public class PowersOf2 { public static void main(String[]args) { int valuePowersOf2; int nextPowersOf2 =1; int exponent= 0; int count=0; Scanner scan = new Scanner(System.in); System.out.println("Enter A Number.");…

    • 422 Words
    • 2 Pages
    Better Essays
  • Satisfactory Essays

    * Running program looks like: This program finds sum or product of a LARGE numbers of integers. Enter as many integers > 0 as you would like. Enter the numbers: 1 3 5 7 7 5 3 1…

    • 779 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    a particular programming problem and can often be downloaded from the Web site of the…

    • 398 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    sharp decline in the company's revenues. She asks her team to diagnose the issue and…

    • 1770 Words
    • 17 Pages
    Better Essays
  • Good Essays

    Psychology Assignment

    • 1556 Words
    • 7 Pages

    10. College XYZ wants to collect information from students concerning a plus/minus grading system (the college administration wants to add minus grades to the plus values…

    • 1556 Words
    • 7 Pages
    Good Essays

Related Topics