Portfolio Title





 

 

Student Portfolio >> Index >> Coding >> JAVA Exercise 9

public class product 
           { protected String prodNumber;
 protected float price;
 protected double quantity;
 public Product(String pnum, float newprice)
 { prodNumber=pnum;
 price=newprice;
 }
 public Product(String pnum, float newprice, double qty)
 { prodNumber=pnum;
 price=newprice;
 quantity=qty;
 }
 pubic Product()
 { prodNumber="JH000";
 price=(float)0.0;
 quantity=0.0;
 }
 
 { 
 public void display()
 {System.out.println("Prodno=" + prodNumber + "price= " + price + "quantity = " + quantity);
 }
 
 public double getQuantity()
 { return quantity;
 }
 public void setQuantity(double newqty)
 { quantity=newqty;
 }
 public void setQuantity(int qty)
 { quantity=(double)qty;
 } 
}
 
 
<< Back                                                                                                                                                                                        Forward >> 

Coding | Website Scripting | Visual Design | Instructional Design | Website Design | Website Design Tools

 

Copyright 2005 Kerstin Kegel