You are on page 1of 48

DESIGN AND IMPLEMENTATION OF NUMERAL BASE AND LOGIC

OPERATIONS SYSTEM

BY

HARUNA, SADIYA RAJI


(1710308013)

SEPTEMBER, 2023
DESIGN AND IMPLEMENTATION OF NUMERAL BASE AND LOGIC
OPERATIONS SYSTEM

BY

HARUNA, SADIYA RAJI


(1710308013)

A PROJECT SUBMITTED TO THE DEPARTMENT OF COMPUTER SCIENCE,


FACULTY OF SCIENCE, FEDERAL UNIVERSITY GUSAU, IN
PARTIALFUFILMENT FOR THE REQUIREMENTS OF THE AWARD OF
BACHELOR OF SCIENCE DEGREE IN COMPUTER SCIENCE.

SEPTEMBER, 2023
DECLARATION

I hereby declare that this project was written by Haruna Sadiya Raji. It is a record of my

own research work and it has not been presented before in any previous application for a

Bachelor degree. All cited references have been duly acknowledged.

____________________________ __________________
Haruna Sadiya Raji Date
(1710308013)

i
CERTIFICATION

This research project by Haruna Sadiya Raji (1710308013) has met the requirements for

the award of Degree of Bachelor of Science (Computer Science) of Federal University Gusau

and is approved for its contribution to knowledge.

____________________________ __________________
Mal. Muhammad Lawali Jabaka Date
(Project Supervisor)

_____________________________ _________________
Mal. Muhammad Lawali Jabaka Date
(Head of Department)

_____________________________ __________________
Prof Abdulwahab Lawan Date
(External Examiner)

_____________________________ __________________
Dr. N. A. Sani Date
(Dean Faculty of Science)

ii
DEDICATION

I give thanks, first and foremost, to Lord Almighty, without His mercy and grace, this project

would not have been made possible. I also thank my loving parents who have been my

constant source of inspiration.

iii
ACKNOWELEDGEMENT

My gratitude, first and foremost, goes to Lord Almighty for His Infinite Mercy and Grace.

I want to give special thanks to my parents (Mal. Haruna Raji and Malama Asiya Haruna)

for their support and love, Lord’s blessings I pray.

Special thanks go to my project supervisor who is also the Head of the Department of

Computer science in person of Mal. Muhammad Lawali Jabaka for his advice,

encouragement and support.

My appreciation goes to my intelligent lecturers which are Dr. Samaila Musa, Mal. Mansur

Muhammad, Mal. Garba Muhammad, Mal. Abubakar Usman Muhammad, Mal. Samaila

Shuaibu, Mal. Ali Muhammad Kawo, Mal. Shamsuddeen Muhammad, Mal Najib

Abdulrazaq, Mal. Nuraddeen Idris Muhammad and Malama Firdausi Umar Kaita for all they

have taught me.

Special thanks to Auwal Dalhatu Sani for the love and support all through. Supporting me

with prayers and giving me the best of advice when I need it the most.

I am grateful to Mal. Hassan Yunisa for his selflessness and all that he taught me, may the

Lord Almighty bless and add more to what’s in store for him.

I am grateful to these amazing beings (Aisha, Peace, Faith, Fauziyya, Solomon, Alfred,

Yahaya Waziri, AbdulFatah) and the rest of my course mates, for all we have been through

together.

iv
TABLE OF CONTENTS
DECLARATION .................................................................................................................... i
CERTIFICATION ................................................................................................................. ii
DEDICATION ...................................................................................................................... iii
ACKNOWELEDGEMENT .................................................................................................. iv
TABLE OF CONTENTS ....................................................................................................... v
LIST OF FIGURES ............................................................................................................ viii
LIST OF TABLES ................................................................................................................ ix
ABSTRACT ........................................................................................................................... x
CHAPTER ONE .................................................................................................................... 1
INTRODUCTION ................................................................................................................. 1
1.1 Overview ..................................................................................................................... 1
1.2 Background of the Study ............................................................................................ 1
1.3 Statement of the Problem ............................................................................................ 2
1.4 Aim and Objectives of the Study ................................................................................ 2
1.4.1 Aim ............................................................................................................................. 2
1.4.2 Objectives ................................................................................................................... 2
1.5 Significance of the Study ............................................................................................ 3
1.6 Scope of the Study ...................................................................................................... 3
1.7 Limitations of the Study.............................................................................................. 4
1.8 Definition of Some Basic Terms................................................................................. 4
CHAPTER TWO ................................................................................................................... 5
LITERATURE REVIEW ...................................................................................................... 5
2.1 Introduction ................................................................................................................. 5
2.2 Review of Related Literature ...................................................................................... 5
CHAPTER THREE ............................................................................................................. 11
SYSTEM ANALYSIS AND DESIGN ................................................................................ 11
3.1 Overview ................................................................................................................... 11
3.2 Analysis of the Existing System ............................................................................... 11
3.2.1 Flowchart of the Existing System ............................................................................. 12
3.3 The Proposed System ................................................................................................ 13
3.3 Proposed Model ........................................................................................................ 14
3.4 Requirement Analysis ............................................................................................... 14
3.5 Requirement Specifications ...................................................................................... 15

v
3.5.1 Functional Requirements .......................................................................................... 15
3.6 Tool and Techniques ................................................................................................. 15
3.7 Programming Methodology ...................................................................................... 16
3.7.1 Procedure for Conversion of Numbers ..................................................................... 16
3.7.1.1 Conversion of Decimal Number to any Number System ........................................ 16
3.7.1.2 Conversion of any Number Base System to Decimal Number System ................... 18
3.7.1.3 Conversion of Binary to Octal Number System ...................................................... 19
3.7.1.4 Conversion of Binary to Hexadecimal Number System .......................................... 19
3.7.2 Addition of Binary Numbers and their Decimal Equivalents ................................... 20
3.7.3 Addition of Hexadecimal Numbers .......................................................................... 20
3.7.4 Addition of Octal Numbers ....................................................................................... 21
3.7.5 Complementing Numbers ......................................................................................... 21
3.8 System Design .......................................................................................................... 22
3.8.1 System Architecture .................................................................................................. 23
3.8.2 Use Case Diagram..................................................................................................... 24
3.8.3 System Flowchart...................................................................................................... 25
3.9 Database Design........................................................................................................ 26
CHAPTER FOUR ................................................................................................................ 27
SYSTEM IMPLEMENTATION AND TESTING .............................................................. 27
4.1 Overview ................................................................................................................... 27
4.2 System Implementation ............................................................................................ 27
4.2.1 User Interface Design ............................................................................................... 27
4.2.2 Conversion among Numeral Bases ........................................................................... 28
4.2.3 Arithmetic Calculation among Numeral Bases......................................................... 28
4.2.4 Complement Calculation .......................................................................................... 29
4.2.5 Logic Operation ........................................................................................................ 29
4.2.6 Submitting Feedback ................................................................................................ 30
4.3 Testing....................................................................................................................... 30
4.3.1 Tested Features ......................................................................................................... 31
4.4 System Documentation ............................................................................................. 32
4.5 System Maintenance ................................................................................................. 32
CHAPTER FIVE ................................................................................................................. 33
SUMMARY, CONCLUSION AND RECOMMENDATIONS .......................................... 33
5.1 Summary ................................................................................................................... 33

vi
5.2 Conclusion ................................................................................................................ 33
5.3 Recommendation ...................................................................................................... 33
REFERENCES .................................................................................................................... 34

vii
LIST OF FIGURES

Figure 3. 1: Existing System Flowchart ............................................................................... 12


Figure 3. 2: System Architectural Design ............................................................................ 23
Figure 3. 3: Administrator Module Architectural Design .................................................... 24
Figure 3. 4: Use Case Diagram ............................................................................................ 24
Figure 3. 5: System Flowchart ............................................................................................. 25
Figure 4. 1: Home Page…………………………………………………………………….27
Figure 4. 2: Base Converter Page ........................................................................................ 28
Figure 4. 3: Base Calculator Page ........................................................................................ 28
Figure 4. 4: Complement Calculator Page ........................................................................... 29
Figure 4. 5: Logic Calculator Page ...................................................................................... 29
Figure 4. 6: Feedback Page .................................................................................................. 30
Figure 4. 7: Feedback Comment Display ............................................................................ 30

viii
LIST OF TABLES

Table 2. 1: Number Base Representation .............................................................................. 9


Table 2. 3: Truth Table ........................................................................................................ 10
Table 3. 1: Not Operator Table………………………………………………….................26
Table 3. 2: Table for Operators with Two Operands ........................................................... 26
Table 3. 3: Table for Operators with Three Operands ......................................................... 26
Table 3. 4: Administrator Table ........................................................................................... 26
Table 3. 5: Feedback Table .................................................................................................. 26

ix
ABSTRACT

As we are in a digital age where computers have been built to emulate most services usually
offered by humans in a faster and more efficient way, the idea of designing a computer-aided
system for converting number bases, performing complements and arithmetic operations on
these number bases, and Boolean logic operations came to mind. The Numeral Base and
Logic Operations System is a web-based application that will help users to make
computations/calculations of fifteen (15) different numeral bases, alongside logic
operations. The application consists of multiple calculators that perform different tasks,
these calculators are: a numeral base converter, a numeral base calculator, a numeral base
complement calculator and a logic calculator. The system was developed using HTML, CSS,
JavaScript, MySQL and Python Flask. Despite some limitations, the project reached a level
of success. The development process has been documented, alongside the research and
testing of the final system. The tools and techniques used in the system, as well as some other
functions to be added in the future have also been documented.
Keywords: Converter, Calculator, Numeral, Logic.

x
CHAPTER ONE
INTRODUCTION
1.1 Overview

This project is developed as a web-based application to allow users to make computations

using the various calculators that are designed in the environment. These calculators make

possible, the conversion of several number bases, the arithmetic calculation of the number

bases, the complement operation of the main numeral bases in Computer science, performing

operations on Boolean logic and generating truth tables for logical operators. In this chapter,

the background of the study, statement of problem, aim and objectives, significance of the

study, as well as the scope of the study will all be discussed.

1.2 Background of the Study

We convey information to one another in a particular language that is made up of letters and

words. We normally input letters or words through the keyboard of the computer system, but

the computer does not understand the words and letters. Rather, those words and letters are

translated into numbers. We know the decimal (base 10) system, and we are very comfortable

with its operations when using this base system, it is also important for us to understand that

the decimal system is not the only system in the world. By studying other systems such as

binary (base 2), quaternary (base 4), octal (base 8), hexadecimal (base 16) and so forth, we

will gain a better understanding of how number systems work in general (Pandya, 2017).

Numeral systems are the technique to represent numbers in the architecture of computer

systems, every value that is saved or retrieved from the computer memory has a defined

number system so we need to study them and also know the conversion techniques between

them (Shukla, 2023).

1
The apprehension of number systems and their inter conversion is vital for understanding of

computers. Moreover, successful programming for digital devices requires a specific

understanding of data formats, number systems and their inter conversion. The inter

conversion (a process in which something is being converted into another) of number system

requires a lot of time and techniques to expertise (Latif et al., n.d).

Therefore, the Numeral Bases System and Logic Operations Calculator was designed to help

solve these problems.

1.3 Statement of the Problem

The number base conversions and calculations are carried out using all numeral types which

are positive numerals, negative numerals, whole numerals and fractional numerals.

It is an undeniable fact that there are online systems that carry out computations of this nature,

but most of these online systems are limited to accepting and computing whole numbers only

(fractional numbers are rejected, and for some, negative numbers are rejected too).

The Numeral Base and Logic Operations System however, intends to solve these problems

by rendering the results of the computations in the most effective way, accepting all kinds of

valid numeral inputs which are whole, fractional, positive and negative.

1.4 Aim and Objectives of the Study

1.4.1 Aim
The aim of the study is to develop a numeral bases system and logic operations calculator

that will facilitate the automation of numeral system conversions and calculations.

1.4.2 Objectives

The objectives of the study are as follows:

i. To analyze the existing system

2
ii. To design the system architecture that describes the proposed system.

iii. To develop an automated numeral base and logical operating system.

iv. To implement the developed system

v. To test the performance of the system

1.5 Significance of the Study

The design of the numeral system and logic application brings about a quicker access to the

result of the numeral operations without the need for manual calculations. The beneficiaries

of this project are students (in Computer science, Mathematics and other science courses)

and tutors.

Every science student needs an understanding of the system of numeration depending on

their level in the field. The project would provide a reliable means of sourcing for help in

numerical problems with high degree of accuracy.

It is also an advantage for tutors because they no longer have to rely on the limited examples

offered by text materials, but they can try as many problems as possible to expand their

knowledge of the system of numerations.

This research work will also be open for other researchers who would like to improve this

system.

1.6 Scope of the Study

This project covers four main calculating environments and they are:

i. Base Converter

ii. Base Calculator

iii. Complement Calculator

iv. Logic Operations Calculator

3
1.7 Limitations of the Study

The numeral base complement calculating environment among other calculating

environments of the system is limited to some certain inputs. Where the decimal base 9’s and

10’s complement can accept both whole and fractional inputs, other base complements are

limited to whole numbers only. The administrator is also limited to viewing the feedback of

the users only, to know what they think of the calculator.

1.8 Definition of Some Basic Terms

i. System: A collection of different entities working together to function as one.

ii. Number System: A system expressing or representing numbers.

iii. Conversion: The process of changing or causing something to change from one form

to another.

iv. Computation: The action of mathematical calculation.

v. Logic Operation: An operation that acts on binary numbers to produce a result

according to the laws of Boolean logic (e.g., the AND, OR and NOT functions).

vi. Research: The systematic investigation into and study of materials and sources in

order to establish facts ad reach new conclusions.

vii. Numeral: A figure, symbol, or group of figures or symbols denoting a number.

viii. Complement: Refers to all objects in one set that are not in another set.

ix. Input: What is put in, taken in, or operated on by any process or system.

4
CHAPTER TWO
LITERATURE REVIEW
2.1 Introduction

Numeral system is the approach of expressing numbers in the architecture of computer

system, every value that is stored or retrieved into or from the computer memory has a

defined number system. A number system associates quantities and symbols.

In digital systems, the method in which information is represented is key and there are

different radices, that is, number bases that a numbering system can use (Shukla, 2023).

Number Representation can have different base values like Binary (base 2), Octal (base 8),

Decimal (base 10) and Hexadecimal (base 16), the base number represents the number of

digits that is used in that numbering system. An example, in decimal numeral system the

digits used are: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. The digits for binary are: 0 and 1, the digits for

octal are: 0, 1, 2, 3, 4, 5, 6 and 7. For the hexadecimal numbering system which has the base

16, the digits are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F (Raveendran, 2022).

The number system helps us in identifying the extent to which we need to limit an entity.

These give us a general insight into the mathematical operations regarding the given

numbers. This helps in the calculation of numbers using mathematical operations. This gives

us a measure of the distance or quantity of an object. These play a significant role in helping

us deal with currency. These help us in getting to the solutions of arithmetic progressions

and equations. These are helpful for us in making general calculations and getting to a certain

result. They help us keep up with general mathematics in daily life (Saini et al., 2023).

2.2 Review of Related Literature

The rise of computers and computer graphics has increased the need for knowledge of how

to work with different (non-decimal) base systems, particularly binary systems (ones and
5
zeroes) and hexadecimal systems (the numbers zero through nine, followed by the letters A

through F). Changing numeral bases, such as converting from base 2 (binary) to base 10

(decimal) is known as base conversion. There are various number bases and the well-known

number bases in Computer science are base 2 (Binary), base 8 (Octal), base 10 (Decimal)

and base 16 (Hexadecimal) (Ojumu, 2016).

Conversion of whole numbers are different from numbers with decimal points (floating

point numbers). The conversion of numeral bases system deals with the operations to change

the base of the numbers. An instance is, to change a decimal number with base 10 to a binary

number with base 2. We can also perform the arithmetic operations like addition, subtraction,

multiplication on the numeral system (Raveendran, 2022).

Logic circuits are used for the generation and transmission of zeros and ones to compute and

convey information. This two-valued number system is called Binary. There are many

essential advantages of using a binary system; however, the human brain has been taught to

count, label, and measure using the decimal numeral system. The decimal number system

consists of ten unique symbols (0 - 9) commonly referred to as the Arabic numerals. Each of

these symbols is allotted a relative magnitude to the other symbols. Clear instance, 0 is less

than 1, 1 is less than 2, etc. It is often supposed that the ten-symbol numeral system that the

humans use is due to the availability of the ten fingers (or digits) to envisage counting up to

ten (10). Regardless, the brains are trained to think of the real world in terms of a decimal

system (LaMeres, 2019).

In order to conceal the gap between the way the brains think (using decimal) and how it

builds the computers (using binary), it needs to comprehend the basics of numeral systems.

This includes the formal description of a positional numeral system and how it can be

6
expanded to adapt any arbitrarily large or small value. This also contains how to make

conversions among different numeral systems that contain different numbers of symbols.

The study of both decimal and binary is a clear phenomenon as they represent how brains

interpret the physical world (in decimal) and how computers work (in binary). The

Hexadecimal numeral system is studied because it is a beneficial means to represent large

sets of binary values using a manageable number of symbols. The Octal numeral system is

rarely used but it is studied as an example of how the formalization of the number systems

can be applied to all systems regardless of the number of symbols they contain (LaMeres,

2017).

Computers perform all of their operations or computations using the binary, or base 2 number

system. All program codes and data are stored and manipulated in binary form. Calculations

are performed using binary arithmetic. Every digit in a binary number is known as a bit (for

binary digit) and can have only one of two values, 0 or 1 (Awati, 2022).

The number of bits that are used in calculations affects the accuracy and size limitations of

the numbers manipulated by the computer. In fact, in some programming languages, the

number of bits to be used can actually be specified by the programmer in the statements of

declaration. In the programming language Java, for instance, the programmer can declare a

signed integer variable to be short (16 bits), int (32 bits), or long (64 bits) depending on the

anticipated size of the number being used and the required accuracy in calculations (Ahl,

2016).

The number base of a numeral system talks about the unique or different symbols and

notations it uses to represent a value. A clear instance is the number base 2 that tells us there

are only two unique notations which are 0 and 1. The number base that is known as the most

7
common is decimal, which is also known as base 10. The decimal number system makes use

of ten different notations, and they are the numbers 0 to 9. The numeral system is used in the

computer system for better communication and representation (Sharma et al., 2023).

A Binary number system (which is one amongst the four main number systems) has only two

digits that are 0 and 1. Every number or value can be represented by 0 and/or 1 in this number

system. The base of binary number system is base 2, because it has only two digits. Each 0

or 1 is called a bit. A binary number of 4 bits is called a Nibble. A binary number of 8 bits is

called a Byte. The binary system is essential because any class of devices having the

capability to solve problems by processing information in discrete form (digital systems)

operates on data, including letters and symbols, that are expressed in binary form, that is,

using only two digits 0 and 1 (“Binary Number”, 2023).

The Octal number system consists of eight (8) digits from 0 to 7. Every number or value is

represented by 0, 1, 2, 3, 4, 5, 6 and/or 7 in this number system. The base of octal number

system is 8, because it contains only eight (8) digits. Decimal number system has ten (10)

digits from 0 to 9. Every number or value can be represented by 0, 1, 2, 3, 4, 5, 6, 7, 8 and/or

9 in this number system. The base of decimal number system is 10, because it contains only

ten (10) digits. A Hexadecimal number system has sixteen (16) alphanumeric values which

is a combination of digits and letters from 0 to 9 and A to F. Every number or value can be

represented by 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and/or F in this number system. The

base of hexadecimal number system is 16, because it contains sixteen (16) alphanumeric

values. Here A represents 10, B represents 11, C represents 12, D represents 14, E represents

15 and F represents 16 (Sheldon, 2023).

8
Table 2. 1: Number Base Representation

Number Base Digits Used Example


System
Binary 2 0,1 (110100)2

Octal 8 0, 1, 2, 3, 4, 5, 6, 7 (3530)8
Decimal 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (298)10
Hexadecimal 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F (D54A)16

Awati (2022) described the process of complements as a technique to encode a symmetric

range of positive and negative integers in a way that they can use the same algorithm (or

mechanism) for addition throughout the whole range. For a given number of places, half of

the possible representations of numbers encode the positive numbers, the other half represent

their respective additive inverses. The pairs of mutually additive inverse numbers are called

complements. Thus, subtraction of any number is implemented by adding its complement.

Changing the sign of any number is encoded by generating its complement. The complement

is classified into several types:

i. One’s (1’s) Complement: The 1's complement of a number is obtained by changing

all 1's to 0's and all 0's to 1's.

ii. Two’s (2’s) Complement: The 2's complement of binary number is obtained by

adding 1 to the Least Significant Bit (LSB) of the 1's complement of a binary number.

It is simply expressed as 2's complement = 1's complement + 1.

iii. Nine’s (9’s) complement: Addition of signed Binary Coded Decimal (BCD) numbers

can be performed by using 9’s and 10’s complement. The complements are

performed in order to make the arithmetic operations in digital systems easier. To

achieve the 9’s complement of any number we have to subtract the number with (10n
9
- 1) where n = number of digits in the number, or in an easier form we have to divide

each digit of the given decimal number with the value 9. Below are the 9’s

complement equivalent for decimal numbers:

iv. Ten’s (10’s) Complement: To obtain the desired 10’s complement of a number, one

(1) will be added to the 9’s complement of that number.

Logical calculations help to determine if a certain condition is true or false (Boolean logic).

The various operations carried out are the AND, OR, NOT, NAND, NOR, XOR, and XNOR

operations. They work on binary inputs. Some of the logical operators are often used to help

create a test expression that controls the flow of programs. This type of expression is also

known as a Boolean expression because they create a Boolean result or value when

computed. There are three main logical operators that produce a Boolean value by

manipulating other Boolean operands and they are AND, OR and NOT (Busbee, 2018).

Truth tables are used in Boolean algebra and in other areas of science and Mathematics that

focus on Boolean logic to show the possible results of an expression or operation in terms of

its truthiness or falseness. A logical expression contains one or more Boolean functions that

tries to determine the logic that is used in calculating the expression's truthiness or falseness

(Carter, 2021). Below is the truth table for two inputs of all logical operators:

Table 2. 2: Truth Table

INPUTS OUTPUTS
A B AND OR NOR NAND XOR XNOR NOT A NOT B
0 0 0 0 1 1 0 1 1 1
0 1 0 1 0 1 1 0 1 0
1 0 0 1 0 1 1 0 0 1
1 1 1 1 0 0 0 1 0 0

10
CHAPTER THREE
SYSTEM ANALYSIS AND DESIGN
3.1 Overview

The methodology in the course of this study is to firstly outline the set of requirements to be

met by the proposed system, then envision and implement the design of the application. It

shows the system architecture of the proposed system and the methodology the proposed

system intends to use in solving current problems.

System design describes the element of a system such as the architecture, modules and

components, the different interfaces of those components and the data that goes through the

system. Therefore, system design either represents the new system in view or describes how

the current system will be modified.

3.2 Analysis of the Existing System

The existing system consists of a number base converter and calculator that accept only

whole numbers as inputs and computes them depending on the chosen operation. Any input

other than whole numbers inputted by the user prompts an error message asking the user to

enter a valid input. Therefore, the existing system is designed to solve problems in which the

numerals do not contain decimal points.

11
3.2.1 Flowchart of the Existing System

Figure 3. 1: Existing System Flowchart

12
3.3 The Proposed System

The Numeral Bases System and Logic Operations Calculator is a web-based application

containing four main calculating environments:

The first calculating environment is the number base converter that can make conversions

among fifteen bases that are base 2 (binary), base 3 (ternary), base 4 (quaternary), base 5

(quinary), base 6 (senary), base 7 (septenary), base 8 (octal), base 9 (nonary), base 10

(decimal), base 11 (undecimal), base 12 (duodecimal), base 13 (tri-decimal), base 14

(tetradecimal), base 15 (pentadecimal), and base 16 (hexadecimal). The converter can

convert a base from amongst the bases listed to any other base within this range.

The second calculating environment is the number base calculator that allows the

performance of arithmetic operations among all the fifteen bases in the system. These

operations (addition, subtraction, multiplication and division operation) can add two binary

numbers, subtract one binary number from another, get the product of two binary numbers

or divide one binary number by another, and same can be applied to other number bases

within the range of base 2 (binary) to base 16 (hexadecimal) numeral system.

The third calculating environment is the number base complement calculator that finds the

complement of a given number. It works on 1’s and 2’s complement of binary numbers, 9’s

and 10’s complement of decimal numbers.

The fourth calculator is a logic calculator that accepts binary inputs and operates on them

using a Boolean operation. The operators are AND, OR, NOT, NOR, NAND, XOR and

XNOR. Within this calculating environment is a function for generating and displaying truth

tables of the AND, OR, NOT, NOR, NAND, XOR and XNOR operators depending on the

number of variables chosen by the user.

13
The system also has an administrator. It is the duty of the administrator to maintain the

system. The administrator will be able to perform the function of viewing the feedback or

comments from the users. That way, the administrator will be able to know if there are

complaints from the users and if the system is faulty.

3.3 Proposed Model

The Iterative model has been decided for use in this project. In the iterative model, instead

of beginning with requirements that are completely known, a set of software requirements is

used and implemented, tested, then evaluated and further requirements can be identified. A

new sect of the software is produced with each phase, or iteration. Rinsing and repeating is

carried out until the complete system is ready. The Iterative model was chosen for this project

because it has the merit of yielding an early working version of the project in the process and

making it less expensive to implement changes.

3.4 Requirement Analysis

Most students or users often have to solve the numeral base problems manually for their

assignments, and teachers, for their research. Even when they try to surf the internet to search

for numeral base applications online, the converters they find have so many limitations. A

clear instance is an online base converter that cannot accept negative numbers for conversion,

or a converter that can only accept whole numbers. When students need to convert a whole

lot of negative or fractional numbers, they will have no choice but to make the calculations

manually which will be tedious, tiring and may lead to incorrect results.

Most users’ issues will be solved in this project by providing easy access to all the calculating

environments and providing accurate results from the comfort of their computers without

spending much time to solve the problems manually.

14
3.5 Requirement Specifications

The software required for the development of the project are:

i. Sublime Integrated Development Environment or Notepad

ii. HTML, CSS, JavaScript and Bootstrap for the frontend development

iii. Python and its framework called Flask for the backend development

iv. MySQL for the database to generate tables

v. XAMPP server and a web browser.

The hardware requirements include computer systems, portable and handheld mobile

devices.

3.5.1 Functional Requirements

The functional requirement specifications describe the characteristics and behaviors that the

system needs to contain. It highlights the specific characteristics that must be part of the

system for it to work to fulfill its purpose.

1. Calculator Unit: the users should be able to use any among the calculating

environments to perform their computations

2. Administrator Unit: The administrator should be able to maintain the system thereby

checking it time to time to ensure users are satisfied with the way the system works and

fix errors or breakdowns that may occur.

3.6 Tool and Techniques

1. The computations and back-end procedures were developed using one of the

frameworks of Python that is known as Flask.

2. The front end of the web application was developed using HTML, CSS, Bootstrap

and JavaScript.
15
3. The database was created using MySQL to help retrieve the truth tables of logic

operators.

3.7 Programming Methodology

The programming methodology used for this project is the procedural programming. In

procedural programming, problem is disintegrated into procedures, or blocks of code that

perform different tasks. When all procedures are combined, they form the whole program.

3.7.1 Procedure for Conversion of Numbers

The main conversion among number bases are the conversion of decimal numbers to other

bases and the conversion of other bases to their decimal equivalent. The steps for each

conversion process used in this project is discussed below.

3.7.1.1 Conversion of Decimal Number to any Number System

The process is as follows:


 Step 1. Convert the integer part by performing a successive division using the radix of

the number system that the decimal value is to be converted to.

 Step 2. Convert the fractional part by performing a successive multiplication using radix

of the number system that the decimal value is to be converted to.

Example 1. Convert (14.625)10 decimal number to binary number

2 14

2 7 R 0

2 3 R 1

2 1 R 1

0 R 1

16
 1st Multiplication Iteration

Multiply 0.625 by 2

0.625 x 2 = 1.25 (Product) Fractional part=0.25 Carry=1 (MSB)

 2nd Multiplication Iteration

Multiply 0.25 by 2

0.25 x 2 = 0.50 (Product) Fractional part = 0.50 Carry = 0

 3rd Multiplication Iteration

Multiply 0.50 by 2

0.50 x 2 = 1.00 (Product) Fractional part = 1.00 Carry = 1 (LSB)

Therefore, the binary number of (14.625)10 is (1110.101)2.

Below is an example of a conversion of decimal to octal number system:

Example 2. Converting (262.589)10 decimal number to its octal equivalent, we have:

8 262

8 32 R 6

8 4 R 0

0 R 4

For the fractional part:

0.589 x 8 = 4.712 (Product) Fractional part=0.712 Carry=4 (MSB)

0.712 x 8 = 5.696 (Product) Fractional part=0.696 Carry=5

0. 696 x 8 = 5.568 (Product) Fractional part=0. 568 Carry=5

0.568 x 8 = 4.544 (Product) Carry=4 (LSB)

The result of the fractional part is 0.4554, therefore the octal number of 262.58910 is

406.45548.
17
Example 3. Convert (1692.0622)10 decimal fraction to its hexadecimal equivalent

16 1692

16 105 R 12

16 6 R 9

0 R 6

For the fractional part:

0.0622 x 16 = 0.9952 (Product Fractional part=0.9952 Carry=0 (MSB)

0.9952 x 16 = 15.9232 (Product) Fractional part = 0.9232 Carry = 15 -> F

0.9232 x 16 = 14.7712 (Product) Fractional part = 0.7712 Carry = 14 -> E

0.7712 x 16 = 12.3392(Product) Fractional part = 0.3392 Carry = 12 -> C

0.3392 x 16 = 5.4272(Product) Carry = 5(LSB)

The Hexadecimal number for 1692.062210 is 69C.0FEC516.

3.7.1.2 Conversion of any Number Base System to Decimal Number System

The steps are as follows:

 Get the column or positional value of each digit (this depends on the position of the

digit).

 Multiply the column values that have been determined (in step 1) by the digits in the

corresponding columns.

 Sum up the products that were calculated in step 2. The total is the equivalent value in

decimal.

Example 1. Convert binary 111.1012 to decimal number system

111.101 = (1 x 22) + (1 x 21) + (1 x 20). (1 x 2-1) + (0 x 2-2)

+ (1 x 2-3)
18
= (1 x 4) + (1 x 2) + (1 x 1) .1 x (1/2) + 0 x (1/4) + 1 x

(1/8)

= (4 + 2 + 1). (1/2) + 0 + (1/8)

= 7 + 0.5 + 0.125 = 7.625

Therefore (111.101)2 = (7.625)10

Example 2. Convert Octal 23.218 to its decimal equivalent.

23.218 = (2 x 81) + (3 x 80). (2 x 8-1) + (1 x 8-2)

= (2 x 8) + (3 x 1). 2 x (1/ 8) + 1 x (1/64)

= 16 + 3. (0.25) + (0.015625)

= 19 + 0 .265625

= 19. 26562510

Therefore (23.21)8 = (19.265625)10

3.7.1.3 Conversion of Binary to Octal Number System

An example to convert (101101011)2 to its Octal equivalent.

Its process is as follows:

Divide the binary into groups of three digits from the LSB (Least Significant Bit), the

following pattern will be formed: 101 | 101 | 011. Now determining the equivalent

decimal number of each group will be 5 | 5 | 3. So, the equivalent octal number of

(101101011)2 is 5538.

3.7.1.4 Conversion of Binary to Hexadecimal Number System

An example to convert (101101101)2 to its Hexadecimal equivalent.

Its process is as follows:

19
Divide the binary into groups of four digits from the LSB (Least Significant Bit) thereby

adding zeros at the front of the last bit remaining to form four bits, the following pattern will

be formed: 0001 | 0110 | 1101. Now writing the equivalent hexadecimal number of

each group will result to 1 | 4 | D. Therefore, the equivalent Hexadecimal number of

(101101101)2 is 14D16.

3.7.2 Addition of Binary Numbers and their Decimal Equivalents

There are some rules for binary addition:

Example: Add 10111110 and 10001101

1 0 1 1 1 1 0 0 0(carry)

190 1 0 1 1 1 1 1 0

+141 1 0 0 0 1 1 0 1

331 1 0 1 0 0 1 0 1 1

3.7.3 Addition of Hexadecimal Numbers

A carry value of 1 is obtained only when the sum of the numbers exceeds 15. Other than that,

the calculation is carried out the same way one would carry out a decimal addition.

20
Example: Add 19B916 and C7E616

1 1 0 0 (carry)

1 9 B 916 1 9 11 9

C 7 E 616 12 7 14 6

E 1 9 F16 14 17 25 15

14 17-16 25-16 15

E 1 9 F

3.7.4 Addition of Octal Numbers

The procedure is as follows:

i. Regard each number as a decimal number and add them as decimal numbers.

ii. After adding each column, if the sum of a column exceeds 7, divide the result by 8 to

evaluate the equivalent octal value.

iii. The remainder is going to be the part of the answer while the quotient is going to

become carry.

Example: Add 1628 and 7658

1 1 (carry)

1 6 2

+7 6 5

1 1 4 7

3.7.5 Complementing Numbers

Example 1: Find the 1's complement and 2’s complement of the binary number 101101.

21
1’s Complement: 2’s Complement:

1 0 1 1 0 1 0 1 0 0 1 0

0 1 0 0 1 0 +1

0 1 0 0 1 1

Example 2: Find the 9's complement and 10’s complement of the decimal number 459.

9’s complement: 10’complement:

9 9 9 5 4 3

-4 5 9 + 1

5 4 0 5 4 4

3.8 System Design

The system design defines the elements of a system like modules, architecture, components

and their interfaces and data for the system based on the specified requirements.

In the design of the proposed system, the system allows the user to learn at his own pace,

with his own examples. In this way, the user chooses the examples he or she wishes to use

to learn the algebraic equation by querying the software and having the answers displayed.

1. On the interface where all four calculating environments are displayed, the user selects

which environment to use.

2. For the base converter, the user enters the value of a certain base, specifies the base of

the inputted number, and chooses the base to be converted to.


22
3. Using the base calculator, the user inputs the values and selects the base of the values

which the arithmetic operation will be performed upon, then chooses the type of

operation to be performed on the inputted values.

4. Using the complement calculator, the user selects the type of complement operation to

be performed, and inputs the value to be complemented.

5. For the logic calculator, the user chooses whether to generate a truth table for all logic

operators by choosing the number of variables to be displayed, or chooses to perform

a basic operation using binary inputs and logic operators to get their results.

6. On the administrator part, the administrator logs into his own dashboard in order to

view all users feedback and suggestions, to also manage and maintain the calculator.

3.8.1 System Architecture

The architecture of the application is shown below and it shows the software with all its

calculating environments.

Figure 3. 2: System Architectural Design


23
Figure 3. 3: Administrator Module Architectural Design

3.8.2 Use Case Diagram

Below is the use case diagram that describes the process and shows the functions of the

system to the users and the administrator.

Figure 3. 4: Use Case Diagram


24
3.8.3 System Flowchart

Below is a flowchart that shows the step by step flow of activities within the system.

Figure 3. 5: System Flowchart


25
3.9 Database Design

Database design is the organization of data according to a database model. The data to be

stored and how data elements interrelate will be determined. A suitable database has been

designed for the system to help retrieve truth tables of the logical operators depending on the

number of variables that is chosen by the user, tables were designed to also store the

comments or feedbacks from users of the application.

Table 3. 1: Not Operator Table


Data Field Data Type Character Length
Input (x) INT 11
Output(~x) INT 11

Table 3. 2: Table for Operators with Two Operands

Data Field Data Type Character Length


Input1 (x) INT 11
Input2 (y) INT 11
Output INT 11
Table 3. 3: Table for Operators with Three Operands

Data Field Data Type Character Length


Input1 (x) INT 11
Input2 (y) INT 11
Input3 (z) INT 11
Output INT 11

Table 3. 4: Administrator Table

Data Field Data Type Character Length


id INT 11
username VARCHAR 255
password VARCHAR 255

Table 3. 5: Feedback Table

Data Field Data Type Character Length


id INT 11
name VARCHAR 255
email VARCHAR 255
comment LONGTEXT 255

26
CHAPTER FOUR
SYSTEM IMPLEMENTATION AND TESTING
4.1 Overview

This chapter will cover both the implementation and the testing part of this project. The

implementation part that will be discussed involves the source code and how each feature

has been created. The second part that will be discussed is the testing processes. The system

was put through a series of test cycles until all errors were corrected and the system’s

functionalities works as intended.

4.2 System Implementation

System implementation is the process of moving a system from the design stage to reality.

In this section, the main features and functionalities of the system will be discussed as well

as how they were implemented.

4.2.1 User Interface Design

The Numeral Base System and Logic Operations Calculator provides an interface to give

access to the calculating environments in the system.

Figure 4. 1: Home Page

27
4.2.2 Conversion among Numeral Bases

Users can make conversion of numbers or values among fifteen different number bases in

this environment.

Figure 4. 2: Base Converter Page

4.2.3 Arithmetic Calculation among Numeral Bases

Users can perform arithmetic calculation of numbers or values for every number base in this

environment. These calculations are addition, subtraction, multiplication and division, of any

number base within the range in the system.

Figure 4. 3: Base Calculator Page

28
4.2.4 Complement Calculation

Users can obtain 1’s and 2’s complement of the binary number system and 9’s and 10’s

complement of decimal number system using this environment. The 7’s and 8’s complement,

15’s and 16’s complement of octal and hexadecimal system respectively can also be obtained

if the numbers are whole.

Figure 4. 4: Complement Calculator Page

4.2.5 Logic Operation

This environment allows the user to perform basic logic operations as well as generate truth

tables of all the logic operators (AND, OR, NOT, NAND, XOR, XAND and NOR) for some

number of input variables (one, two or three variables).

Figure 4. 5: Logic Calculator Page


29
4.2.6 Submitting Feedback

The users can also share their experience after using the system, they can rate the system,

submit their complaints and suggestion after using the system. For users that are not used to

checking for a feedback link themselves before leaving a site, a pop up message will be

prompted in order to remind them to give their suggestions and rating on the feedback page.

Figure 4. 6: Feedback Page

Figure 4. 7: Feedback Comment Display


4.3 Testing

After the implementation had been completed, the testing phase came up. During the testing

phase, the complete system was checked and freed from errors and bugs.

The testing phase is an important aspect of developing a good software. It helps in the

validation and verification of functional requirements. Testing is essential for making sure

that the quality of the software is obtained. This was carried out by running test data through

30
the system to ensure that it works the way it is intended. This section will discuss all testing

procedures carried out for the complete system.

i. Unit Testing: A unit test is a way of testing a unit which is the smallest piece of code

in an application that can be logically set apart in a system. Each calculating

environment was taken as a single program unit.

ii. Integration Testing: Integration testing is the phase of testing in which the whole

software module is tested or multiple units are combined and then tested in the form

of a collection to expose defects and problems and verify that they all work together

as designed.

iii. Performance Testing: In this phase, testing is carried out to determine how

responsive and stable the system is, under a particular workload. It can also serve to

check the measure, validate or verify quality like scalability, reliability and resource

usage.

4.3.1 Tested Features

During the testing phase of the system, the following parts were focused on:

i. Admin login page and dashboard

ii. Logout button

iii. Base converter page

iv. Base calculator page

v. Complement calculator page

vi. Logic operations calculator page

vii. Feedback page

31
4.4 System Documentation

System documentation contains documents that describe the system itself and its parts. It

consists of requirement documents, design decisions, descriptions of architecture and

program source code. This gives an overall insight of the information about the main

structures of the program.

4.5 System Maintenance

After the implementation of the system, a means was provided for the maintenance of the

system by the administrator. The system will also be modified when the need arises for

updates to be carried out.

32
CHAPTER FIVE
SUMMARY, CONCLUSION AND RECOMMENDATIONS
5.1 Summary

The project “Numeral Base and Logic Operations System” aims at solving the limitations of

the online numeral systems that are limited to certain inputs and making it easier, faster and

more accurate for users to have access to.

Users can make use of these calculating environments freely. They can make conversions

among different number bases, they can perform arithmetic calculations among different

number bases. They can obtain the complement of numbers among some number systems,

generate truth tables of logical operators, as well as give feedback and suggestions about the

environments used.

5.2 Conclusion

The number system is a crucial component of computer technology, allowing computers to

do all tasks in a matter of seconds. As it is important in computer technology, it is also

paramount that people learn more about the different numeral systems there are, and how

they are used in representing quantities in our daily lives. Therefore, after the full

implementation of the system, it will replace manual way of computing numeral systems.

5.3 Recommendation

i. Further research should be carried out on this work in order to improve the system
ii. The system can be developed in such a way that users are able to download and install

it on their mobile phones for an easier access.

33
REFERENCES

Ahl, D. H. (2016). The architecture of Computer Hardware and System Software Co3.
Course Hero. University of Maryland, University College. https://www. coursehero.
com/file/12353698/the-architecture-of-computer-hardware-and-system-software-
c03

Awati, R. (2022). Hexadecimal. Tech Target. WhatIs.com. https://www. techtarget.com/


whatis/definition/hexadecimal

Awati, R. (2022). What is Binary?. Tech Target. WhatIs.com. https://www. techtarget.com/


whatis/definition/binary

Binary Number. (2023). In Wikipedia. https://en.wikipedia.org/wiki/Binary_number

Bit. (2023). In Wikipedia. https://en.wikipedia.org/wiki/Bit

Busbee, K. L., & Braunschweig, D. (2018). Logical Operators. Rebus Community. https://
press.rebus.community/programmingfundamentals/chapter/logical-operators

Carter, E. (2021). Truth Table Examples and Rules. Study.com. https://study.com/academy/


lesson/truth-table-definition-rules-examples.html

Critchlow C., & David J. (2017). Application – Logic Circuits. LibreTexts Engineering.
https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_and_Comp
utation_Fundamentals/Foundations_of_Computation_(Critchlow_and_Eck)/01%3A
_Logic_and_Proof/1.03%3A_Application_-_Logic_Circuits

Davis, Z. (2023). Complement of a Number. PC. https://www.pcmag.com

Digital Electronics/Number Base System. (2021). In Wikibooks. https://en.wikibooks.org/


wiki/Digital_Electronics/Number_Base_System

Geoffrey, R. & Tze-Ki, H. (2018). Teaching Number System. Oxford University Press.
p. 227. ISBN 978-0-19-976681-9.

34
Hacker, E., & Moore, S., & Patsco, L. (2022). I Ching: An Annotated Bibliography.
Routledge. p. 13. ISBN 978-0-415-93969-0.
Jafar, W. (2023). Octal Number System-Definition, Conversions, Example, FAQs. Splash
Learn. https://www.splashlearn.com/math-vocabulary/octal-number-system

Jain, S. (2022). Complement of a number with any base b. Geeksforgeeks. https://www.


geeksforgeeks.org/complement-of-a-number-with-any-base-b

Khurma, M. (2018). Octal Number System. Cuemath. https://www.cuemath.com/numbers


/octal-number-system

LaMeres, B. J. (2017). Number Systems. Research Gate. https://www.researchgate.Net/


publication/332322944_Number_Systems

LaMeres, B. J. (2019). Number Systems. Research Gate. https://www.researchgate.


net/publication/316176214_Number_Systems

Latif, S., & Ullah, R., & Jan, H. (n.d.). A Step towards an Easy Interconversion of Various
Number Systems. https://arxiv.org/ftp/arxiv/papers/1107/1107.1663.pdf

Method of Complements. (2023). In Wikipedia. https://en.wikipedia.org/wiki/


Method_of_complements

Muhammad, J., & Yuqing, L. (2018). Iterative Process for Generating ER Diagram from
Unrestricted Requirements. Sciterpress – Science and Technology Publications: 192-
204.

Numeral System. (2022). In Wikipedia. https://simple.wikipedia.org/wiki/Numeral_system

Ojumu, B. (2016). Base Two Arithmetic. Passnownow.com. https://passnownow.Com/


classwork-series-exercises-mathematics-base-two-arithmetic

Pandya, S. G. (2017). Why Do We Need Various Number Base Conversions (Number System
Conversions),E.G Octal To Hexadecimal?. ResearchGate. https://www.researchgate.
net/post/Why-do-we-need-various-number-base-conversions-number-system-
conversions-eg-octal-to-hexadecimal

35
Raveendran, J. (2022). Number System Conversion. BYJU’S. https://byjus.com/maths/
number-system-conversion

Saini, R., & Singh, H., & Munjal, G. (2023). Number Systems in Real Life Situations.
Unacademy.https://unacademy.com/content/cat/study-material/mathematics/
number-systems-in-real-life-situations

Sharma, G., & Ammlnabhavl, N. (2023). Number Base. Brilliant. https://brilliant.org/


wiki/number-base

Shectman, J. (2019). Groundbreaking Scientific Experiments, Inventions, and Discoveries


of the 18th Century. Greenwood Publishing. p. 29. ISBN 978-0-313-32015-6.
Sheldon, R. (2023). Decimal. Tech Target. https://www.techtarget.com/whatis/
definition/decimal

Shukla, A. (2023). Computer Number Systems and Its Types. Includehelp. https://www.
includehelp.com/computer-number-systems.aspx

Stapel, E. (2020). Number Bases: Octal and Hexadecimal. Purplemath. https://www.


purplemath.com/modules/numbbase3.htm

Stephen, C. (2020). Numerical Notation: A Comparative History. Cambridge University


Press, pp. 42–43. ISBN 9780521878180.
Storr, W. (2022). Binary Numbers and the Binary Number System. Electronics Tutorials.
https://www.electronics-tutorials.ws/binary/bin_1.html

Strom, R. P. (2017). How Mathematics Happened: The First 50,000 Years, Prometheus
Books. pp. 135–136. ISBN 9781615921768.
Truth Tables. (2023). In Wikepedia. https://en.wikipedia.org/wiki/Truth_table

36

You might also like