0% found this document useful (0 votes)
28 views5 pages

Problem Solving

Problem solving techniques

Uploaded by

kookafor893
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views5 pages

Problem Solving

Problem solving techniques

Uploaded by

kookafor893
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

PROBLEM SOLVING PROCESS

Problem 1: You received a call from Mrs. Elizabeth Akpakpan who claimed to be the procurement officer
for SUNIC FOODS LIMITED. You have been asked to provide a software that will cater for the following
automation needs:

1. receive enquiries about SUNIC FOODS, resolve basic queries and escalate non-standard queries
to a human representative

2. Book/request for food deliveries

3. Check status of prior requests.

In solving a problem, the following steps are followed:

a. Understand the problem by re-reading the problem statement.

b. Represent the problem in a formal way using requirement specification.

What are requirements?

Requirements are the expectations from a system. Requirements can consist of the user requirement
(what the user needs) and the system requirement (what the system is to do). In real situation, there are
two kinds of requirement namely: Functional requirement and Non-functional requirement.

REQUIREMENTS

Functional Requirement Non-functional requirement

Functional Requirement: Functional requirement states or captures what a system should do. Example
of functional requirement is the system requirement: From the given problem, of an automation
software, the system requirement includes: receive enquiry, resolve basic query, escalate non-standard
query, book request, check status of previous request.

From the system requirement, we can conclude that all functional requirements follow a syntactical
pattern of VERB – NOUN

After resolving the functional requirement, A Quality assurance engineer takes the requirements and
create test modules after the programmer is done with the development. The built test modules after
the programmer has done his work is being used to check the requirements. If the test modules meet
the requirement, it then becomes authenticated and otherwise, vice versa.

Hence, the functional requirements are:

1. Receive enquiry
2. Resolve basic query
3. Escalate non-standard query
4. Book request
5. Check status of prior request
6. Present/display menu
7. Cancel request
8. Make payment
9. Provide feedback on request.

Non-functional requirements: These are the basic factors that are not required by the software. These
requirement includes:

1. Usability
2. Performance
3. Availability
4. Reliability
5. Security

c. Design an algorithm for solving the problem

After identifying the problem and the functional requirements, the next step in the process is to
find a way to represent what you’ve discovered in a flowchart or pseudocode.

d. Testing and implementation of the algorithm with any programming language ( in this case,
we used Java).

From the algorithm you’ve designed, implement the instructions with a programming language
like Java, C++, C etc.

e. Documentation of the algorithm

The documentation of the flowchart and pseudocode helps in maintenance of the program,
debugging and also for reference purpose.

PSEUDOCODE

The features of Pseudocode include:

a. Plain language description


b. Steps of an algorithm
c. Usually high-level.
d. Short context- sensitive word.
e. Not rigid.

FLOWCHART

Flowchart is defined as a diagrammatic representation of algorithm. The symbols for representing an


algorithm with flowchart include:

START
Rectangle (For processing)

Trapezium ( Input and output)

Diamond ( Decision making)

Etc..

Progamming constructs

1. If – else
2. Loops
3. Functions – methods – procedures – actions
4. Data structures.

TYPE OF SOFTWARE

1. Web application
2. Mobile application
3. Desktop application
4. Console application
5. Embedded system

Building a console application in Java

Package application;

Public class MyApplication {

Public static void main (String[ ] args) {

// write your code here

Points to note:
1. Package: A package is a folder structure used to organize files.
2. Modifiers: They control access to resources of a program. In Java, we have some modifiers
such as private, public and protected.
3. Java programs are implemented with classes
4. What defines a class are fields and methods
5. Fields are referred to as variables
6. Methods are units that combines your commands together
7. Two classes cannot have a main method in one application.

Naming Convention

Keywords used in Java must start with small letter while class starts with capital letters..

Examples of keywords: int, double, float, public, private, static, void, main, etc.

Examples of Class: Scanner, MyApplication etc.

Exercise: program a java console application that can add two numbers by requesting input from
user

Solution

Package calculator;

Import java.util.scanner;

Public class Add2numbers {

public static void main (String[ ] args) {

//Declare Variables x and y as integer

Int x;

Int y;

//Create a scanner class and instantiate the class

Scanner scanner = new Scanner(System.in);

// Request input from users

System.out.println(“Enter the first number: “);

X = scanner.nextInt();

System.out.println(“Enter the second number: “);

Y = scanner.nextInt();

// Print out the result


System.out.println(“The sum of the two numbers is: “ + (x +y));

Exam secret

1. Look critically before you answer any problem


2. Take not of access modifiers in the given question (public or private)
3. Take not of interpretation of problem
4. Remember that modifier affects only the main method
5. Remember that you cannot call a private class from outside
6. Access modifier on classes and methods have different impact.

RESEARCH ON THESE

1. What happens when an access modifier is not stated in the main method

2.Review Java Math Library

You might also like