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




Have Programming Question? Ask it here!
 
 
 


Suresh Shahapurkar
javaprogram 26
1 Answer(s)      3 years 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 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
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
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
Java basics
be similar to class name. (ex. If class name is JavaProgram than file name should
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
Displaying Hierarchical data in JTree
;JavaProgram", "JavaNews",  "Java","project"...;JavaTeamName->Amit Java: JavaProgram ->JavaBook->Java->JavaProgram  
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
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
foreach Loop
"; $studentAges["Shekhar"] = "26"; $studentAges["Shivangi"] = "25"; $studentAges["Kapil"] = "26"; $studentAges["Samita"] = "24"; foreach( $studentAges as $name... : Name: Ankita, Age: 25 Name: Shekhar, Age: 26 Name: Shivangi, Age: 25 Name
PHP MySQL Update
;; mysql_query("update student set age=26 where e_id='emp01'"...: emp01 28 emp02 27 emp05 26 emp_05 28 After updation: emp01 26 emp02 27 emp05 26
PHP MySQL Delete
: emp01 26 emp02 27 emp05 26 emp_05 28 After Deletion a record: emp01 26 emp05 26
Insert Serialized Object into Database Table
student1 = new StudentDetails("Kapil", 26, "Male"); StudentDetails student2 = new StudentDetails("Nitesh", 26, "Male"); StudentDetails student3 = new StudentDetails("Divya", 26, "
Java Write to properties file
) { e.printStackTrace(); } } } Output: #Wed Sep 26 16:56:26 IST 2012
JAVA
; 128; c++) if (c != 26 ) // ANSI Clear screen System.out.println("value...++) if (c != 26 ) System.out.println("value: " + (int)c +" character: " + c
java servlet connectivity problem with access
(.......){} ERROR MSG on cmd DBPhoneLookup.java:26: incompatible types found
java - code problem - Java Beginners
java - code problem  hi I want to create log file for my new project. so i choose logging class from util package. But here print some unwanted texts. Sep 9, 2008 5:59:26 PM writapplication.NewJFrame start_buttonMouseClicked
java bits 7 - Java Interview Questions
java bits 7  Given: 20. public class CreditCard { 21. 22. private String cardlD; 23. private Integer limit; 24. public String ownerName; 25. 26. public void setCardlnformation(String cardlD, 27. String ownerName, 28
struts configuration give error like doctype root=null
) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Jul 26, 2011 11:03:12...) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Jul 26... -rules.xml' Jul 26, 2011 11:03:12 AM org.apache.struts.validator.ValidatorPlugIn
SQL Length Function
,'santosh','a 124 sec 126 nodia'); insert into Stu_Table values(5,'tanuj','a 32 sec 26... sec 26 nodia... | tanuj | a 32 sec 26 nodia | 17
problem in inserting data in databases created in ecplise using jsp
" size="26%" class="inputForm"></TD> </tr>...%"><INPUT TYPE="text" NAME="lname" size="26%" class="inputForm"></TD>...="organization" size="26%" class="inputForm"></TD> <
problem in inserting data in databases created in ecplise using jsp
" size="26%" class="inputForm"></TD> </tr>...%"><INPUT TYPE="text" NAME="lname" size="26%" class="inputForm"></TD>...="organization" size="26%" class="inputForm"></TD> <
SQL Length Function
sec 126 nodia'); insert into Stu_Table values(5,'tanuj','a 32 sec 26 nodia... | a 124 sec 126 nodia | | 5 | tanuj | a 32 sec 26 nodia... | | 5 | tanuj | a 32 sec 26 nodia | 17
Collection Framework
"); e2.setSalary(26); Employee e3 = new Employee(); e3.setId(2); e3.setAge(25
Ask java count
| | b003 | advanced java book | 26 | | b004 | MySQL 1
java bits 8 - Java Interview Questions
String getCountry() { return super.country; } 26. } 27. 28. class Euro extends
call frame again - Java Beginners
, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(26, 26, 26...))) .addContainerGap(26, Short.MAX_VALUE)) ); pack
C language-qsort and bsearch function - Ajax
(); ch = tolower(ch); p = (char *) bsearch(&ch, alpha, 26, 1, comp
Advertisements
 

 

 

DMCA.com