Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 48

INTERNATIONAL SCHOOL OF

MANAGEMENT AND TECHNOLOGY

FACULTY OF COMPUTING

ASSIGNMENT COVER SHEET


This form is to be completed by students submitting assignments of level 4 and level 5.
Students are required to complete all sections and attach to your assignment.

STUDENT DETAILS

STUDENT NAME

STUDENT ID

UNIT AND ASSIGNMENT DETAILS

UNIT TITLE Unit 1: Programming


H/618/7388
UNIT NUMBER

ASSIGNMENT Introduction to Algorithms and Programming with an IDE


TITLE

ISSUE DATE DUE DATE

ASSESSOR
NAME

ESTIMATED 6615
WORD LENGTH

SUBMISSION

HAND IN DATE
DECLERATION AND ACKNOWLEDGEMENT
When submitting assignments, each student must sign a declaration confirming
that the work is their own.

Plagiarism and Collusion


Plagiarism: to use or pass off as one’s own, the writings or ideas of another
without acknowledging or crediting the source from which the ideas are taken.

Collusion: submitting an assignment, project or report completed by another


person and passing it off as one’s.

In accordance with the Academic Integrity and Plagiarism Policy:

1. I declare that:
a) this assignment is entirely my own work, except where I have included fully-
documented references to the work of others,
b) the material contained in this assignment has not previously been submitted
for any other subject at the University or any other educational institution,
except as otherwise permitted,
c) no part of this assignment or product has been submitted by me in another
(previous or current) assessment, except where appropriately referenced, and
with prior permission from the Lecturer / Tutor / Unit Coordinator for this unit.

2. I acknowledge that:
a) if required to do so, I will provide an electronic copy of this assignment to the
assessor;
b) the assessor of this assignment may, for the purpose of assessing this
assignment:
I. reproduce this assignment and provide a copy to another member of
academic staff;
II. communicate a copy of this assignment to a plagiarism checking
service such as Plagiarism Check (which may then retain a copy of this
assignment on its database for the purpose of future plagiarism
checking).

I am aware of and understand that any breaches to the Academic Code of Conduct will
be investigated and sanctioned in accordance with the College Policy.

SIGNATURE DATE
PROGRAMMING

Table of Contents
LIST OF FIGURES...................................................................................................................................2
LIST OF SLIDES......................................................................................................................................3
EXECUTIVE SUMMARY.......................................................................................................................4
ACTIVITY 1..............................................................................................................................................5
PRESENTATION.....................................................................................................................................5
PROGRAMMING PARADIGMS...........................................................................................................5
EVENT DRIVEN PARADIGM...............................................................................................................7
CHARACTERISTICS OF EVENT DRIVEN PARADIGM..............................................................8
OBJECT-ORIENTED PARADIGM.......................................................................................................8
CHARACTERISTICS OF OBJECT-ORIENTED PROGRAMMING...........................................9
PROCEDURAL PROGRAMMING PARADIGM.................................................................................9
CHARACTERISTICS OF PROCEDURAL PROGRAMMING....................................................10
COMPARISON OF PROGRAMMING PARADIGMS.......................................................................10
BEST FITNESS FEE CALCULATOR USING PROGRAMMING PARADIGMS..........................11
CRITICAL EVALUATION OF SOURCE CODE IMPLEMENTATION.........................................12
ACTIVITY 2............................................................................................................................................15
INTRODUCTION...................................................................................................................................15
ALGORITHM.........................................................................................................................................15
ALGORITHM FOR BEST FITNESS PROGRAM..............................................................................16
OUTLINE OF THE STEPS REQUIRED TO BUILD THE APPLICATION....................................16
CONVERT ALGORITHM INTO WORKING PROGRAM...............................................................17
RELATIONSHIP BETWEEN ALGORITHM AND CODE...............................................................19
CHALLENGE OF ALGORITHM INTO PROGRAM CODE............................................................20
CODING STANDARD............................................................................................................................21
ERROR HANDLING..............................................................................................................................23
IDENTIFYING AND SOLVING LOGICAL ERRORS......................................................................23
DEBUGGING ANY ERRORS IN THE PROGRAM...........................................................................23
ACTIVITY 3............................................................................................................................................25
PRESENTATION...................................................................................................................................25

[Author] 1
PROGRAMMING

DEBUGGING..........................................................................................................................................27
PROCESS OF DEBUGGING.................................................................................................................28
DEBUGGING FEAUTURES AVAILABLE IN APACHE NETBEANS...........................................29
DEBUGGING FOR THE SECURE AND ROBUST APPLICATION...............................................30
CONCLUSION........................................................................................................................................31
ACTIVITY 4............................................................................................................................................32
INTRODUCTION...................................................................................................................................32
EVALUATION OF THE ALGORITHM IMPLEMENTATION IN JAVA.........................................32
ALGORITHM FOR BEST FITNESS CALCULATOR.......................................................................33
FLOWCHART........................................................................................................................................34
FINAL DESIGN OF BEST FITNESS FEE CALCULATOR...............................................................35
INVALID MESSAGE.............................................................................................................................36
EVALUATION OF THE RELATIONSHIP BETWEEN THE WRITTEN ALGORITHM AND
JAVA SOURCE CODE............................................................................................................................37
SOURCE CODE OF BESTFITNESS FEE CALCULATOR PROGRAM.........................................38
EVALUATION OF APACHE NETBEANS 17 IDE FOR JAVA DEVELOPMENT........................40
EVALUATION OF THE ROLE AND PURPOSE OF CODING STANDARDS IN JAVA
DEVELOPMENT....................................................................................................................................43
CONCLUSION........................................................................................................................................44
REFERENCES........................................................................................................................................45

LIST OF FIGURES
Figure 1 Logical error.................................................................................................................23
Figure 2 debugging error............................................................................................................24
Figure 3 flowchart........................................................................................................................34
Figure 4 design of best fitness calculator...................................................................................35
Figure 5 invalid message.............................................................................................................36
Figure 6 code................................................................................................................................39
Figure 7 code................................................................................................................................39
Figure 8 code................................................................................................................................40
Figure 9 Apache NetBeans..........................................................................................................41
Figure 10 error.............................................................................................................................41
Figure 11 java with maven..........................................................................................................42

[Author] 2
PROGRAMMING

LIST OF SLIDES

Slide 1 Title.....................................................................................................................................6
Slide 2 Programming Paradigms.................................................................................................7
Slide 3 Event Driven Paradigm....................................................................................................8
Slide 4 Object Oriented Programming........................................................................................9
Slide 5 Procedural Programming Paradigm.............................................................................10
Slide 6 comparison of programming paradigms.......................................................................11
Slide 7 Best Fitness Fee Calculator Using Programming Paradigms.....................................13
Slide 8 Critical evaluation of source code Implementation.....................................................13
Slide 9 Conclusion........................................................................................................................15
Slide 10 Debugging in best fitness..............................................................................................26
Slide 11 IDE chosen for this project...........................................................................................27
Slide 12 Debugging......................................................................................................................28
Slide 13 Process of Debugging....................................................................................................29
Slide 14 Debugging Feature Available in Apache NetBeans...................................................30
Slide 15 Debugging for the secure and robust application......................................................31
Slide 16 Conclusion......................................................................................................................32

[Author] 3
PROGRAMMING

EXECUTIVE SUMMARY
I was charged with designing a unique software solution for Best Fitness at Himalayan Digital
Solutions. This project's main purpose is to compute monthly training expenditures for clients
depending on many inputs such as their name, training plan, weight, sauna choice, and coaching
hours. The program will create an output that comprises the customer's name, a cost breakdown,
the overall training cost, and a weight comparison. The program will be structured to enable
more registrants in order to ensure future scalability. Furthermore, the program would enable
design freedom for the graphical user interface. In this paper, I will present an in-depth look at
the algorithms, design, and development processes. In addition, I will provide a presentation to
the development team.

[Author] 4
PROGRAMMING

ACTIVITY 1

PRESENTATION

Slide 1 Title

The first slide of our presentation titled "Exploring Programming Paradigms In Best Fitness
Application" In this captivating session, we will delve into three different programming
paradigms: Event Driven, Object Oriented, and Procedural. Our primary objective is to gain a
deep understanding of the unique qualities and features that define each paradigm, while also
exploring the connections between them. Through practical examples, we will demonstrate how
these paradigms are implemented in a specific application, offering valuable insights into their
real-world applicability. Prepare yourself for an enlightening expedition into the captivating
world of programming paradigms.

[Author] 5
PROGRAMMING

PROGRAMMING PARADIGMS

Slide 2 Programming Paradigms

According to cocca (2022) Programming paradigms can be likened to frameworks or guiding


principles that dictate how a program or programming language should be structured. Each
paradigm comes with its own set of regulations, features, and perspectives on how to approach
common programming problems.

The existence of multiple programming paradigms is similar to the wide range of programming
languages available. Just as different languages cater to specific needs and challenges, diverse
paradigms are designed to suit different types of projects. This enables developers to select the
most suitable paradigm that aligns with the specific requirements and nature of their
programming tasks. In essence, the availability of multiple paradigms provides developers with a
versatile toolkit of options to effectively address a wide array of programming problems (Cocca,
2022).

[Author] 6
PROGRAMMING

EVENT DRIVEN PARADIGM

Slide 3 Event Driven Paradigm

According to Rouse (2018) An event-driven software is designed to respond to user events or


similar inputs. Event-driven programming is an important idea in application development and
other programming disciplines. It has resulted in the creation of event handlers and other
associated resources.

Event-driven programming is based on the idea that a program is intended to respond to certain
sorts of input. User input can be created by a variety of user actions, such as clicking buttons,
selecting items from drop-down lists, entering text into forms, or participating in other
interactive activities. User events in other programming languages may be supplied via a
command-line interface or an other sort of user interface. Non-event-driven programming, on the
other hand, is distinguished by code that runs independently of user input.

Consider the inventory management systems used in retail establishments. These systems rely on
user activities such as barcode scanning, item selection from a list, and quantity entry. Each of
these actions causes particular events that are required for the software to work. Developers have
a greater grasp of the inventory management system's architecture and may guarantee that it
handles user interactions efficiently by identifying and studying its event-driven components.

[Author] 7
PROGRAMMING

This analysis aids in optimizing the system's responsiveness and effectiveness in serving the
demands of its users. (Rouse, 2018).

CHARACTERISTICS OF EVENT DRIVEN PARADIGM


 Based on the events and event handlers’ idea.
 Events triggered by human activities or system events are handled by programs.
 In graphical user interfaces (GUIs) and asynchronous systems.
 Event loops or callbacks are used to handle event flow and response.

OBJECT-ORIENTED PARADIGM

Slide 4 Object Oriented Programming

According to Doherty (2020) Object-Oriented Programming (OOP) is a popular programming


paradigm in computer science that is based on the core notions of classes and objects. Its major
purpose is to give a systematic approach to software development through the organization of
code into reusable blueprints known as classes. These classes are used to create specialized
instances of things.

The beauty of OOP is its portability across a wide range of popular programming languages,
including JavaScript, C++, Java, and Python. These languages accept and promote the object-

[Author] 8
PROGRAMMING

oriented paradigm, allowing developers to take use of its advantages. It is worth emphasizing,
however, that object-oriented programming languages are not limited to strictly adhering to the
object-oriented paradigm. Languages such as JavaScript, Python, and PHP allow you to blend
procedural and object-oriented programming methods. This implies that developers can use
procedural programming techniques in addition to the essential ideas of OOP.

Developers may arrange their code in a way that encourages reusability, modularity, and
encapsulation by embracing OOP. As a result, software solutions are more maintainable and
scalable, promoting efficient development techniques (Doherty, 2020).

CHARACTERISTICS OF OBJECT-ORIENTED PROGRAMMING


 Code is organized around objects that contain data and behavior.
 Inheritance, polymorphism, and encapsulation are all notions that are supported.
 Encourages code reuse, modularity, and maintainability.
 Real-world things and connections can be modeled.

PROCEDURAL PROGRAMMING PARADIGM

Slide 5 Procedural Programming Paradigm

[Author] 9
PROGRAMMING

According to Preston (2023) A procedural programming language is distinguished by the use of


functions and instructions to perform particular activities. Several programming languages, such
as BASIC, C, and Pascal, employ the procedural programming paradigm.

Learning to program in a procedural language is frequently seen as a critical stage in the


educational path of prospective developers. It is a basic learning experience, and many
experienced programmers begin their careers by learning a procedural programming language
(Preston, 2023).

CHARACTERISTICS OF PROCEDURAL PROGRAMMING


 The sequence of procedural steps used to address an issue.
 Modularization and breaking down tasks into procedures or functions are emphasized.
 Variables and data structures are used to store and modify data.
 Problem-solving is done from the top down.

COMPARISON OF PROGRAMMING PARADIGMS

Slide 6 comparison of programming paradigms

[Author] 10
PROGRAMMING

When we compare programming paradigms such as Procedural, Object-Oriented, and Event-


Driven, we can see how they differ in terms of code organization, data handling, reusability, and
problem-solving methodologies. Procedural programming is the process of breaking down a
program into sequential procedures that use global data that is available to all parts of the
program. Object-Oriented Programming, on the other hand, arranges code into reusable objects,
stressing modularity, encapsulation, and inheritance. Event-driven programming uses events to
trigger software responses, with event handlers used to provide interactive interfaces. These
paradigms are not mutually exclusive, and computer languages frequently enable a combination
of them. The paradigm(s) used are determined by project objectives, complexity, cooperation
requirements, and performance factors.

BEST FITNESS FEE CALCULATOR USING PROGRAMMING PARADIGMS

[Author] 11
PROGRAMMING

Slide 7 Best Fitness Fee Calculator Using Programming Paradigms

The Best Fitness Fee Calculator is a web-based solution that employs several programming
paradigms. It features a form for collecting user input, allowing users to submit essential
information. To verify input validity, the program makes use of a third-party package named
class-validator. Based on the user input, the app calculates the necessary fees using
predetermined logic. The computed fees are subsequently shown on the website, providing users
with an overview of their training expenses. To provide the needed functionality, the project is
developed in Java, employing object-oriented concepts and other programming paradigms.

CRITICAL EVALUATION OF SOURCE CODE IMPLEMENTATION

Slide 8 Critical evaluation of source code Implementation

Procedural Programming

When assessing the usage of procedural programming, consider its usefulness for scenarios
requiring basic calculations or uncomplicated computations. The code structure should be
examined to see if it follows a step-by-step strategy that divides the program into procedures or

[Author] 12
PROGRAMMING

functions. The goal should be to achieve simplicity and direct control over the program flow. In
this phase, it is critical to assess the code's readability and maintainability.

Object-Oriented Programming

When assessing the implementation of object-oriented programming (OOP), special


consideration should be paid to its ability to handle complicated calculations or complex
computations. The evaluation should look at how well the code arranges functionality into
reusable objects, taking advantage of encapsulation, inheritance, and polymorphism. Evaluating
the code's modularity, reusability, and extensibility will offer insight on the object-oriented
approach's competency.

Event-Driven Programming

It is crucial to evaluate scenarios involving user interactions or events produced by the user while
critically analyzing the implementation of event-driven programming. The evaluation should
focus on how well the code responds to certain events and user interaction. It is critical to
examine the use of event handlers or callbacks to guarantee effective handling of events that
occur concurrently. The capacity of the code to develop a user-centric application with a
responsive and interactive interface will give useful information.

[Author] 13
PROGRAMMING

Slide 9 Conclusion

[Author] 14
PROGRAMMING

ACTIVITY 2

INTRODUCTION
This report is a comprehensive overview of the process involved in designing and implementing
the algorithm for the Best Fitness program. The program is specifically developed to meet the
unique requirements of the client, incorporating appropriate algorithms to ensure its
functionality. The report will outline the necessary steps for algorithm design and discuss the
subsequent transformation of the algorithm into a fully functional application. It will also
examine the link between the algorithm and the program code, address any conversion issues,
and explain the coding standards used throughout source code development. The report begins
with a definition of the algorithm, which was generated using a design tool appropriate for the
project requirements. It then goes on to detail the procedures required for constructing the
application, taking into account the nature of the software solution and the selected coding
paradigm.

ALGORITHM
According to Rahul (2023) An algorithm is defined as a set of logical steps or instructions
designed to solve a given issue or accomplish a certain goal. In essence, it is a methodical
prescription for resolving a problem or achieving a desired goal. It is a set of precisely specified
procedures that a computer program may use to effectively achieve a given objective.
Algorithms are widespread in programming, with applications ranging from fundamental
computations and data sorting to sophisticated machine learning and artificial intelligence
systems. They are important in computer science because they provide an organized technique
for problem solving, allowing computers to do tasks with efficiency and precision.

While creating algorithms, programmers adhere to established principles and criteria to ensure
their efficiency, correctness, and efficacy. These suggestions include breaking complicated
problems down into manageable subproblems, using iterative or recursive approaches, and
optimizing the algorithm for speed and memory use.

[Author] 15
PROGRAMMING

Several essential elements must be considered by programmers throughout the algorithm


creation process, including input and output requirements, efficiency concerns, scalability
(Rahul, 2023).

ALGORITHM FOR BEST FITNESS PROGRAM


 Begin the program.
 To store athlete information, create an empty list.
 Display a welcome message and inquire how many athletes the user wishes to register.
 For each athlete, repeat the following steps:
 Make a new athlete object.
 Instruct the user to enter and save the customer's name.
 Show the user the different training plan alternatives and ask them to choose one.
 Read and save the chosen workout plan.
 Instruct the user to input and save their current weight in kilos.
 Show the goal weight category alternatives and ask the user to choose one.
 Read and save the goal weight category that was chosen.
 Ask the user (yes/no) whether they wish to add the sauna option and save their choice.
 Instruct the user to input and save the number of hours of private coaching.
 Determine the monthly training fees based on the information entered.
 Determine the comparison result by comparing the present weight to the goal weight
category.
 Display the athlete's name, monthly cost breakdown, total cost of training, and weight
comparison.
 Display a list of all enrolled athletes, along with names and monthly training expenses.
 Finish the program

OUTLINE OF THE STEPS REQUIRED TO BUILD THE APPLICATION


 Create a data structure that can contain athlete information, with fields for the customer's
name, training plan, current weight, target weight category, sauna choice, swimming
option, and private coaching hours.
 Present the user with a menu displaying options for adding a new athlete, managing
athlete data, calculating costs, and comparing weights.

[Author] 16
PROGRAMMING

 Request that the user choose an option from the menu.


 Request that the user enter athlete information such as the customer's name, training plan
of choice, current weight, ideal weight category, sauna preference, and private coaching
hours.
 Validate the input provided by the user and add the athlete to the data structure if the
input is valid.
 Offer options to search, edit, or delete athlete information.
 Prompt the user to enter the athlete's name to perform the desired action.
 Update the athlete's data in the data structure according to the chosen action.
 Iterate over the athlete data structure to compute each athlete's training expenditures,
taking into account their training plan, sauna option, and private coaching hours.
 Calculate the overall cost for each athlete and offer a detailed breakdown of monthly
costs.
 Navigate the athlete data structure and compare each athlete's current weight to their ideal
weight category.
 Display a comparison that displays if the athlete's weight is more than, less than, or equal
to the goal weight category.
 Incorporate proper error handling techniques to deal with erroneous user inputs or
unusual situations.
 Display error messages that guide the user in correcting their inputs.
 Prepare a presentation for the development team that highlights different programming
paradigms (procedural, object-oriented, functional) along with their advantages and use
cases.
 Introduce debugging tools used during the program development, such as integrated
development environments (IDEs) with built-in debuggers, logging frameworks, or unit
testing frameworks.

CONVERT ALGORITHM INTO WORKING PROGRAM


Understand the Algorithm: Learn about the algorithm's logic, inputs, outputs, and any special
needs or limitations.

[Author] 17
PROGRAMMING

Outline the Program Structure: Define the general architecture of the program, including the
classes, methods, and data structures necessary to properly implement the algorithm.

pick an Appropriate Programming Language: To pick an appropriate programming language,


such as Java, consider the project needs and the team's ability. Java is an excellent choice since it
has object-oriented features, a powerful type system, and a large standard library.

Create a Class Hierarchy: Create the necessary classes and define their properties and functions.
Determine the relationships between classes and, where needed, construct inheritance and
composition links.

Transform the algorithm's logical stages into code that can be performed using the programming
language of choice. Divide the algorithm into smaller jobs and implement each step using
appropriate control structures such as loops and conditionals, as well as Java's various operations
and features.

Verify and debug: Validate the program by providing alternative inputs and checking that the
outputs match the expected results. To find and address any flaws or glitches in the code, use the
debugging facilities supplied by the chosen IDE, such as Apache NetBeans 17.

Manage User Input: Create a user interface or input mechanism that allows users to enter
information such as client details, training programs, weights, and other pertinent data. Validate
user input and manage any problems by presenting relevant notifications and asking proper
input.

Generate output: Create an output mechanism to display the results of the algorithm's execution.
Present the customer's name, monthly costs, total training expenses, and a weight comparison
between their present and target weight.

Refine and optimize: Look for possible inefficiencies or opportunities for improvement in the
code. While following to coding standards and best practices, refactor the code to improve
readability, modularity, and performance.

Record the Program: Provide detailed documentation, including inline comments inside the code,
to describe the code's purpose, functionality, and critical implementation details. Create external

[Author] 18
PROGRAMMING

documentation, such as user manuals or development documentation, to help users understand


and efficiently utilize the application.

Conduct comprehensive code evaluations and get input from team members to find areas for
enhancement or improvement. Iterate on the application as needed to resolve any reported flaws
or add new features.

RELATIONSHIP BETWEEN ALGORITHM AND CODE


The link between algorithms and code is often debated among programmers, emphasizing its
importance. Algorithms are a conceptual plan or blueprint for completing tasks, whereas code is
the real execution of such algorithms in a specific programming language.

Algorithms are ordered sequences of instructions that define the procedures required to solve a
problem or achieve a certain objective. They are made up of well-defined procedures that alter
data and produce the intended results. Code, on the other hand, is used to convert these
instructions into a format that computers can understand.

When programmers write code, they essentially translate the instructions of an algorithm into a
programming language. Code acts as the intermediary between the abstract nature of algorithms
and their concrete execution on a computer. It takes the logical structure and instructions
outlined by the algorithm and converts them into a format that the computer can comprehend and
execute.

In many scenarios, a single program incorporates multiple algorithms that work together to
achieve a common objective. These algorithms can be implemented as separate functions or
modules within the codebase. Each algorithm tackles specific sub-tasks or addresses particular
aspects of the overall problem. The code integrates these algorithms, managing their execution
and combining their outputs to generate the desired end result.

The code plays a crucial role in coordinating and facilitating the collaboration of individual
algorithms. It harmonizes their efforts and ensures they work together seamlessly. By providing
instructions, control structures, and operations for manipulating data, the code guarantees that the
algorithms are executed in a synchronized and coherent manner (Singh, 2020).

[Author] 19
PROGRAMMING

To construct the Best Fitness application, the algorithm and code must work together to collect
user input, do essential calculations, and report results. To utilize the app, users must provide
personal information such as their name, preferred training plan, current weight, target weight
category, sauna choice, and hours of personalized coaching. Once input, the program will
compute the cost of training depending on the chosen plan and any extra choices. It will also
make a recommendation after comparing the present weight to the target weight category. The
output will include the user's name, a cost breakdown, the overall training cost, and a remark
indicating the weight comparison result. The algorithm may be methodically built and converted
into code by carefully examining these criteria, guaranteeing the Best Fitness program operates
as intended.

CHALLENGE OF ALGORITHM INTO PROGRAM CODE


Algorithms are important not just during the creation process, but also in development
environments such as IDEs and editors, as well as other intelligent software tools that provide
feedback and help. Algorithms are frequently used in these contexts to provide various search
functionality inside a codebase. The ability to discover algorithms within code is extremely
useful for sophisticated code analysis tasks such as code clone detection, refactoring, function
prediction, debugging, code evaluation, and software metrics. These features make use of
algorithm knowledge to give developers with better skills and insights while dealing with code
(Yutaka Watanobe, 2022).

It is critical to consider different elements while designing the Best Fitness program to ensure a
proper translation of the algorithm into program code. To begin, it is critical to pick appropriate
data types for processing inputs such as customer names, weights, training plans, target weight
categories, sauna options, and individual coaching hours. This allows for accurate information
storage and manipulation.

To provide accurate and authentic data, user input must be validated. This entails implementing
validation tests, such as confirming weight within acceptable limits and evaluating selected
selections against accessible possibilities.

[Author] 20
PROGRAMMING

Conditional statements and loops are critical control constructs for managing a variety of
circumstances based on user input. For example, the software must account for sauna alternatives
and related prices, as well as iterate over numerous athletes to gather information.

Currency formatting is required to show expenses precisely, which is often accomplished by


formatting methods or libraries provided by the computer language of choice.

To address faulty inputs and handle unforeseen problems, error handling techniques should be
provided. Informative error messages assist users in resolving problems that arise during
software operation.

Modularity, readability, and maintainability are improved by organizing the code into functions
or methods. Variable and function names that are meaningful help with code comprehension.

It is critical to consider language-specific features, restrictions, and available tools. The


development process may be simplified by exploiting these elements and selecting relevant
libraries or frameworks.

The method may be effectively converted into program code for the Best Fitness application by
attentively addressing these factors and following to the programming language's needs and
limits.

CODING STANDARD
There is no single "right" way to write Java code. However, in order to generate high-quality and
maintainable code, Java developers must adhere to best practices and industry standards. These
best practices cover a variety of topics, including using descriptive and meaningful variable
names, using comments to explain code, and aiming for clarity and conciseness in code
authoring. Following these criteria improves code readability and maintainability. Following
recommended practices also assures interoperability with other libraries and systems
(Choudhary, 2022).

Using Naming Standards

Naming conventions are important in coding and should be carefully studied before beginning
the coding process. They entail naming variables, constants, methods, classes, interfaces, and

[Author] 21
PROGRAMMING

other identifiers inside the codebase. The names used should be self-explanatory, distinct, and
easy to understand. Rather than focusing simply on passing the compiler's criteria, the major
objective is to design code that is readily understood by people. This method is widely adopted
by a large number of Java developers as a common coding practice. (Choudhary, 2022).

Class Members in Scope Order

It is critical to organize member variables within a class depending on their access modifiers in
order to maintain a coding standard in Java. This method requires grouping variables based on
their visibility, which includes private, default (package), protected, and public. For clarity and
structure, a blank line should be placed between each group. This coding method guarantees that
the class members have a clear and structured structure (Choudhary, 2022).

Class Members Should Be Private

It is recommended in Java programming to use the least restrictive access modifier feasible to
limit the accessibility of class members. To promote the principle of encapsulation in software
development, it is advised to keep class members private. Encapsulation is the process of hiding
a class's underlying implementation details and exposing just relevant functionality via well-
defined interfaces. By making class members private, their access is limited to within the class,
avoiding direct modification from outside sources. This method improves data security,
minimizes the risk of unintentional changes resulting in mistakes, and promotes the creation of
modular and maintainable code. Finally, encapsulation guarantees that a class's internal state and
behavior are managed and accessible in a consistent and controlled way (Choudhary, 2022).

Using Underscores in Numeric Literals

To improve code readability, underscores are suggested in numeric literals in Java. When
underscores are used in numeric numbers, the code becomes more intelligible than when they are
not used. With subsequent revisions, this method has gained acceptance and has become a norm
in Java (Choudhary, 2022).

Avoid Redundant Initialization (0-false-null)

It is generally suggested in Java for developers to avoid explicitly initializing member variables
with default values such as null, false, or 0. This is due to the fact that Java provides default

[Author] 22
PROGRAMMING

values to member variables based on their data type. As a result, there is no need to give these
default values to member variables again (Choudhary, 2022).

ERROR HANDLING
Error management is a vital component in the development of a robust software system. By
employing robust error handling procedures, you improve your system's availability and
predictability while protecting it from being inconsistent (Das, 2023).

IDENTIFYING AND SOLVING LOGICAL ERRORS


Logic mistakes in programming are faults that cause a program to behave erroneously or produce
unexpected results. Unlike syntax problems, logic errors do not cause the program to fail or
provide obvious error signals that an integrated development environment (IDE) may quickly
identify. Detecting and correcting logic errors can be difficult since they need rigorous study and
debugging to isolate the underlying problem and modify the program's behavior (issac computer
science, 2023).

Figure 1 Logical error

DEBUGGING ANY ERRORS IN THE PROGRAM

[Author] 23
PROGRAMMING

Figure 2 debugging error

[Author] 24
PROGRAMMING

ACTIVITY 3

PRESENTATION

Slide 10 Debugging in best fitness

The goal of this presentation is to provide useful insights into the debugging method used in the
creation of the Best Fitness application. Our goal in sharing our experiences and the strategies we
used is to highlight the critical role that debugging plays in the whole software development
lifecycle.

[Author] 25
PROGRAMMING

Slide 11 IDE chosen for this project

According to Red Hat(2023) Using an Integrated Development Environment (IDE) speeds up the
start of application development by simplifying the configuration and integration of several
tools. It eliminates the need for developers to individually learn and use numerous tools by
incorporating all necessary capabilities into a single workspace. This feature is very useful for
integrating new engineers into a team since it allows them to become acquainted with the team's
existing tools and practices via the IDE. The major goal of IDEs is to maximize time utilization,
as seen by features like as intelligent code completion and automated code creation, which avoid
the time-consuming chore of manually inputting lengthy character sequences (Red Hat, 2023).

[Author] 26
PROGRAMMING

DEBUGGING

Slide 12 Debugging

According to Lombardi(2022) Debugging is an important procedure for software development


and engineering teams since it allows them to find and fix faults, resulting in working computer
programs. To assure the delivery of effective goods to clients, teams must improve the efficiency
of the debugging process. Individuals may learn the most efficient ways to optimize their
programming efforts by delving more into this issue.

Software developers and engineers frequently use digital tools to debug programs, allowing them
to inspect and modify the code that includes instructions for program execution. Debugging
allows them to focus on individual areas of the code to ensure that each element works as
intended and efficiently as possible (Lombardi, 2022).

[Author] 27
PROGRAMMING

PROCESS OF DEBUGGING

Slide 13 Process of Debugging

According to Agarwal(2020) Debugging is the process of locating and resolving faults or flaws
in an application or program. This procedure must be completed prior to the release of software
products to assure their dependability and effectiveness (Agarwal, 2020).

The following stages explain the debugging process:

Error identification: Detecting mistakes early on saves time and prevents problems from
emerging at the user's end, reducing errors and time waste.

Identification of error location: It is critical to locate the specific position of the mistake in
order to promote faster bug fixes and code execution.

Analyze error: Understanding the nature of the error and reducing the total amount of errors are
two benefits of error analysis. However, resolving one problem may result in the appearance of
more flaws, possibly halting the application process.

[Author] 28
PROGRAMMING

Prove the analysis : It is critical to validate the analysis after studying the mistake. This may be
accomplished through the use of a test automation process and the creation of test cases utilizing
a test framework.

Cover Lateral Damage: Bugs can be handled by making suitable adjustments, allowing
advancement to the next step of the code or program to address further mistakes (Agarwal,
2020).

DEBUGGING FEAUTURES AVAILABLE IN APACHE NETBEANS

Slide 14 Debugging Feature Available in Apache NetBeans

Apache NetBeans has a number of debugging options to help developers detect and resolve code
bugs. Developers may strategically place breakpoints in their code at specific lines or situations,
allowing them to halt program execution and check variable values. They may then use
debugging commands like as Step Into, Step Over, and Step Out to sequentially travel through
their code, executing lines, calling methods or functions, and returning to the appropriate caller.
Developers can acquire useful insights into program state changes and uncover possible errors by

[Author] 29
PROGRAMMING

analyzing variable values during runtime. NetBeans also has a watch method, which allows
developers to monitor certain variables or expressions of interest when debugging. The call stack
feature shows the sequence of method or function calls, which helps to comprehend program
flow and context. NetBeans also offers a debug console for interactive code execution, allowing
for easy testing and troubleshooting.

DEBUGGING FOR THE SECURE AND ROBUST APPLICATION

Slide 15 Debugging for the secure and robust application

Debugging is critical for ensuring an application's security and resiliency. Developers should
emphasize the installation of fast error handling, diligent input validation, security testing,
extensive logging and monitoring, secure configuration, frequent patch management, and
rigorous code review to improve security and resilience via debugging. By following these rules,
developers may strengthen application security, discover and fix vulnerabilities, and assure the
application's overall resilience.

[Author] 30
PROGRAMMING

CONCLUSION

Slide 16 Conclusion

[Author] 31
PROGRAMMING

ACTIVITY 4

INTRODUCTION
The goal of this Report is to reflect on the process that took place throughout the creation of the
Best Fitness project, with a particular emphasis on the trip from algorithm design to
implementation. In addition, this study will assess the link between the described algorithm and
the actual source code, investigate the usage of the Apache NetBeans IDE for development, and
underline the necessity of conforming to HDS coding standards.

EVALUATION OF THE ALGORITHM IMPLEMENTATION IN JAVA


The implementation of the Best Fitness application algorithm in Java proves the language's
capability for developing a robust and efficient solution. Java's object-oriented features aided in
the creation of modular and reusable code, resulting in well-organized and readily maintainable
code.

The algorithm's logical phases, as established during the design process, were successfully
transformed into Java code. Handling user input, which includes acquiring information such as
age, height, and weight, was one such phase. Java's built-in input/output features, such as the
Scanner class, were critical in properly acquiring and validating user inputs.

Furthermore, the system required computations to determine the expenses associated with
various exercise regimens while taking user preferences into consideration. Java's broad standard
library included a large array of mathematical functions and operators, allowing for precise and
efficient computations. Arithmetic operations such as addition, subtraction, multiplication, and
division, for example, are smoothly integrated into the code, allowing for precise cost estimation
while supporting any available discounts or promotions.

the program needed to compare weight categories in order to provide tailored workout
suggestions. The ability of Java to compare data and perform conditional statements like if-else
or switch-case aided in the logical implementation of weight category comparisons. As a
consequence, the program categorized users based on their weight and provided appropriate
workout suggestions.

[Author] 32
PROGRAMMING

ALGORITHM FOR BEST FITNESS CALCULATOR


Step1:Begin the program.

Step2:To store athlete information, create an empty list.

Step3:Display a welcome message and inquire how many athletes the user wishes to register.

Step4:For each athlete, repeat the following steps:

a) Make a new athlete object.


b) Instruct the user to enter and save the customer's name.
c) Show the user the different training plan alternatives and ask them to choose one.
d) Read and save the chosen workout plan.
e) Instruct the user to input and save their current weight in kilos.
f) Show the goal weight category alternatives and ask the user to choose one.
g) Read and save the goal weight category that was chosen.
h) Ask the user (yes/no) whether they wish to add the sauna option and save their choice.
i) Instruct the user to input and save the number of hours of private coaching.
j) Determine the monthly training fees based on the information entered.
k) Determine the comparison result by comparing the present weight to the goal weight
category.
l) Display the athlete's name, monthly cost breakdown, total cost of training, and weight
comparison.
Steps5: Display a list of all enrolled athletes, along with names and monthly training expenses.

Steps6: Finish the program.

[Author] 33
PROGRAMMING

FLOWCHART

Figure 3 flowchart

According to MUKHERJEE(2021) Flowcharts are visual representations of data or algorithms


that improve code understanding by depicting problem-solving methodologies, procedures, or
processes step by step. These graphical representations depict a step-by-step process, assisting
inexperienced programmers in understanding computer science algorithms and enabling
debugging. Flowcharts efficiently portray the sequential flow of a process by using boxes to
represent processes. Drawing a flowchart follows internationally established guidelines that
professionals from all around the world follow (MUKHERJEE, 2021).

[Author] 34
PROGRAMMING

FINAL DESIGN OF BEST FITNESS FEE CALCULATOR

Figure 4 design of best fitness calculator

[Author] 35
PROGRAMMING

INVALID MESSAGE

Figure 5 invalid message

[Author] 36
PROGRAMMING

Java's strong type system and exception handling techniques assist its powerful error
management and input validation features. Java's stringent data type checking ensures consistent
and predictable variable and expression usage, lowering the risk of type-related mistakes
throughout program execution.

The exception handling system in Java allows developers to properly discover and manage
exceptional circumstances or runtime faults. This enables the elegant handling of unforeseen
events, reducing the likelihood of program crashes. Java programs can deliver helpful error
messages to users by capturing and managing exceptions, assisting them in addressing input
problems and avoiding potential system failures.

Furthermore, Java's support for a variety of data structures like as arrays, lists, and maps, in
conjunction with control flow instructions such as loops and conditionals, facilitates the effective
layout and manipulation of data inside the program. These features enable developers to loop
over data, apply conditions, and carry out actions suited to specific requirements. This
adaptability ensures exact processing of input information and allows for the creation of complex
logic and algorithms.

EVALUATION OF THE RELATIONSHIP BETWEEN THE WRITTEN ALGORITHM


AND JAVA SOURCE CODE
It is critical to check that the code effectively turns the logical stages indicated in the algorithm
into executable instructions when evaluating the relationship between the algorithm and the Java
source code. This includes assessing how effectively the code handles input, validation,
computation, and output in accordance with the algorithm's parameters.

To ensure the program's integrity, the code should correctly record and manage user inputs,
ensuring that entered data is verified and checked for mistakes. This involves validating data
type correctness, making necessary conversions, and delivering suitable error messages to assist
users in correcting any input errors.

Additionally, it is crucial that the code performs precise calculations to determine the monthly
training fees. This requires taking into account various factors such as the chosen training plan,

[Author] 37
PROGRAMMING

the inclusion of sauna or swimming options, and the number of hours dedicated to private
coaching. These estimates should be exact, accounting for any additional costs or savings
connected with certain options.

The output should match the predicted outcomes provided in the procedure. It should include the
customer's name, a breakdown of monthly costs, the overall cost of training, and a comparison of
current weight and desired weight category. The result should be formatted and presented in a
clear and user-friendly manner.

In addition to functionality, the Java source code should adhere to best practices and coding
conventions to guarantee readability, maintainability, and scalability. This includes following
naming conventions, arranging code into suitable functions or classes, integrating useful
comments, and structuring the code in a modular and reusable manner.

Throughout the assessment process, any discrepancies or difficulties identified while translating
the algorithm into code should be properly recorded. This documentation serves as a basis for
finding and addressing defects, logical flaws, or performance difficulties, allowing the code to be
refined and optimized for effective program execution.

We ensure that the final program accurately reflects the intended functionality, meets the
requirements of Best Fitness, and provides a seamless user experience by carefully evaluating the
relationship between the algorithm and the Java source code and addressing any identified issues.

SOURCE CODE OF BESTFITNESS FEE CALCULATOR PROGRAM

[Author] 38
PROGRAMMING

Figure 6 code

Figure 7 code

[Author] 39
PROGRAMMING

Figure 8 code

EVALUATION OF APACHE NETBEANS 17 IDE FOR JAVA DEVELOPMENT


The Apache NetBeans 17 IDE is a powerful and feature-rich development environment for Java
programming. It is an excellent solution for Java developers of any ability level because to its
easy interface, robust code editing features, complete project management tools, and large
selection of plugins.

[Author] 40
PROGRAMMING

Figure 9 Apache NetBeans

The IDE includes extensive code editing features including syntax highlighting, code
completion, and code templates. It offers code refactoring, allowing developers to rearrange and
improve their code more effectively. Furthermore, productivity features like as intelligent code
recommendations and keyboard shortcuts are accessible to help with the coding process.

Figure 10 error

[Author] 41
PROGRAMMING

Figure 11 java with maven

The Apache NetBeans 17 IDE excels in integration by supporting common build technologies
like as Maven and Gradle. This allows for more effective project dependency management and
streamlines the construction process. Furthermore, the IDE has a varied set of plugins that allow
developers to extend its capabilities and combine it with various frameworks and technologies.

[Author] 42
PROGRAMMING

The IDE includes strong debugging tools such as breakpoints, step-through debugging, and
variable examination. It also contains tools for running unit tests and evaluating code coverage,
which helps to ensure high-quality and dependable code.

EVALUATION OF THE ROLE AND PURPOSE OF CODING STANDARDS IN JAVA


DEVELOPMENT
Using coding standards, notably Java coding standards such as Oracle's Java Code Conventions,
was critical in developing a high-quality and stable codebase for the Best Fitness program in
Java.

Code consistency was accomplished by following consistent indentation, formatting, and naming
rules across the source. This uniformity aided developers in understanding and navigating the
code, resulting in a unified and coherent program.

By using clear and meaningful names for variables, methods, and classes, the purpose and
functionality of different code components became readily apparent; additionally, comprehensive
comments and documentation provided insights into the intentions behind specific code sections,
facilitating long-term maintenance and enhancement of the application.

[Author] 43
PROGRAMMING

Code maintainability was also improved by adhering to coding standards. Consistent formatting
and naming conventions facilitated issue discovery and resolution, reducing the introduction of
mistakes during code updates. Appropriate code organization tactics, such as modularizing code
into logical modules or classes, helped the Best Fitness application's continuing support and
enhancement. Furthermore, new engineers might rapidly become acquainted with the codebase,
facilitating easier onboarding and communication within the development team.

Furthermore, following coding standards improved code quality and dependability. The team
reduced the possibilities of introducing errors or inconsistencies into the codebase by using a
consistent coding style and adopting industry best practices. As a consequence, the Best Fitness
application is more stable and trustworthy.

using coding standards in the creation of the Best Fitness Java program achieved code
uniformity, readability, maintainability, and overall code quality. Following Java coding
standards, such as those specified in Oracle's Java Code Conventions, aided in the development
of a dependable and resilient codebase that was simple to comprehend, maintain, and improve.

CONCLUSION
The Best Fitness program in Java was a success because it smoothly blended algorithm design
with efficient implementation. The object-oriented structure of Java, as well as its robust type
system and vast standard library, were important reasons in its selection for the project. The team
worked hard to adapt the described algorithm into Java source code, ensuring that the logical
phases flowed smoothly. Throughout the development process, sticking to Java's syntax, norms,
and features resulted in highly legible, manageable, and collaborative code. The utilization of the
Apache NetBeans 17 integrated development environment (IDE) enables developers to boost
productivity and efficiency by leveraging the specialized functionalities of Java. These
encompass code completion, syntax highlighting, and debugging tools, all of which significantly
contribute to a more streamlined and efficient development workflow. The team's continuous
dedication to coding standards was critical in creating uniform code formatting, naming
conventions, and documentation, which improved code understanding and maintainability
dramatically. The team successfully created a practical and dependable software solution for
Best Fitness by using appropriate tools, following to coding standards, and employing an

[Author] 44
PROGRAMMING

efficient IDE. This entire achievement demonstrated the team's skill and professionalism,
highlighting Himalayan Digital Solutions' commitment to providing excellence in software
development.

REFERENCES
Agarwal, (2020). Debugging Process. What is Debugging : Types & Techniques in Embedded
Systems, 1(1), p. 4.

Choudhary, B., (2022). The List of the Java Coding Best Practices. Top 5 Java Coding Standards
And Best Practices In 2022, 1(1), pp. 3-5.

Cocca, G., (2022). What is a Programming Paradigm?. Programming Paradigms – Paradigm


Examples for Beginners, 1(1), p. 4.

Das, A., (2023). Error Handling in Event-Driven Systems. Error Handling in Event-Driven
Systems, 1(1), p. 2.

Doherty, E., (2020). What is object-oriented programming? OOP explained in depth. What is
object-oriented programming? OOP explained in depth, 1(1), p. 2.

issac computer science, (2023). issac computer science. [Online]


Available at: https://isaaccomputerscience.org/concepts/prog_softeng_debug?
examBoard=all&stage=all
[Accessed 14 june (2023)].

Lombardi, P., (2022). What is debugging?. What Is Debugging? (Plus 8 Important Strategies To
Try), 1(1), p. 3.

MUKHERJEE, P., (2021). What is a Flowchart and its Types?. What is a Flowchart and its
Types?, 1(1), p. 1.

Preston, R., (2023). What is a procedural programming language?. What Is a Procedural


Programming Language, 1(1), p. 2.

Rahul, (2023). What is an algorithm in programming? What are different types of algorithms in
programming?. What is an algorithm in programming? What are different types of algorithms in
programming?, 1(1), p. 2.

Red Hat, (2023). Rdhat. [Online]


Available at: https://www.redhat.com/en/topics/middleware/what-is-ide
[Accessed 13 june 2023].

Rouse, M., (2018). What Does Event-Driven Program Mean?. Event-Driven Program, 1(1), p. 2.

[Author] 45
PROGRAMMING

Singh, G., (2020). Difference Between Algorithm and Code. Difference Between Algorithm and
Code, 1(1), p. 5.

Yutaka Watanobe, M. M. R. M. F. I. A. &. R. K., (2022). Identifying algorithm in program code


based on structural features using CNN classification mode. Identifying algorithm in program
code based on structural features using CNN classification mode, 1(1), p. 3.

[Author] 46

You might also like