Click here to Skip to main content
15,882,209 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

C#
**British history application class
**/
public class BritishHistoricalFigure{

      private String name;
      private int birthYear;
      private String occupation;
      private int yearOfDeath;
   
    /* replacement for default constructor*/
   public BritishHistoricalFigure(){
   }
      /*constructor method*/
   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(){
      //int year= 1485;
      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;
   }
}
Posted
Updated 10-Dec-22 23:51pm
v2

1 solution

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900