CS139
PA5 – BestWraps

Objectives

The following skills are addressed in completing this assignment.

Deliverables

This assignment requires you to modify and submit a program. You will submit this in 2 stages. The first milestone is due by 11:59 on Thursday, Nov. 21 by 11:59. For the first milestone, you should submit the following java files: StoreRoom.java, Box.java and WrappingPaper.java. You should bundle the three (3) java files into a single zip file and submit via WebCAT.

The completed program must be submitted to WebCAT by 11:59pm on Thursday, December 5.  You should bundle the six (6) java files into a single zip file and submit via WebCAT.

Specification

In this assignment, you will design and implement a program that populates a Store Room with wrapping paper of varying sizes and that allows boxes of varying sizes to be wrapped. Your program must be built using the following five classes:

 Each piece of wrapping paper is identified by its dimensions (length and width). In order to wrap a box, you must know the dimensions of the box to be wrapped in order to determine which piece of wrapping paper in the store room is the "best" piece of wrapping paper to use. The "best" piece of wrapping paper is the one with the smallest area that is large enough to wrap the box that is presented.

To calculate the size of paper needed, you will need to regularize the box dimensions. That is, the length should be the longest side, the depth should be the shortest side, and the width should the median size (no matter how the user may have entered it). Note: all dimensions are in inches. For the first dimension of the paper, add the width + the depth and multiply the total by 2. Add to this 2 inches. For the other dimension, add the length + two times the depth. You will be looking for the smallest sheet of wrapping paper (measured by area) that will accommodate the dimensions calculated.

You should present a welcome message to the user, followed by a blank line, followed by a menu. The menu will consist of 3 options followed by a prompt (-> ) [note the space after the prompt):

Program Behavior

Your program should begin by printing the following menu:

CS139 Wrapping Paper Storeroom
	 
	1. Add paper to storeroom
	2. Wrap box 
	3. Quit
	->
	

In addition to the above, your program must conform to the following requirements:

[blank line here]
	Length
	Width
	
[blank line here]
	Paper added (50x24)
	[blank line here]
	
[blank line here]
	Unable to add. Warehouse is full.
	Press ENTER to continue . . .
	[blank line here]
[blank line here]
	Length: 
	Width: 
	Depth:
	
[blank line here]
	For the box 10x12x7:
	No wrapping paper available.
	Press ENTER to continue . . .
	[blank line here]
	
[blank line here]
	For the box 10x12x7:
	Paper from slot 14: 42x26.
	Press ENTER to continue . . .
	[blank line here]
	
[blank line here]
	Goodbye.
	[blank line here]
	

Validation

[blank line here]
	Must be a number between 1 and 3. Please re-enter.
	->
	
[blank line here]
	Must be greater than 0. Please re-enter.
	->
	

Optional

Sample Output

CS139 Wrapping Paper Storeroom
	 
	1. Add paper to storeroom
	2. Wrap box 
	3. Quit
	-> 1
	 
	Length: 50
	Width: 24
	 
	Paper added (50x24)
	 
	CS139 Wrapping Paper Storeroom
	 
	1. Add paper to storeroom
	2. Wrap box 
	3. Quit
	-> 4
	 
	Must be a number between 1 and 3. Please re-enter.
	-> 1
	 
	Length: -3
	 
	Must be greater than 0. Please re-enter.
	-> 33
	 
	Width: 13
	 
	CS139 Wrapping Paper Storeroom
	 
	1. Add paper to storeroom
	2. Wrap box 
	3. Quit
	-> 2
	 
	Box Length: 45
	Box Width: 6
	Box Depth: 30
	 
	For the box 45x30x6:
	No wrapping paper available
	Press ENTER to continue . . .
	 
	CS139 Wrapping Paper Storeroom
	 
	1. Add paper to storeroom
	2. Wrap box 
	3. Quit
	-> 2
	 
	Box Length: 6
	Box Width: 10
	Box Depth: 12
	 
	For the box 12x10x6:
	Paper from slot 1: 50x24.
	Press ENTER to continue . . .
	 
	CS139 Wrapping Paper Storeroom
	 
	1. Add paper to storeroom
	2. Wrap box 
	3. Quit
	-> 3
	 
	Goodbye
	

 

Honor Code

 

This work must conform to the JMU Honor Code and the specific requirements of this class. NO help may be provided by another student to another student. Authorized help is limited to your textbook, the TA’s for any CS139 section, and the professor for your section. You may work with a single Partner as long as you both are working together. If you work as a pair, you should submit one version of your joint program to WebCAT. Divide and conquer is not the way to produce quality code. At the same time, make sure that there is an equal sharing of both roles. It is important that both partners understand what is going on in the program. You may not receive help from any other students in the class or outside of the class. 

Grading

Hints