java编程作业代写代做、代做 Couple java程序作业、代写留学生java程序作业

时间:2022-05-22 21:56:34


SENG1110/SENG6110 Object Oriented Programming
Attention: use only Bluej to edit, compile, run and debug your programs. It will be very useful in the future in
SENG1110/6110 and subsequent courses to know how to use an IDE. The most important aspect is to know how to
debug a program using an IDE. You have seen a video about it in the last computer lab. Today you will have some tasks
involving debugging.
1. Download the codes Person.java, Couple.java and AgencyInterface.java from Blackboard. Listen the video. Now
follow the instructions below. Note that the instructions from a. to f. are the same from the previous tutorial. The
instruction g. will show you how to debug a program.
a. Execute Bluej. Just write bluej in the command line.
b. Open a new project:
i. select open from project menu
ii. write agencyExample (it will be created a folder agencyExample and all programs related to this
project will be inside the folder agencyExample)
c. Add each class from a file
i. Select add class from file from edit menu
ii. Select the file Person.java (repeat the process for Couple.java and AgencyInterface.java)
d. To edit your codes, just click twice in a class and the source code will open
e. To compile, just choose the compile menu.
f. To run the program
i. go to Bluej window (in AgencyInterface.java window – the class that has the method main).
ii. use the right button of the mouse and choose main(). Don’t worry about the other options now.
g. To debug the program
i. Select show debug from view menu
ii. Go to AgencyInterface.java and click in the left of the line System.out.print("her name: ");. A symbol
stop should appear. If does not appear is because you should go more to the left.
iii. Now run again as indicated in step f
iv. The program will run and stop in the line with the stop.
v. Now you can run each line clicking the Step or Step Into buttons and see the variables values in
debug window. The difference between these two buttons is Step Into will enter inside a method
and Step will not. Use Step Into and you will go inside each object.
vi. You can add more stops if necessary and you can delete a stop just clicking in the stop symbol.
vii. Note that during this process you can see the values inside the variables.
h. (you need to complete this exercise (only h.) and show, using BlueJ - debug, the result to your
demonstrator)
Add the following feature in the AgencyInterface class. The age needs to be greater or equal to 18. If age is
less than 18, the program will ask again, until the input is a number greaterhttp://www.5daixie.com/contents/9/1602.html of equal to 18. You should
implement a method called inputAge and call the method from main. The method will be as:
public static int inputAge()
{
// add the code here to receive an integer number as input and
// check if the number is greater or equal to 18
// if the number is less than 18, the program should ask the number again
// until the input number is greater or equal to 18
}
i. Debug the code from h (if you haven’t done yet) line by line and check the value of each variable using
BlueJ.
j. Add a method in Couple class called printCouple(). The method should return a String with the name and
age of each person. Call the method in AgencyInterface.

 

因为专业,所以值得信赖。如有需要,请加QQ99515681 或邮箱:99515681@qq.com 

微信:codinghelp