University Java Programming Assignment: ATM Application Project

Verified

Added on  2022/11/13

|6
|769
|60
Homework Assignment
AI Summary
This Java programming assignment details the development of an ATM application, showcasing object-oriented programming principles. The application, built in Netbeans IDE, comprises two classes: ATMApp (parent class) and ATMclass (child class), demonstrating inheritance using the 'extends' keyword. The ATMApp class handles user pin verification and calls methods from the ATMclass, which includes constructors and methods for account selection, menu display, deposit, withdrawal, and balance inquiry. The assignment highlights the use of methods, constructors, and error handling (e.g., insufficient balance). The conclusion confirms the successful implementation of all requirements, with all methods functioning as expected, and the application demonstrating inheritance and polymorphism. The references include sources on Java programming and object-oriented concepts.
Document Page
Running head: ATM APP
ATM APP
Name of the student
Name of the University
Author Note
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1ATM APP
Table of Contents
Introduction................................................................................................................................2
Discussion..................................................................................................................................2
Conclusion..................................................................................................................................4
References..................................................................................................................................5
Document Page
2ATM APP
Introduction
Java is a class-based, object-oriented, general-purpose programming language. Java
uses an automatic garbage collector to handle the memory in the lifecycle of the item. Inside
the classes all the codes are written, all the data items is an object, primitive data type being
the exception because of performance reasons they are not objects (Tempero, Yang & Noble,
2013, July). The Java Program ATMApp.java is developed in Netbeans IDE.
Discussion
Source files are named as ATMApp.java, they are first compiled into bytecode by the
use of Java compiler and after that only it can be executed. The source file consist of two
classes the ATMApp class which is the parent class in which the main function is called and
the ATMclass class which is the child class. ATMclass inherits the ATMApp class with the
help of extends keywords. Thus ATMclass class can use the methods and fields of ATMApp
class and even can add new fields and methods to the current child class (Liang & Tsai,
2013). With the implementation of inheritance methods are overridden to achieve runtime
polymorphism and for the reusability of the code. In ATMApp class the pin of the user is
verified, if an incorrect pin is entered an error message is generated “Enter the correct pin”.
The hash code of the pin is generated. All the methods in ATMclass are called in ATMApp
class by creating an object o of the child class (Schildt, 2014). The object of class is created,
this is done as same as the variables are declared of primitive data type and then initializing
them with values. The object is generated by the keyword “new” and a reference is then
assigned to it of that same object to the variable of class type.
ATMApp ob= new ATMApp();
Document Page
3ATM APP
ATMclass o= new ATMclass();
ATMclass() is a constructor in ATMclass class while is applied to override the details from
the file in ATMApp class. Method selectAccount() is used to select the account type from the
user as Savings or Checking. Method showMainMenu() is used to display the menu to the
user which contains options like Inquire Balance, Withdraw, Deposit, Other Account and
Quit. Method deposit() is used to deposit the money inputted by the user to the account type
selected (Gaddis, Mukherjee, & Bhattacherjee, 2013). Method withdraw() is used to
withdraw the inputted money from the account of the user and if the account does not
contains the expected amount an error message is produced as “Insufficient balance”. Method
displayBalance is used to display the balance in the account of user after the functions
withdraw() and deposit() is performed.
Figure 1 ATMApp class
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4ATM APP
Conclusion
This study concludes that the java programme ATMApp is developed by fulfilling all
the requirements. All the methods are working as the final output testing was expected. There
are two classes ATMApp class and ATMclass class. Inheritance is achieved and ATMApp
class is the parent class and ATMclass class is the child class. All the fields and methods of
ATMApp class are overridden in the ATMclass class by the keyword extends. The data
members and methods are working as per requirement and the expected output is generated.
Figure 2 ATMclass class
Document Page
5ATM APP
References
Gaddis, T., Mukherjee, S., & Bhattacherjee, A. K. (2013). Starting out with Java: From
control structures through objects. Pearson.
Liang, Y. D., & Tsai, M. J. (2013). Introduction to Java programming: brief version.
Pearson.
Schildt, H. (2014). Java: the complete reference. McGraw-Hill Education Group.
Tempero, E., Yang, H. Y., & Noble, J. (2013, July). What programmers do with inheritance
in Java. In European Conference on Object-Oriented Programming (pp. 577-601).
Springer, Berlin, Heidelberg.
chevron_up_icon
1 out of 6
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]