British history
1. Write a support class according to the UML diagram below.
BritishHistoricalFigure-
name:String
- birthYear:int
- occupation:String
- diedInYear:int
+ BritishHistoricalFigure(name:String, birthYear:int, occupation:String, diedInYear:int)
+ getBirthYear():int
+ getOccupation():String
+ getDiedInYear():int
+ setOccupation(occupation:String):void
+ getHistoricalPeriod():String
+ displayHistoricalFigure():void
The history of Britain is usually divided by historians into a series of periods. These are often connected with the royal house occupying the throne at the time. The periods in modern British history can loosely be described using the following:
Less than 1485: Pre-Tudor
1485- less than 1603: Tudor
1603- less than 1714:
Stuart 1714- less than 1837:
Georgian 1837- less than 1901:
Victorian 1901- less than 1910:
Edwardian 1910+ : Windsor
2-Write a method, getHistoricalPeriod that returns the period in which this British historical figure was born.
3-The displayHistoricalFigure method:
1. Print out a sentence summarising this historical figure as shown in the expected output below. Youshouldcall the getHistoricalPeriodmethodforpartoftheoutput.
In the application class:
1. Create 2 instances of BritishHistoricalFigure in main, using the data given below to initialise the data fields.
William Shakespeare, 1564– 1616, dramatist. AdaLovelace, 1815- 1852, mathematician.
2. Call the displayHistoricalFigure method on each instance.
Expected output:
William Shakespeare, 1564- 1616, was a dramatist born in the Tudor period. Ada Lovelace, 1815- 1852, was a mathematician born in the Georgian period.
What I have tried:
**British history application class
**/
public class BritishHistoricalFigure{
private String name;
private int birthYear;
private String occupation;
private int yearOfDeath;
public BritishHistoricalFigure(){
}
public BritishHistoricalFigure(String n, int bY, String o, int yOD){
occupation = o;
birthYear = bY;
yearOfDeath = yOD;
name =n;
}
public int getBirthYeaar(){
return birthYear;
}
public String getOccupation(){
return occupation;
}
public int getYearOfDeath(){
return yearOfDeath;
}
public void setOccupation(String O){
occupation = O;
}
public String getHistoricalPeriod(){
if yearOfDeath == (year < 1485){
return "Tudor";
}
else if (year <=1603){
return "Tudor";
}
else if (1603 <= 1714){
return "Stuart";
}
else if (1714 <=1837){
return "Georgian";
}
else if (1837 <= 1901){
return "Victorian";
}
else if(1901 <= 1910){
return "Edwardian";
}
else{
return "Windsor";
}
public void displayHistoricalFigure(){
return displayHistoricalFigure;
}
}