Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439

Computer Science Courses

COMP2100

Related sites

COMP 2100/2500/6442: Lab 8 - Code Review

One of the learning outcomes for this course is to make modifications (including source code design, implementation, and testing) within a moderate-sized Java program system (1000 - 10000 lines of code), given a documented specification, design and implementation of the system. Both the assignments partly address this learning outcome. However, effective code review of a sizable project is a crucial learning outcome which we aim to address in this lab session.

rPeANUt, a Java based project of about 4500 lines of code, is a simulation of a simple computer which is used in teaching Introduction to Computer Systems. As with many systems it began with a small focused code base. Initially, rPeANUt simply simulated a simple CPU using a GUI. However, over time its code base incrementally grew with a host of features and refinements. This is evident in the design and implementation. rPeANUt should not be seen as an ideal design/implementation, rather, it represents real-world software composed of both average and high quality components.

Pre-lab Tasks - Understanding rPeANUt [2 marks]

The pre-lab task involves downloading and running rPeANUt, gaining an understanding of the design and implementation, and then getting a more detailed understanding of the code that displays the register contents.

Setup rPeANUt by completing the following tasks:

Read over the code and answer the following questions (Answers can be hand written or typed):

Mini-test - Simple Modifications to rPeANUt [2 marks]

Guidelines

Your tutor will select one task at random from the three options below and ask you to complete it in the duration of the lab time. You may ask your tutor for a problem as soon as your pre-lab exercise is marked off. Start coding as soon as you are handed a task!

In order to attain full marks, your solution must be correct. Your tutor may also decide to award some marks for a good attempt, in case of an incorrect or unfinished solution.

Remember, this is an individual exercise and must not be attempted collaboratively. However, feel free to discuss solutions to these problems with your colleagues before you attend this lab session.

Currently, the CPU register values in rPeANUt are displayed as hexadecimal values.

Task 1

The instruction count displays the number of instructions that have been executed since a program starts running. It is located under the register displays.

The instruction profile counts are enabled by Profile in the Code menu and are shown in the memory display section of the interface. If you assemble and run a program such as:

0x0100 : load #4 R3         jump 0x0100

You should see these counts increase rapidly.

Hint: To format a number with comma separated 000's use: String.format("%,d",thenumber)

Task 2

Hints: To add such a label into the display follow the same approach as the Count: label. To work out the number of elements in main memory that are non-zero, add a method that loops through all the memory locations incrementing a counter for the locations that have values that are non-zero.

Task 3

The image below is a screenshot of rPeANUt with all 3 tasks implemented (remember you only need to do the one you are allocated during this mini test):

rPeANUT Screenshot

Updated:  20 May 2016 / Responsible Officer:   JavaScript must be enabled to display this email address. / Page Contact:   JavaScript must be enabled to display this email address. / Powered by: Snorkel 1.4

+61 2 6125 5111
The Australian National University, Canberra
CRICOS Provider : 00120C
ABN : 52 234 063 906