Java程序辅导

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

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
 
CS 1301 – Spring 2016 
Lab 13 
 
Working with Classes and Objects – Chapter 9 
 
 
Use JGrasp to design and implement the following programs provided in Chapter 9 in the textbook. Understand 
what they do. 
 
 
Exercise 1:  
 
1. Type and compile, and run listing 9.11, page 352 (file TotalArea.java). Notice that you are working with 
an array of circle objects. 
 
2. Now, modify the program by adding a new method that takes the array of circles and determines the 
smallest and largest circles in the array and prints out their information. Use the following header for this 
method: 
 
Public static void minMax(CircleWithPrivateDataFields[] circleArray) 
 
      The method should print out: 
 
The smallest circle has radius = 3 
The largest circle has radius  = 150 
 
Save all files in the same folder. 
 
 
Exercise 2:  Following the instructions in the problem statement, design and implement a Java program for 
programming exercise 9.2, page 360 (name it Stock.java).  Next, develop a test program in a separate file 
(call it TestStock.java) to create object ORCL as stated in the problem statement.  
 
Now, modify the test program to create 2 more stock objects (say MS and Google) and test all class methods on 
these 2 objects in logical order and display meaningful information after each method call. Document your code, 
and organize and space the outputs properly. Use escape characters and formatting objects when applicable. 
 
 
Exercise 3:  Following the instructions in the problem statement, design and implement a Java program for 
programming exercise 9.10, page 363 (name it QuadraticEquation.java).  Next, develop a test program in 
a separate file (call it TestQuadraticEquation.java) as instructed in the problem statement. 
 
 
Submission: 
 
1.  Save all programs. 
2.  Check with your instructor for submission instructions. 
 
 
Page 1 of 1