Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* File name : Price.java */
- public class Price {
- private String itemName;
- private String currencyType;
- private double amount;
- public String getName() {
- return itemName;
- }
- public String getType() {
- return currencyType;
- }
- public double getAmount(){
- return amount;
- }
- public void setName(String name){
- itemName = name;
- }
- public void setType(String type){
- currencyType = type;
- }
- public void setIdNum(double value){
- amount = value;
- }
- }
- /* File name : TestPrice.java */
- public class TestPrice {
- public static void main(String args[]){
- Price price = new Price();
- price.setName("Book");
- price.setType("USD");
- price.setAmount(14.99);
- System.out.print("Item Name: " + price.getName() + " Currency Type: " + price.getType() + " Item Price: " + price.getAmount());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement