[Solved] SWEN221 Lab 1-Java programming skills using Eclipse

$25

File Name: SWEN221_Lab_1_Java_programming_skills_using_Eclipse.zip
File Size: 480.42 KB

SKU: [Solved] SWEN221 Lab 1-Java programming skills using Eclipse Category: Tag:
5/5 - (1 vote)

The purpose of this lab is to refresh your Java programming skills, to get started using Eclipse and to learn how to use the online submission system.

Activity 1: Diagnostic Test (approx 50mins)

(See separate test sheet)

Activity 2: Getting Started with Eclipse (approx 15mins)

To begin, download the calculator.jar program from the lecture schedule on the SWEN221 course website. Now, perform the following steps:

  1. Start Eclipse and create a project called Calculator:
  2. Import the jar file into your Calculator project. Do this by selecting FileImport GeneralArchive File from the menu:

Select the jar file in the Import dialog, and the set the Into folder field to be Calculator/src and click Finished.

  1. Add JUnit library to your project. Do this by right-clicking on the project and selecting Build PathAdd Libraries JUnitJUnit 5/Jupiter from the menu:

Your project should now compile without errors.

NOTE: if you cannot find the Build Path menu, then you should check that you are in the Java perspective, rather than the Java EE perspective:

  1. Run the calculator program from Eclipse by creating a Run Configuration. One way to do this is by right-clicking on Main and selecting Run AsJava Application:

You should see the calculator running in the console window:

  1. You can now perform simple calculations, like with a normal calculator. For example:

Welcome to the Calculator!

> 1.0+1.23

= 2.23

> 1+2.0

Found +, expected .: 1+2.0

^

java.lang.RuntimeException: Parse Error at swen221.lab1.Calculator.error(Calculator.java:144) at swen221.lab1.Calculator.match(Calculator.java:115)

Spend some time using the calculator to get the hang of it; you might notice that there are several bugs in the system (as illustrated above).

Activity 3: Debugging the Calculator (approx 45min)

Your next task is to debug the program. To get started, run the JUnit tests provided (by right-clicking on CalculatorTests, and selecting Run AsJUnit Test):

Several of the tests will fail and youll need to fix the bugs to make them pass correctly.

HINT: Simply eyeballing the code (i.e. staring at it) will probably not help you find the bug! You must insert println statements to see what is actually going on, and to narrow down the problem.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SWEN221 Lab 1-Java programming skills using Eclipse[Solved] SWEN221 Lab 1-Java programming skills using Eclipse
$25