Java程序辅导

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

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
  Western Oregon University       Page 1 of 3 
CS-161 Pre-Lab #8 
General 
At the top of the every document that you create (word processing files or source 
files) include: 
/** 
 * Description of the class or document.  
 *  
 * @author YOUR NAME 
 * @version CS161 Lab #, mm/dd/yyyy (replace with the last edit date)  
*/ 
 
The primary purpose of each pre-lab is to help you prepare to be an active 
participant during the lab sessions, and to be ready to discuss and understand the 
material presented in lectures. This is why late submissions are NOT accepted as that 
defeats the primary purpose of the prelab. However, as these are done prior to class 
discussions, PRE-LABS are not graded on correctness of your answers, but on 
whether you have shown a reasonable attempt at investigating and trying to solve 
the problem. 
  
Please feel free to bring up questions during your lecture class about material in the 
prelabs that you don’t understand or where not able to complete correctly.  We will 
devote some of the lecture time to answering these questions. Prelabs are part of a 
flipped classroom model where you are responsible for studying and learning the 
majority of the easier to understand material so that we can focus on the more 
difficult concepts during the lecture time that is available. 
 
Prelabs are NOT collaborative assignments; they are to be done individually. 
Academic plagiarism policies apply and are enforced.  
 
Concepts 
The purpose of this pre-lab is to expand your experience with writing Java source 
code and to prepare you for lab 8.  
 
Background 
Read through the end of Chapter #6 in your text.  Use the online tutorials (refer to 
the class web site) to get any further clarifications that you may need after reading 
the chapter material. 
 
Assignment Instructions 
This lab is designed to get you started on your final project. Before you begin you 
should read chapter six, focusing on responsibility-driven design. To complete this 
pre-lab you will need to start designing your final project in the following way: 
 
1. Read the final assignment. 
2. Using the four classes outlined in the assignment determine what attributes 
each class will have.  Have a clear idea of which classes use objects of other 
classes.  
3. Design how objects of each class will behave; this is what their 
responsibilities are, which will ultimately be what methods they will have. 
4. DO NOT WRITE ANY CODE AT THIS POINT. 
I also STRONGLY suggest you walk through the exercises at the beginning of Chapter 
13, pages 461 – 468, to help get a starting place for the design process. You should 
  Western Oregon University       Page 2 of 3 
CS-161 Pre-Lab #8 
also read chapter 14 for additional information on how to design an application. This 
chapter contains exercises that will enable you to complete this assignment in less 
time than trying to figure it out on your own. 
 
You should submit your document in a structured format that may look something 
like the outline for the products lab from chapter 4 on the next page.  The outline 
should simple list the name of each class, under that list the attributes (this can 
include objects of another class in the project), then figure out what you want each 
class to do. There is no need to over complicate this. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
StockManager 
1. set up a demo of StockManager 
2. show details of a given product if 
it is in the StockManager  
3. sell a product from the 
StockManager object  and adjust 
the inventory 
4. get a product from the 
StockManager object 
5. get the StockManager object 
StockDemo 
ArrayList 
1. add a Product to the list 
2. take delivery of a Product increase 
the amount in inventory 
3. find a Product in the list  
4. find out the number of a specific 
product in stock  
5. print details of products 
 
StockManager 
int id 
String name 
int quantity 
1. get the id number of a Product 
2. get the name of a Product 
3. get the quantity of a Product 
4. receive a delivery increasing the 
quantity of a Product 
5. sell a Product decreasing the 
quantity of the Product 
Product 
  Western Oregon University       Page 3 of 3 
CS-161 Pre-Lab #8 
Submission Instructions 
Submit in this prelab via Moodle using the “PreLab #” link. Your assignment MUST be 
uploaded by the assignment due date and time (see Moodle for the time), no 
exceptions or extensions of time are given. Partial credit is given, so submit however 
much of the prelab that you have completed by the due time otherwise both the 
prelab and lab will receive a 0 grade for the week. Moodle will automatically close the 
link at that time.   
 
It is highly recommend you do not wait until the very last minute to submit your 
work. 
 
ALL PRE-LABS are to be submitted as a SINGLE document in PDF format. 
Most modern word processors can now generate a PDF file or you can download free 
utilities to do the conversion (CutePDF for pc’s). Any submissions in any other format 
will not be graded and will not receive credit. 
 
Type your answers when appropriate, or if diagrams are needed you may scan them 
or take a picture and then paste the picture into the document.  For coding 
questions, take one or more screen shots that show the code that you modified or 
created; and take screen shots of the run of your programs showing the outputs.  
Paste anything into your document that demonstrates your investigation and work 
on each of the questions. 
 
In your submission, please mark each of your answers/investigation with the 
question number clearly shown.  Order the questions/answers in your PDF document 
in the same order that they are assigned in the prelab.  If you do not do this, you 
may not get credit for some of your work.