Question: The project name of this exercise is NumbersLoop. The purpose of this assignment is to learn how to create and use loops. Additionally, you get

The project name of this exercise is NumbersLoop.
The purpose of this assignment is to learn how to create and use loops. Additionally, you get more practice on how to write all of your own code and Javadoc comments.
Problem Description
First you will need to import the project template we have been using in previous labs. Then add a new class called Program that includes the main() function and another class called NumbersLoop.
In the NumbersLoop create a function setLowerLimit() which should set the value of an instance variable called lowerLimit (of type int).
Then create another function also in NumbersLoop called setUpperLimit(). It is similar to lowerLimit but it sets the value of another instance variable called upperLimit (of type int).
Finally create a function called addLowerAllTheWayToUpper() that runs a loop to add all the numbers between lowerLimit and upperLimit (including both numbers) then return the result. For example if lowerLimit was set to 1 and upperLimit was set to 10. The function should return 55 (which is 1+2+3+4+5+6+7+8+9+10).
Your Program.java should contain code to test your NumbersLoop object.
Once you've written your code run the code by single clicking on Program.java in the package explorer and selecting Run->Run from the menu or using the keyboard shortcut. Examine the output.

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!