首页 > > 详细

Java辅导ArrayList、loop程序Programming Foundations辅导Java设计、Java编程辅导

Requirement
FIT9131 Programming Foundations
Week 6 Exercises
1
Homework checklist
To be up to date you should have completed the following:
 Tutorial exercises from weeks 1– 5.
 The complete code for the LuckyNumberGenerator class and the Player class for
your assignment.
 Read Chapters 1-4 of the text book, Objects First with Java, Barnes Kölling.
REMINDER :
You MUST ATTEND your tutorial next week, WEEK 7, to organise your
interview for Assignment 1 with your own tutor. If no interviews are
scheduled, no marks will be awarded to your assignment.
If you are an off-campus student, the interview appointments will be
made via emails.
You should show your assignment work to your tutor this week for
feedback/comments.
Exercises to work on in the tutorial
1. Create a class in BlueJ called Week6Q1, then add a method in it called
displayMenu() that prints the following menu to the screen and asks the user to
choose one of the options presented, as follows:
A. Option #A
B. Option #B
C. Option #C
D. Option #D
X. Exit!
Please enter your choice:
The method should do nothing else other than printing the menu.
2
2. Add a method to the Week6Q1 class in Q.1, and name it start(). In this method, make
a single call to displayMenu(), then use a Scanner object to accept an input from
the user. When the user enters an option (A/B/C/D/X) from the menu, in upper or lower
case, the program should print an appropriate message indicating which option has been
selected (e.g. “Option #A was selected”). There is no need to actually perform
any real action, apart from the printed message.
If the user enters an option other than those on the menu, an error message should be
printed.
Run the start() method several times to check that you have it working as required.
Hint : you need to use the if/switch statements in your code
3. Modify the start() method, this time adding in a loop so that the menu is displayed
repeatedly, until the last option is selected. When the last option is selected, exit the
start() method (ie. stop the loop).
Hint : you need to use a combination of the if/switch and for/while statements in
your code
The following exercises are from the text book. These will test and re-enforce your
understanding of the concepts covered in the week 5/6 lectures.
4. 4.1 (explore MusicOrganizer class the music-organizer-v1 project)
5. 4.2–4.11, 4.13 (using ArrayList methods)
6. 4.20-4.21 (for-each loop).
7. 4.30 4.32 (while loop)
Homework for this week
Finish the tutorial exercises for week 6.
Work on (and hopefully finish) the code for the Game class for your assignment.
Read chapter 6 (sections 6.1-6.5, and optionally 6.6-6.10) of the text book, Objects First with
Java, Barnes Kölling
Read chapter 7 (sections 7.1-7.4) of the text book, Objects First with Java, Barnes Kölling
- Do exercises 7.2-7.3, 7.7-7.8 (fixed-size Arrays)

 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!