Java程序辅导

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

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
 
CS 1301 
Lab 9 
 
Working with Methods – Chapter 6 
 
 
Use JGrasp to develop a complete program for each exercise to include a main method and the specified 
method(s) in the problem statement. Notice that the main method is used to test the specified method(s). 
 
 
Exercise 1: Design and implement a Java program for programming exercise 6.2, page 234 (name it 
SumDigits), to computer the sum of digits in an integer number. Follow the instructions in the problem 
statement. Design the main method of your program such that it allows the user to re-run the program with 
different inputs (i.e., use a loop structure). Document your code and organize the outputs properly using escape 
characters. 
 
 
Exercise 2: Design and implement a Java program for programming exercise 6.6, page 235 (name it 
DisplayPattern), to display a pattern of numbers as specified in the problem statement. Follow the 
instructions in the problem statement. Design the main method of your program such that it allows the user to 
re-run the program with different inputs (i.e., use a loop structure). Document your code and organize the 
outputs properly using escape characters. 
 
 
Exercise 3: Design and implement a Java program for programming exercise 6.12, page 237 (name it 
DisplayCharacters), to display a sequence of characters with a specified number of characters per line. 
Follow the instructions in the problem statement. Design the main method of your program as specified in the 
problem statement. Document your code and organize the outputs properly using escape characters and 
formatting objects when applicable. 
 
 
Exercise 4: Design and implement a Java program for programming exercise 6.23, page 238 (name it 
Occurrences), to find the number of occurrences of a letter in a given string. Follow the instructions in the 
problem statement. Design the main method of your program such that it allows the user to re-run the program 
with different input strings (i.e., use a loop structure). Document your code and organize the outputs properly 
using escape characters. 
 
 
 
Instructions: 
 
1.  Programs must be working correctly. 
2.  Programs must be completed and checked before working assignment #9. 
3.  Programs must be checked by the end of the designated lab session. 
 
 
 
 
 
Page 1 of 1