A Micro-Project Report "Simple Calculator Application Using Java Applet and Electricity Bill Calculator of A Person Using Inheritance of Java"

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

A

Micro-Project Report
On

“Simple Calculator Application using Java Applet


and Electricity Bill Calculator Of A Person using
Inheritance of Java”
Submitted for the partial fulfillment of Fourth Semester subject “Java
Programming” code: 22412.

Submitted By:-
Name of Student Enrollment No.
1. Vishal S. Kesharwani 1812420115
2. Shardaprasad S. Kawle 1812420114
3. Pravin S. Thakre 1812420117
4. Shital R. Lilhare 1812420112

Under the Guidance of

Mrs. R R Meshram
Lecturer
Department of Computer Engineering

Department of Computer Engineering


Government Polytechnic,Gondia
Summer – 2020

1
Certificate
This is to certify that the Micro Project titled
“Simple Calculator Application using Java Applet
and Electricity Bill Calculator Of A Person using
Inheritance of Java.

Carried out under guidance of Mrs. R R Meshram mam, Lecturer,
Computer department and submitted to the department of computer
engineering

Submitted By:-

Name of Student Enrollment No.


1. Vishal S. Kesharwani 1812420115
2. Shardaprasad S. Kawle 1812420114
3. Pravin S. Thakre 1812420117
4. Shital R. Lilhare 1812420112

As the partial fulfilment of Fourth semester Subject course of “Java


Programming” code:22412 during Summer-2020.

Mrs. R R Meshram Mr. J M Mesharam


Guide and Lecturer Head of Department

Department of Computer Engineering Department of Computer Engineering

Department of Computer Engineering


Government Polytechnic, Gondia
Summer-202

INDEX

2
Sr
Title Page no.
No.
1 Rationale 4
2 Aim/Benefit of the micro-project 4
3 Course Outcomes Addressed 4
4 Literature Review 5-9
5 Actual Methodology Followed 10-12
6 Actual Resources Used 13
7 Outputs of the Micro-Project 13-17
8 Skill Developed / learning out of this Micro-Project 18
9 Applications of this Micro-Project 18

Micro-Project Report

3
Title of Micro-Project : Simple Calculator Application using Java Applet and
Electricity Bill Calculator Of A Person using Inheritance of Java.

1.0 Rationale
 Programmable Calculators : Programmable calculators are calculators that
can automatically carry out a sequence of operations under control of a
stored program, much like a computer. The first programmable calculators such as
the IBM CPC used punched cards or other media for program storage. Hand-held
electronic calculators store programs on magnetic strips, removable read-only
memory cartridges, flash memory, or in battery-backed read/write memory.
 Java: Java is a general-purpose programming language that is class-
based, object-oriented, and designed to have as few
implementation dependencies as possible. It is intended to let application
developers write once, run anywhere (WORA), meaning that compiled Java code
can run on all platforms that support Java without the need for recompilation. Java
applications are typically compiled to bytecode that can run on any Java virtual
machine (JVM) regardless of the underlying computer architecture.
The syntax of Java is similar to C and C++, but it has fewer low-level facilities
than either of them. As of 2019, Java was one of the most popular programming
languages in use according to GitHub, particularly for client-server web
applications, with a reported 9 million developers.

2.0 Aims/Benefits Of The Micro-Project


 Simple Calculator Application using Java Applet and Electricity Bill Calculator
Of A Person using Inheritance of Java.
3.0 Course Outcomes Addressed
a. Develop programs using Object Oriented methodology in java.
b. Apply concept of inheritance for code reusability.
c. Develop programs using Multithreading.
d. Implement Exception Handling.
e. Develop programs using graphics and applet.

4.0 Literature Review

4
Why Do We Have Used Java Runtime Environment for Application
Development?
Java technology allows you to work and play in a secure computing environment.
Upgrading to the latest Java version improves the security of your system, as older
versions do not include the latest security updates.

Java allows you to play online games, chat with people around the world, calculate your
mortgage interest, and view images in 3D, just to name a few.

 JVM (Java Virtual Machine): A Java virtual machine (JVM) is a virtual


machine that enables a computer to run Java programs as well as programs written
in other languages that are also compiled to Java bytecode. The JVM is detailed by
a specification that formally describes what is required in a JVM implementation.
Having a specification ensures interoperability of Java programs across different
implementations so that program authors using the Java Development Kit (JDK) need
not worry about idiosyncrasies of the underlying hardware platform. Below is given
how the Java Programs Get Executed.

Fig. Java Program Execution Steps Fig. Java Applet Life Cycle

 Java Applet : Java applets were small applications written in the Java programming


language, or another programming language that compiles to Java bytecode, and
delivered to users in the form of Java bytecode. The user launched the Java applet
from a web page, and the applet was then executed within a Java virtual
machine (JVM) in a process separate from the web browser itself. A Java applet could
appear in a frame of the web page, a new application window, Sun's AppletViewer, or
a stand-alone tool for testing applets. above fig. shows java applet life cycle.
Java applets were introduced in the first version of the Java language, which was
released in 1995. Beginning in 2013, major web browsers began to phase out support
for the underlying technology applets used to run, with applets becoming completely
unable to be run by 2015–2017. Java applets were deprecated since Java 9 in 2017
and removed from Java SE 11 (18.9), released in September 2018.

There are two standard ways in which you can run an applet :


1. Executing the applet within a Java-compatible web browser.

5
2. Using an applet viewer, such as the standard tool, applet-viewer. An applet viewer
executes your applet in a window. This is generally the fastest and easiest way to test
your applet.

Each of these methods is described next.


1. Using java enabled web browser : To execute an applet in a web browser we have to
write a short HTML text file that contains a tag that loads the applet. We can use
APPLET or OBJECT tag for this purpose. Using APPLET, here is the HTML file that
executes HelloWorld :
<applet code="HelloWorld" width=200 height=60>
</applet>
The width and height statements specify the dimensions of the display area used by the
applet. The APPLET tag contains several other options. After you create this html file,
you can use it to execute the applet.
NOTE : Chrome and Firefox no longer supports NPAPI (technology required for Java
applets). Refer here
2. Using appletviewer : This is the easiest way to run an applet. To execute HelloWorld
with an applet viewer, you may also execute the HTML file shown earlier. For example,
if the preceding HTML file is saved with
RunHelloWorld.html,then the following command line will run HelloWorld :

3. appletviewer RunHelloWorld.html

 COMPUTER SYSTEM :
We have used DELL INSPIRON , 8th generation WITH INBUILT WINDOWS 10
Operating system of 3.20 GHz INTEL Pentium Core processor with i7technology
computer ( PC ).
Dell Inspiron desktops and all-in-one PCs are designed with innovative
technology and latest features .

6
 OFFICE SOFTWARE PACKAGES :
We have used MS word 2013 for creating our report to show about how we
created this website . For performing of this project we have used MICROSOFT
WORD OFFICE OF 2013 version. Microsoft Office 2013  is a version
of Microsoft Office, a productivity suite for Microsoft Windows. It is the
successor to Microsoft Office 2010 and the predecessor to Microsoft Office 2016.

 Application Source Code:


add=new Button("+");
import java.applet.*; sub=new Button("-");
import java.awt.*; mul=new Button("*");
import java.awt.event.ActionEvent; div=new Button("/");
import java.awt.event.ActionListener; eq=new Button("=");
import java.awt.event.TextEvent; cl=new Button("Clear");
import java.awt.event.TextListener;;
public class calculator extends Applet GridLayout gb=new GridLayout(4,5);
implements ActionListener, TextListener setLayout(gb);
{
String s,s1,s2,s3,s4; add(t1);
Button b1,b2,b3,b4,b5,b6,b7,b8,b9,b0; add(b1);
Button add,sub,eq,cl,mul,div; add(b2);
TextField t1; add(b3);
int a,b,c; add(b4);
add(b5);
public void init() add(b6);
{ add(b7);
t1=new TextField(10); add(b8);
b1=new Button("1"); add(b9);
b2=new Button("2"); add(b0);
b3=new Button("3"); add(add);
b4=new Button("4"); add(sub);
b5=new Button("5");
b6=new Button("6"); add(mul);
b7=new Button("7"); add(div);
b8=new Button("8");
b9=new Button("9"); add(eq);
b0=new Button("0");
7
add(cl);
t1.setText("");
b1.addActionListener(this); s3="-";
b2.addActionListener(this); }
b3.addActionListener(this); if(s.equals("*"))
b4.addActionListener(this); {
b5.addActionListener(this); s2=t1.getText();
b6.addActionListener(this); t1.setText("");
b7.addActionListener(this); s3="*";
b8.addActionListener(this); }
b9.addActionListener(this); if(s.equals("*"))
b0.addActionListener(this); {
add.addActionListener(this); s2=t1.getText();
sub.addActionListener(this); t1.setText("");
mul.addActionListener(this); s3="*";
div.addActionListener(this); }
eq.addActionListener(this); if(s.equals("="))
cl.addActionListener(this); {
paint(); s4=t1.getText();
//t1.addTextListener(this); a=Integer.parseInt(s2);
} b=Integer.parseInt(s4);
public void paint() if(s3.equals("+"))
{ c=a+b;
setBackground(Color.green); if(s3.equals("-"))
} c=a-b;

public void actionPerformed(ActionEvent e) t1.setText(String.valueOf(c));


{ }
s=e.getActionCommand(); if(s.equals("Clear"))
if(s.equals("0")||s.equals("1")||s.equals("2")|| {
s.equals("3")||s.equals("4")||s.equals("5")|| t1.setText("");
s.equals("6")||s.equals("7")||s.equals("8")|| }
s.equals("9")||s.equals("0")) }
{ public void textValueChanged(TextEvent e)
s1=t1.getText()+s; {
t1.setText(s1);
} }
if(s.equals("+")) }
{
s2=t1.getText();
t1.setText("");
s3="+";
}
if(s.equals("-"))

{
s2=t1.getText();

8
 Electricity Bill Calculator using Inheritance Source Code
System.out.println("Units Consumed :
import java.util.*; " + units);
class CalculateBill System.out.println("Bill to pay : " +
{ b.billpay);
double billpay; }
}
void Bill(long units)
{
if(units<100)
billpay=units*1.20; }
else if(units<=300)
billpay=100*1.20+(units-
100)*2;
else if(units>300)
billpay=100*1.20+200 *2+
(units-300)*3;

}
}
class ComputeElectricityBill extends
CalculateBill
{
public static void main(String args[])
{
String name;
int no;

Scanner sc=new Scanner(System.in);


System.out.println("ENTER BILL
NO OF CUSTOMER");
name=sc.nextInt();

Scanner sc=new
Scanner(System.in);
System.out.println("ENTER NAME
OF CUSTOMER");
name=sc.nextString();

long units;
Scanner sc=new Scanner(System.in);

System.out.println("enter number
of units");
units=sc.nextLong();
ComputeElectricityBill b=new
ComputeElectricityBill();
b.Bill(units);
System.out.println("Customer Number : "
+ customerNo);
System.out.println("Customer
Number : " + name);
 Reference Websites:
9
https://tutorialspoint.Java appletsprograming.co.in: this website we have used to
collect information about the java applet concepts and syntax.
http://w3schools.java.tutorials.com : this website we have used to collect information
about Java Inheritance,
http://JavaTutorials.co.in : Collected All Information About Java Program Execution.

5.0 Actual Methodology Followed


1. First we have Collected the required Information From Internet From Websites.
2. After collecting the requirements we have Distributed the work tasks to our Team
Members.
3. Then we have Analyzed the Concept of Inheritance, Applet in Java and various
Events Of Applet to prepare an Application. After analyzing we will preparing a
rough model in a paper for how the system will works.
4. We have prepared our final Application using Java Runtime Environment Software
such as JDK(java development kit) v7.8.01, Command Prompt, and Notepad Editor,
Java inbuilt Appletviewer .
5. We have tested the Application for Checking that Application is giving correct work
product or not . we have given both correct and incorrect inputs to application for
testing its behavior under various conditions.
6. Then after Testing we have Checked the Work products that has been carried out from
our application.
7. After completing Application project works we have Prepared Micro-Project Report
and submitted it to our guide.

6.0 Actual Resources Used


Name of Specifications Qty. Remarks
S. No. Resource/material
1. Computer system Desktop or Laptop with approx. 2GB 1 Collected
RAM ,500GB HDD or SSD with at Information
least Intel core-i3 processor. from internet.
2. Software JDK v7.8.01 , 1 For Creating of
Command Prompt[CMD], Application.
Notepad Editor
3. Office Software Microsoft Word 2013 or others - Preparing
Packages Demonstration
Report.
4. Reference https://tutorialspoint.Java
Websites appletsprograming.co.in

http://w3schools.java.tutorials.com

http://JavaTutorials.co.in :

7.0 Outputs of the Micro-Project

10
Fig. Output Of Electricity Bill Calculator Using Inheritance

Fig. Output Of Simple Calculator Using Java Applet

8.0 Skill Developed / learning out of this Micro-Project


 The Skills were developed from this micro-project is to Develop is to construct a
Windows Based Application in Java Runtime Software/Tool
 Observed Various Concept Of Java Applets and Inheritance.
 Understand the importance of Applet in Java Programming.

9.0 Applications of this Micro-Project


 There is wide roll of this micro-project in Calculation of Electricty Bills By entering
only Total Watts Consumed and Arithmetic Calculations Digitally
 This can be implemented in many of languages but we have chosen Java for Preparing
application As it gives Visualize Interface To user which helps the user to easily
identify the Contents of Software and the projects should be build from it.

**************

11

You might also like