Question: (10 marks) P2: Register classes Focus: Inheritance In this part of the project, you will create classes representing more components of our simulated machine, specifically

 (10 marks) P2: Register classes Focus: Inheritance In this part ofthe project, you will create classes representing more components of our simulatedmachine, specifically we will create classes to model the different registers inthe Central Processing Unit (CPU) MEMORY 0 0799 0798 0198 0499 1008

(10 marks) P2: Register classes Focus: Inheritance In this part of the project, you will create classes representing more components of our simulated machine, specifically we will create classes to model the different registers in the Central Processing Unit (CPU) MEMORY 0 0799 0798 0198 0499 1008 1108 0899 Input Device 2 3 4 5 6 7 8 9 Program Counter CENTRAL PROCESSING UNIT 0898 Instruction Register Accumulator Output Device Start by creating a new package P2 and copy to it the two classes you created in P1 (i.e. Memory and Terminal). Then add more classes to P2 as indicated below. Note that you can also use the classes from P1 solution" that is posted on Connect instead of your own previous classes (A) The simulated CPU contains 3 registers o Program counter (PC): stores the memory address of the next instruction to execute o Instruction register (IR): stores the current instruction to execute o Accumulator (ACC): stores the temporary computational results A good way to organize your classes is to 1- Create a Register class that has a private attribute: int value, a constructor which mark] sets value to a given value, and basic setter and getter methods for value 2- Create three classes PC, IR and ACC which inherit from Register. Here, we can say marks] that: [2 marks] A PC is a Register that can increment its value. (i.e. you needa method to increment value) [3 marks] An IR is a Register that can decode the instruction by the use of two methods: getOpCode which returns the "operation code" part of the instruction o o

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!