Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Suresh Shahapurkar
javaprogram 26
1 Answer(s)      3 years and 4 months ago
Posted in : Java Beginners


Write a java progtram to create two classes commercial and domestic. override the metod calculatebill() of commercial class(Rs.8 per unit)into domestic class(Rs 6 per unit) to comput electricity bill for both classes.


Advertisement
View Answers

August 23, 2011 at 1:34 PM


class Commercial {
int i=0;
Commercial(int a) {
i = a;
}
void calculateBill() {
int units=100;
int cost=100*i;
System.out.println("Commercial Bill is of Rs "+cost);
}
}

class Domestic extends Commercial {
int k=0;
Domestic(int a, int b) {
super(a);
k = b;
}
void calculateBill() {
int units=100;
int cost=100*k;
super.calculateBill();
System.out.println("Domestic Bill is of Rs "+cost);
}
}

class Bill {
public static void main(String args[]) {
Domestic bill = new Domestic(8, 6);
bill.calculateBill(); 
}
}


Related Tutorials/Questions & Answers:
javaprogram 26
javaprogram 26  Write a java progtram to create two classes commercial and domestic. override the metod calculatebill() of commercial class(Rs.8 per unit)into domestic class(Rs 6 per unit) to comput electricity bill for both
javaprogram 14
javaprogram 14  Write a java program to calculate the percentage of a student marks by using java airthmatic operators like +(addition),%(division).   import java.util.*; public class Student { public static void
Advertisements
This is 26 set of different shades of Black covers light brown to darker Black.
:5px 0px 5px 5px; } This is 26 set of different shades of Black covers... #140C0C Black 25 #0B0707 Black 26 #1C1313
This is the 26 color set of Blue ranging from light to darker.
:5px 0px 5px 5px; } This is the 26 color set of Blue ranging from light... #0F4D92 Blue 26 #417DC1
This is the 26 color set of Green ranging from light to darker.
:5px 0px 5px 5px; } This is the 26 color set of Green ranging from light... Green 25 #014421 Green 26 #008000
Here is a set of 26 different shades of one of the most favourite Red colors
:5px 0px 5px 5px; } Here is a set of 26 different shades of one of the most... #380000 Red 25 #300000 Red 26 #280000
This is a versatile shade of blue named Violet. Here is the a set of Violet of 26 different shades.
is the a set of Violet of 26 different shades. Name/String Code... #CFA5E6 Violet 26 #B2BEB9
This is a versatile shade of blue named Yellow. Here is the a set of Yellow of 26 different shades.
is the a set of Yellow of 26 different shades. Name/String Code... #EEE600 Yellow 26 #F3E5AB
This is a set of 26 different shades of brown colors covering light brown to darker brown.
:5px 0px 5px 5px; } This is a set of 26 different shades of brown colors... Brown 24 #F5DEB3 Brown 25 #321414 Brown 26
Here is a set of 26 different shades of one of the most favourite Orange colors rangeing from light Orange color to darker Orange color.
:5px 0px 5px 5px; } Here is a set of 26 different shades of one of the most... #CD5700 Orange 25 #FF6347 Orange 26 #E34234
Here is a set of 26 different shades of one of the most favourite Pink colors rangeing from light Pink color to darker Pink color.
:5px 0px 5px 5px; } Here is a set of 26 different shades of one of the most... Pink 26 #DE6FA1
Features of Servlet 2.5
Features of Servlet 2.5       This version has been released on September 26, 2005 by the Sun MicroSystems. It is not necessary that all web servers and application servers support
Windows 8, the New Operating System from Microsoft
is finally over with its official launch on October 26. Windows 8 unlike all previous
\wrapper
to binary and hexadecimal expected output: String s = 26 Integer m = 26 String s = 26 String x = 6 integer m = 26 Integer.MIN_VALUE = -2147483648
\wrapper
to binary and hexadecimal expected output: String s = 26 Integer m = 26 String s = 26 String x = 6 integer m = 26 Integer.MIN_VALUE = -2147483648
\wrapper
to binary and hexadecimal expected output: String s = 26 Integer m = 26 String s = 26 String x = 6 integer m = 26 Integer.MIN_VALUE = -2147483648
Can anybody help me with this simple MySql code
2013-03-17 17:25:15 2 34 23 ind 2013-03-16 18:26:20 3 34 37 ken 2013-03-17 18:26:32 1 54 61 jpy 2013-03-17 18:26:40 5 23 33 aus 2013-03-17 18:26:42 6 32 35
How to calculate sum of HH:MM:SS Format?
How to calculate sum of HH:MM:SS Format?  how to calculate sum of HH:MM:SS? for example: 10:25:36+26:50:56 calculate sum of these values
how to find the sum of integers in a string of sentence in java
how to find the sum of integers in a string of sentence in java  how to find the sum of integers in a string of sentence in java for e.g:--> abc d 2 3 21 the output should be 2+3+21=26
Tomcat - WebSevices
Tomcat Error calling delegate restart  I am getting error like! ENTRY org.eclipse.wst.server.core 4 0 2008-03-10 12:26:33.992 !MESSAGE Error calling delegate restart() Tomcat v5.0 Server at localhost
How to insert new line after every space in java
How to insert new line after every space in java  Hii Sir, I have a string with values 69 17 17 16 2 1 1 26 26 56 like this .Now as per my need i have to put all these values into new lines on getting space
Java basics
be similar to class name. (ex. If class name is JavaProgram than file name should
logic for c language
logic for c language  01 02 03 04 05 06 20 21 22 23 24 07 19 32 33 34 25 08 18 31 36 35 26 09 17 30 29 28 27 10 16 15 14 13 12 11
java
java  write a java code given string="bob" as alphabets are 26 Assign A or a as 1,B or b as 2,........Z or z as 26 now "bob" means 2+15+2=19 as b=2,o=15 Now how can i assign values for any given string and get calculated to get
Displaying Hierarchical data in JTree
;JavaProgram", "JavaNews",  "Java","project"...;JavaTeamName->Amit Java: JavaProgram ->JavaBook->Java->JavaProgram  
NSArray Count Example
is: 2010-10-05 15:26:05.700 method[1117:207] array = 1 2010-10-05 15:26
how do i grab the url in php?
how do i grab the url in php?  I want to grab the 'entire' url, including any special characters like & and #, from a site. I then want to replace the characters with something a browser can read for example: & = %26
 

 

 

DMCA.com