


































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



































































SANJIL SHAKYA (HND FOURTH SEM ESTER) 0
Task 1 Discuss the principles, characteristics and features of programming in Java. [1.1, M1] Introduction Java is a computer programming language. It enables programmers to write computer instructions using English based commands, instead of having to write in numeric codes. From mobile phones to handheld devices, games and navigation systems to e-business solutions, Java is everywhere (Oracle.com, 2014). Once a program has been written, the high-level instructions are translated into numeric codes that computers can understand and execute. Java is a simple and yet powerful object-oriented programming language and it is in many respects similar to C++. Java originated at Sun Microsystems, Inc. in 1991. It was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan at Sun Microsystems, Inc. It was developed to provide a platform-independent programming language. Java was designed with a concept of ‘write once and run everywhere’. It is a software that is implemented on top of real hardware and operating system. When the source code (.java files) is compiled, it is translated into byte codes and then placed into (.class) files. The JVM executes these bytecodes. So, Java byte codes can be thought of as the machine language of the JVM. Principles of Java The four principles of programming in JAVA are inheritance, polymorphism and encapsulation. All the concepts of JAVA are based on classes and its objects. An object is a real-world entity that has some attributes or properties.
1. Inheritance One of the most important concepts in object-oriented programming is that of inheritance. It allows us to define a class in terms of another class, which makes it easier to create and maintain an application. This also provides an opportunity to reuse the code functionality and fast implementation time. When creating a class, instead of writing completely new data members and member functions, the programmer can designate that the new class should inherit the members of an existing class. This existing class is called the base class, and the new class is referred to as the derived class (Tutorialspoint.com, 2015).
with a small number of language constructs so that programmers could learn it quickly. It eliminates several language features available in C/C++ that are associated with poor programming practices or rarely used: go to statements, header files, structures, operator overloading, multiple inheritance and pointers.
2. Object-oriented Java is an object-oriented language, which means that we focus on the data in our application and methods that manipulate that data, rather than thinking strictly in terms of procedures. In an object-oriented system, a class is a collection of data and methods that operate on that data. Taken together, the data and methods describe the state and behavior of an object. Classes are arranged in a hierarchy, so that a subclass can inherit behavior from its superclass. Java comes with an extensive set of classes, arranged in packages that we can use in our programs (Web.cs.wpi.edu, 2015). 3. Secure Java is secure and never uses memory pointers. All applications in Java are run under the sand box. Security administrator establishes the accessibility alternatives of a class such as reading and writing a file to the local disk. Java utilizes the public key encryption process to enable the Java programs to transfer over the web in a protected and encrypted form. Java program does not harm other system thus making it secure. It provides a secure means of creating Internet applications and provides secure way to access web applications. The security is based on the premise that nothing should be trusted. 4. Portable The Java programs can be executed in any environment for which there is a Java run-time system (JVM). It can be run on any platform such as Linux, Windows or Mac. And it also can be transferred over the world wide web. It ensures that other implementation-dependent aspects of language specification are eliminated. For example; Java specifies the sizes of primitive data types and their arithmetic behavior (Borysowich, 2015). 5. Robust Robust refers to reliability. Java encourages error-free programming by being strictly typed and performing run-time checks. Java puts a lot of emphasis on early checking for possible errors, because Java compilers can detect many problems that would first show up at the
execution time in other languages. Java has eliminated certain types of error-prone programming constructs found in other languages. It does not support pointers, for example, thereby eliminating the possibility of overwriting memory and corrupting data. Java has a runtime exception-handling feature to provide programming support for robustness. Java forces the programmer to write the code to deal with exceptions. Java can catch and respond to an exceptional situation so that the program can continue its normal execution and terminate gracefully when a runtime error occurs.
6. Dynamic Java is a dynamic language. It is capable of linking dynamic new classes, methods and objects. It supports functions written in C and C++ also. These functions are called native methods. During Run-Time Native, methods can be linked dynamically. Java programs carry with them substantial amounts of run-time type information that is used to verify and resolve accesses to objects at run time. 7. High performance Java programs provides the high performance. The bytecodes are highly optimized and JVM can be executed much faster. The software programs designed in Java are well performed and are highly overrated. Conclusion Java is a powerful language with the strong features like security, dynamics, robust, etc. Java is an OOP language considering the OOP principles like encapsulation, inheritance, polymorphism and data abstraction. It is one of the most secured and popular programming languages that develops the application for the platforms of both web-based and desktop- based. In this task, I have discussed the principles, characteristics and features of programming in Java. For this task to be completed, I have used various resources and gathered various information regarding Java and the programming language that has been cited in this task.
According to Programmerinterview.com (2015) , “There are 8 primitive data types such as byte, short, int, long, double, char and Boolean. Primitive data are only single values; they have no special capabilities. These types server as the building blocks of data manipulation in Java. Such types serve only one purpose of containing pure and simple values of a kind. Because these data types are defined into the Java type system by default, they come with a number of operations predefined. We cannot define a new operation for such primitive types.” An object is a large chunk of memory that can potentially contain a great deal of data along with methods (little programs) to process that data. There are thousands of object classes that come standard with Java, and a programmer can easily create additional classes. Non-Virtual methods In Java, all the methods are the virtual methods. That means, the most derived method is always called. Non-virtual methods are resolved statically i.e. the member function is selected statically based on the type of the pointer to the object. In contrast, virtual methods are resolved dynamically i.e. the member function is selected dynamically based on the type of the object., not the type of the pointer/reference to that object. The non-virtual methods are called directly using its address. Single Paradigm Java is a high-level, general-purpose, mostly single-paradigm, statically typed programming language. Weblogs.java.net (2015) , defines programming paradigm is the manner in which programming elements such as functions, objects and variables are exploited to produce the desired output. Java is predominantly a single-paradigm language. The addition of static imports in Java 5.0 accommodates the procedural paradigm better than earlier versions of Java.It follows Object Oriented Programming paradigm. Fig: Primitive data types in Java
Exception Handling in Java Exception is an error event that can occur during the execution of a program and disrupts its normal flow. Java provides a robust and object-oriented way to handle exception scenarios known as Java Exception Handling. Exceptions in java can arise from different kind of situations such as wrong data entered by user, hardware failure, network connection failure, Database server down etc. The term exception means exceptional condition, it is a problem that may arise during the execution of program. A bunch of things can lead to exceptions, including programmer error, hardware failures, files that need to be opened cannot be found, resource exhaustion etc. (Studytonight.com, 2015). The exceptions are divided into 3 categories:
Task 3 Design a Java programming solution to the problem given in the scenario. [2.1 M2] Introduction Departmental Store wants the system to operate even in no-lights condition. For the Departmental Store, the Inventory Management System is to be made using the Java Programming language. Before developing the program, it is very essential to sketch everything from the scratch in order to avoid the problem that might face in the future. In this task, I will be considering the Pseudo-code/algorithm/flowchart, Context diagram and 0-level DFD diagram according to the scenario of the Departmental Store. Pseudo Code Pseudo code can be defined as the notation that resembles the programming language into the simplified form. Bennett (2018) says that, “Pseudocode is an informal way of programming description that does not require any strict programming language syntax or underlying technology considerations.” Pseudo code is not an actual programming language but it is a guide or a set of syntaxes of codes that are written by the programmer to understand the programming data flow. With the help of pseudo code, one can understand the program in less time span. It enables the programmer to concentrate only on the algorithm part of the code development. The pseudo code has also been written for the web application of the leads management system. Login
1. OPEN Login form 2. GET username and password 3. CHECK username and password in database 4. IF username and password is incorrect a. PRINT “login failed” 5. IF username and password is correct a. Start session and open “Homepage” 6. END Add Cashier (Only from Administrator account) 1. Click on Cashier 2. SET the credentials. 3. Click on Add New Update Cashier (Only from Administrator account)
1. On Cashier details, click on the cashier that you want to update. 2. Edit the credentials 3. Click on Update. Delete Cashier (Only from Administrator account) 1. On Cashier details, click on the cashier that you want to delete. 2. Click on Delete. Algorithm An algorithm is a specific set of instructions for carrying out a procedure or solving a problem, usually with the requirement that the procedure terminate at some point (Mathworld.wolfram.com, 2014). A computer program can be viewed as an elaborate algorithm. In computer science, an algorithm usually means a small procedure that solves a recurrent problem. The algorithm for Departmental Store is given below: Login Step 1 Start Step 2 Enter Username and password Step 3 Check username and password Step 4 If username and password is correct then Display Homepage Step 5 If username and password is incorrect then Display Error message Step 6 End Flowchart A flowchart visually represents and organizes the steps used to write the program—it is a diagram of the “flow” of the process. When programmers write code, they need to give the robot instructions that are both sequential and specific. Flowcharts enable programmers to work these steps out before needing to translate their behaviors into code. Flow Chart Symbol Meaning Explanation Start and End The Symbol denoting the beginning and end of the flow chart. Process This symbol shows that the user performs/process a task. Decision This symbol represents a point where a decision is made. Action This symbol means that the user performs an action. Flow Line A line that connects the various symbols in an ordered way.
Task 4 Explain the components and data and file structures required to implement the given design. Introduction For the solution of the Departmental Store to be completed, the various components and the data and file structures are required. The layout must be clear and understandable. For the Java programming solution of the Departmental Store, I will be using eclipse as an integrated development environment (IDE). Referring to the task 3, I will be explaining the components and data file structures required to implement the given design. Data and File Structure A data structure is a specialized format for organizing and storing data. Data structure refers to methods of organizing units of data within larger data sets. Achieving and maintaining specific data structures help improve data access and value. Data structures also help programmers implement various programming tasks (Rouse, 2015). General data structure types include the array, the file, the record, the table, the tree, and so on. Any data structure is designed to organize data to suit a specific purpose so that it can be accessed and worked with in appropriate ways. In computer programming, a data structure may be selected or designed to store data for the purpose of working on it with various algorithms. A file structure is the format in the program that contains everything that defines the workplace from source code and assists to test code and build configurations. While developing the solution for the Departmental Store, the necessary file structure has been created. The file structure of the Inventory Management System is shown below:
Add New Bill Admin Dashboard Add Cashier Fig: File Structure of Inventory Management System
Invoice page Login Page
Admin Login Product form Product Information