In: Computer Science
1) Understand the problem
2) Develop and Describe an Algorithm
3) Test Algorithm with Simple Inputs
4) Translate the Algorithm into Java
5) Compile and Test Your Program
1) Understand the problem
A client (a person who wants a program developed) who owns a painting company has requested that you create a prototype program that calculates the cans of paint required to paint a wall based on surface area in square feet. Normally a staff member at the store interacts with the customer to ask for the amount of square feet to be painted as a whole number. The staff member then creates an order by noting the square feet, calculating the litres of paint and determining how many cans of paint will be needed. Paint is sold in whole cans only. Program outputs for an order are expected to be total square feet to be painted, litres of paint required, total whole cans of paint required. The program should output the name of the staff member processing the order. (For this assignment, this is you the student, your full name as in ACSIS).
The only paint that the company currently uses comes in 4 litre cans, and covers 400 square feet per can.
Write out briefly how you would do each step, as if you were the staff member.
Type this into your MS Word document as part of your submission.
2) Develop and Describe an Algorithm including Classes
Examine the problem statement and determine what objects, the properties of the objects, and behaviors would be required for an object oriented program, document their design using simple UML class diagrams.
Write pseudo-code as the basis of your algorithm, as well as create a flowchart. You should reference the lecture notes, as well as your textbook by Joyce Farrell [2] as references for this part of the assignment.
You should show object instantiation in the flowchart as variable declarations, then method calls to processing methods. Note, you are not required to document get/set accessor, mutator methods in your algorithm or flowchart.
You may hand-draw the flowchart and UML class diagram for this assignment instead of using software, just use a ruler and print legibly.
Alternatively a software program like MS PowerPoint, Office Libra Draw, or MS Visio can be used for flowchart while a software program like UMLet or MS Visio can be used to create the UML class diagrams.
Print your name on the paper diagram, or if using software place your name inside a square rectangle in the diagram.
If working on paper either scan the diagram into your computer, or use a cell phone to take a picture and email it to yourself Both your pseudocode and flowchart should be placed into your MS Word document, the pseudocode as text while the flowchart should be an image.
Note: The pseudocode and flowchart should document the exact same algorithm.
3) Test Algorithm with Simple Inputs
As per the lecture notes, use a table within your MS Word document to test the algorithm. Consider picking numbers that might be expected as input and work through the algorithm documenting expected outputs, you may use a calculator.
If there is a problem with the algorithm based on this desk-check correct the pseudocode and flowchart, UML class diagram(s) and repeat this step again. (You only need to turn in the final table, no need to document all of your troubleshooting here.
4) Translate the Algorithm into Java
You are to use the Eclipse IDE to create your Java program, use a project name like Assignment 02.
Don’t forget to comment your code files, with the expected code header.
Copy and paste your program source code file(s) into your MS Word document.
Tip: Use a monospaced font, where every character has the same width on screen, to format your code, recommended settings: Font-face Consolas, Font-size 10pt
5a) Compile and Run Your Program
Compile and run your program, using your documented test values.
Take a screen shot of Command prompt window, or a rectangular selection of the Eclipse Console View depending on your development environment, ensure your name as output by the program is captured in the image.
5b) Test Your Program
Re-use your testing table from step 3 in this section, but document what the program outputs are, do they match expectations?
Test with some invalid inputs, and document what happens. Note that some input will crash your program, this is okay as you may not know how to fix this at this point in the course. Document what the error messages are in your test plan.
Suggested invalid tests: enter a String instead of a number, enter a negative numbers for the input, what happens if the number is too large for the data type you use to store numerical input?
Microsoft Word Document Format
See the template example, suggested headings below:
1) Understand the problem
Brief paragraph
2) Develop and Describe an Algorithm
UML class diagrams, Pseudocode, Flowchart
3) Test Algorithm with Simple Inputs
Test plan as table
4) Translate the Algorithm into Java
Program source code, with programmer comments.
5) Compile and Test Your Program
Screen shot of running program with student name as output
1.understand the problem
here initially we have to take total no of square feet to be painted from the customer .then calculate the total no of cans required from the given information i.e, we use cans =squarefeet / 400 .after that we have to print the total cans required . Now from the total cans calculate paint in liters using the formula paint =cans*4. print the paint required.
2.Flowchart:
flowchart:
3.Test algorithm
1.read the total square feet of the room from the customer
2.print the total square feet
3.calculate the total number of cans
3a.cans=squarefeet/400
4 print total cans required
5 calculate the paint required
5a.paint =cans*4
6.print paint
7.end
4 Translate the algorithm into java
here in the following code sf means total square feet,c means total cans pl means paint in liters.
5.compile and test your program