Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

You are asked to write a Java program to calculate the commercial value of the stamps owned by a philatelist. Each philatelist has a name and a collection of stamps. The stamps can be divided into two groups: Group I and Group II. Each stamp has the following attributes: name, face value, and publication year. The commercial value of a stamp is calculated as follows:

1. for a stamp in Group I, the commercial value is twice its face value,

2. for a stamp in Group II, the commercial value is triple its face value.

You need to follow the following interfaces:

public interface IStamp {

 double get_faceValue();

String get_name(); // return the name of a stamp

Int get_publicationYear(); //return the Publication year of a stamp

}

public interface IPhilatelist {

ArrayList get_allStamps();

 void add_stamps(IStamp stmp);

double get_totalCommercialValue();

 }

Your classes (Stamp_GroupI, Stamp_GroupII and Philatelist) implementing the above two interfaces, as appropriate, should NOT have any other public method.

The test file is as follows:

class Program {

static void Main(string[] args) {

 IPhilatelist john = new Philatelist("John");

 IStamp w1= new Stamp_GroupII("Yellow Stone",0.29, 1975);

 IStamp w2 = new Stamp_GroupI("Forever Freedom",0.45, 2011);

 IStamp w3 = new Stamp_GroupI("Forever BigBen",0.42, 2008);

 john.add_stamps(w1);

 john.add_stamps(w2);

 john.add_stamps(w3);

 System.out.println("Total Commercial value is" + john.get_totalCommercialValue());

}

}

Java, Programming

  • Category:- Java
  • Reference No.:- M9533967

Have any Question?


Related Questions in Java

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Can someone kindly help me to consider whether java

Can someone kindly help me to consider whether Java provides the facility of operator overloading? If it does, may you kindly describe how overloading operators can be accomplished? If not, may you kindly describe why yo ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As