sassy
Inheritance and Composition
5 Answer(s)      6 years and 5 months ago
Posted in : Java Beginners
Advertisement
View Answers

January 13, 2009 at 11:33 PM


Hi friend,

Code code after javascript validation :


<html>
<head>
<style>
a.first:link { color: green;text-decoration:none; }
a.first:visited{color:green;text-decoration:none;}
a.first:hover{color:yellow;text-decoration:none;}

a.second:link { color: #400000;}
a.second:visited{color:#400000;}
a.second:hover{color:white;}




body{ background-color:#D2B48C;}
td{text-color:#400000 ;}
</style>
<script>
function validate()
{
if(document.frm.first_name.value=="")
{
alert("Please enter first name.");
return false;
}
if(document.frm.last_name.value=="")
{
alert("Please enter last name.");
return false;
}
if(document.frm.address.value=="")
{
alert("Please enter address.");
return false;
}
if(document.frm.city.value=="")
{
alert("Please enter city.");
return false;
}

if(document.frm.zipcode.value=="")
{
alert("Please enter zipcode.");
return false;
}
if(document.frm.country.value=="")
{
alert("Please enter country.");
return false;
}
if(document.frm.phone.value=="")
{
alert("Please enter phone.");
return false;
}
if(document.frm.cardtype.value=="-1")
{
alert("Please select card type.");
return false;
}

if(document.frm.card_number.value=="")
{
alert("Please enter card number.");
return false;
}
if(document.frm.date_expiry.value=="")
{
alert("Please enter date of expiry.");
return false;
}
return true;
}
</script>
</head>
<body>

<form name="frm" onsubmit="return validate();">
<table align=center>
<tr>
<td><font class=first size=10 color=black><i><b>Real Estate Company</b></i></font></tr>
</table>


<table align=right>
<tr>
<td><a href="sign in.html"><font size=4 color=black>sign in</font>

<td><a href="sign Up.html"><font size=4 color=black>sign up</font>
</tr>
</table><br><br>


<hr></hr>
<table align="center">
<tr>
<td><a class="first" href="home.html"><b><font size=4>Home</font></b></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<td><a class="first" href="AboutUs.html"><b><font size=4>AboutUs</font></b></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<td><a class="first" href="propertysearch.html"><b><font size=4>PropertySearch</font></b></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<td><a class="first" href="gallery.html"><b><font size=4>Gallery</font></b></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<td><a class="first" href="quicksearch.html"><b><font size=4>QuickSearch</font></b></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<td><a class="first" href="Link Your Property.html"><b><font size=4>Link Your Property</font></b></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a class="first" href="contactus.html"><b><font size=4>ContactUs</font></b></a>
</table>

<hr></hr>


January 13, 2009 at 11:33 PM


marquee><font color="white" size=6><b>Data about shares/other realestate information...</b></font></marquee>

<hr></hr>
<br>
<br>
<td><u>Billing Information:</u></td><br><br>

<td>First Name*&nbsp;<input type="text" name="first_name"></td><br>
<td>Last Name*&nbsp;&nbsp;<input type="text" name="last_name"></td><br>
<td>Address*&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="address"></td><br>
<td>City&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="city"
></td><br>
<tr></tr><tr><td>State&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
<tr><td><select>
<option value="-1">Select State</option>

<option value="-1">Andaman and Nicobar</option>

<option value="-1">Andhra Pradesh </option>

<option value="-1">Arunachal Pradesh </option>


<option value="-1">Assam</option>

<option value="-1">Bihar </option>

<option value="-1">Chandigarh </option>


<option value="-1">Chhattisgarh </option>

<option value="-1">Dadra and Nagar </option>

<option value="-1">Daman and Diu </option>

<option value="-1">Delhi </option>

<option value="-1">Goa </option>

<option value="-1">Gujarat </option>

<option value="-1">Haryana </option>

<option value="-1">Himachal</option>

<option value="-1">Jammu and Kashmir </option>

<option value="-1">Jharkhand </option>

<option value="-1">Karnataka </option>

<option value="-1">Kerala </option>

<option value="-1">Lakshadweep</option>

<option value="-1">Madhya Pradesh </option>

<option value="-1">Maharashtra </option>

<option value="-1">Manipur </option>

<option value="-1">Meghalaya </option>

<option value="-1">Mizoram </option>

<option value="-1">Nagaland </option>

<option value="-1">Orissa</option>

<option value="-1">Puducherry </option>

<option value="-1">Punjab </option>

<option value="-1">Rajasthan </option>

<option value="-1">Sikkim </option>

<option value="-1">Tamil Nadu </option>

<option value="-1">Tripura </option>

<option value="-1">Uttarakhand </option>

<option value="-1">Uttar Pradesh </option>

<option value="-1">West Bengal</option>
</option>
</select><br>

<td>Zipcode*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="zipcode"></td><br>
<td>Country*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="country"></td><br>
<td>Phone&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="phone"></td><br><br>
<td><u>Payment Information:</u></td><br><br>
Card Type*&nbsp;&nbsp&nbsp;&nbsp;&nbsp&nbsp;
<select name="cardtype"><option value='-1'>select</option>
<option value='0'>Master Card</option>
<option value='1'>Visa</option>
<option value='2'>American express</option>

</select><br><br>
</select>
<td>Card Number*&nbsp;<input type="text" name="card_number"></td><br><br>
<td>Date of Expiry<input type="text" name="date_expiry"></td><br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td><input type="submit" value="Continue"></td>
<td><input type="submit" value="Reset"></td>
</form>

</body>
</html>


January 13, 2009 at 11:33 PM


Thanks


January 13, 2009 at 11:35 PM


Hi friend,

Problem in class "TestPet"

correct code :

import java.util.*;
public class TestPet extends Animal
{
public static void main(String[]kevs)
{
Scanner console=new Scanner(System.in);

String type, name, home;
int weight, years;
char gender;
Boolean a;
char gen;

System.out.println("Enter the name of animal: ");
name=console.next();

System.out.println("Enter the type of animal: ");
type=console.next();

System.out.println("Enter it's life expectancy: ");
years=console.nextInt();

System.out.println("Enter it's weight: ");
weight=console.nextInt();

System.out.println("Enter it's gender [m] male, [f] female, [n] neutered male, [s] sprayed female");
gender=console.next().charAt(0);

System.out.println("Enter it's home indoor/outdoor: ");
home=console.next();

System.out.println("Enter if it bite or not [Y/N]");
gen=console.next().charAt(0);

if(gen=='y'||gen=='Y')
a=true;


else
a=false;

Animal dog= new Animal(gender, years,name, weight, type);
System.out.println(" "+dog.toString());
}


}


January 13, 2009 at 11:37 PM


For read more information on Java visit to :

http://www.roseindia.net/java/

Thanks









Related Tutorials/Questions & Answers:
Inheritance and Composition - Java Beginners
inheritance class TextDemo { int x; int y; int get(int p, int q...Inheritance and Composition  import java.util.*; public class... is with composition, the act of composing a class out of references to other objects
Inheritance and Composition - Java Beginners
Inheritance and Composition  import java.util.*; public class TestPet { public static void main(String[]kevs) { Scanner console=new Scanner(System.in); String type, name, home; int weight, years; char gender
Advertisements
Inheritance and Composition - Java Beginners
Inheritance and Composition  CAN YOU FIND THE ERROR OF MY CODE JAVA.THIS IS A TEST CLASS.I CANT FIND THE ERROR,CAN YOU FIX IT FRIEND.THANK YOU SO MUCH. import java.util.*; public class TestPet { public static void main
Inheritance and Composition - Java Beginners
Inheritance and Composition  HELLO FRIEND THIS IS THE CODE,CAN YOU FIND WHAT IS THE ERROR AND IF ITS OK CAN YOU FIX IT .THANK YOU. public class Pet extends Animal { private String home, bite; //private Boolean bites
Inheritance and Composition - Java Beginners
Inheritance and Composition  HELLO FRIEND THIS IS THE CODE,CAN YOU FIND WHAT IS THE ERROR AND IF ITS OK CAN YOU FIX IT .THANK YOU.10000X THANK YOU.HOPE YOU HELP ME. public class Animal { private int lifeExpectancy, weight
Inheritance and Composition - Java Beginners
Inheritance and Composition  HELLO FRIEND THIS IS THE CODE,CAN YOU FIND WHAT IS THE ERROR AND IF ITS OK CAN YOU FIX IT .THANK YOU. THANK YOU.HOPE YOU HELP ME.i think theres one error can u fix the error friend .thank u public
inheritance
inheritance  how does one implement inheritance in java
What is composition? - Java Beginners
What is composition?  Hi, What is composition? Give example of composition. Thanks
inheritance
inheritance  hi.. pleaseeeeee i need a quick help(answer) in creating aprogrm in java by using inheritance for car in such away that .... Car is parent class and both of Private and Public Car extends it then both of Bus
Inheritance,Inheritance in Java,Java Inheritance
Inheritance       To know the concept of inheritance clearly you must have the idea of class and its... this, super etc. As the name suggests, inheritance means to take something
multiple inheritance.
multiple inheritance.  hello, can java support multiple inheritance???   hi, java does not support multiple inheritance
Inheritance
Inheritance       To know the concept of inheritance clearly you must have the idea of class and its... this, super etc. As the name suggests, inheritance means to take something
Java inheritance
Java inheritance   can the child access protected content of the parent if the child is in a different project   If you have considered different project as different package then the child cannot access the content
multiple inheritance
multiple inheritance  why java doesn't support multiple inheritance? we can achieve this by using interface but not with classes? what is the main reason that java community implemented like
Multiple Inheritance
Multiple Inheritance  All are saying java doesn't support multiple inheritance but by default Object class is super class for all the user defined... class so java any how do multiple inheritance? Can you please explain
Multiple Inheritance
Multiple Inheritance  Why Java Doesn't have Multiple Inheritance It is Advantage or Disadvantage.........   Hi Friend, When we extends... and inconsistencies Java does not support Multiple Inheritance. Thanks
javascript inheritance framework
javascript inheritance framework  javascript inheritance framework
Inheritance question?
Inheritance question?  Q3)Create a class hierarchy as Company extended by AccountsDepartment. AccountsDepartment extended by AccountsReceivable and AccountsPayables. The Company performs following operations. (1
Inheritance question?
Inheritance question?  Q3)Create a class hierarchy as Company extended by AccountsDepartment. AccountsDepartment extended by AccountsReceivable and AccountsPayables. The Company performs following operations. (1
Inheritance
Inheritance       To know the concept of inheritance clearly you must have the idea of class and its... this, super etc. As the name suggests, inheritance means to take something
Inheritance in Spring
Inheritance in Spring       Inheritance Demo, In the example given below we are going to tell about the inheritance in the Spring framework. By inheritance we mean a way
Inheritance in java - Java Beginners
Inheritance in java  I want a example program using the concept of (simple and multiple) inheritance
Inheritance
other features like creation and implementation of the object, Inheritance etc...; float p, q;   public Rectangle...(){   return(p * q);   
Inheritance in java - Java Beginners
Inheritance in java  I want a example program using the concept of (single and multiple) inheritance.  Hi Friend, Please visit the following link: http://www.roseindia.net/java/language/inheritance.shtml Thanks
inheritance - Java Beginners
inheritance  help me on inheritance concept in java specialy on overloading and overridding concept
Concept of Inheritance in Java
Concept of Inheritance in Java Concept of Inheritance in Java is considered one of the important features of Object Oriented Programming. Inheritance... class from parent class. Let's understand the concept of inheritance in Java