Question

In: Computer Science

1) Understand the problem 2) Develop and Describe an Algorithm 3) Test Algorithm with Simple Inputs...

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

Solutions

Expert Solution

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


Related Solutions

Develop a Java program for this problem where the user inputs an Earth age and the...
Develop a Java program for this problem where the user inputs an Earth age and the program will then display the age on Mercury, Venus, Jupiter, and Saturn. The values for d are listed in the table. Planet d = Approximate Number of Earth Days for This Planet to Travel Around the Sun Mercury 88 Venus 225 Jupiter 4380 Saturn 10767
1. What is A-Star (A*) Algorithm in Artificial Intelligence? 2. A* Algorithm Steps 3. Why is...
1. What is A-Star (A*) Algorithm in Artificial Intelligence? 2. A* Algorithm Steps 3. Why is A* Search Algorithm Preferred? 4. A* and Its Basic Concepts 5. What is a Heuristic Function? 6. Admissibility of the Heuristic Function 7. Consistency of the Heuristic Function 8. Find an Implementation in Java, C or Python just choose in which programming language you prefer only select one.
Problem Description:A very simple algorithm (Luhn Algorithm) to check whether a credit card number is valid...
Problem Description:A very simple algorithm (Luhn Algorithm) to check whether a credit card number is valid is shown below:We assume that there are 16 digits in a credit card number.Start from the first digit of the credit card number as in position 1; second digit as in position 2; so on until the last digit as in position 16;If a digit is in even numbered position, take the digit itself as its representative;If a digit is in odd numbered position,...
Intelligent Agents 1. What is A-Star (A*) Algorithm in Artificial Intelligence? 2. A* Algorithm Steps 3....
Intelligent Agents 1. What is A-Star (A*) Algorithm in Artificial Intelligence? 2. A* Algorithm Steps 3. Why is A* Search Algorithm Preferred? 4. A* and Its Basic Concepts 5. What is a Heuristic Function? 6. Admissibility of the Heuristic Function 7. Consistency of the Heuristic Function 8. Find an Implementation in Java, C or Python just choose in which programming language you prefer only select one.
Develop an algorithm and a  flowchart for the following: Problem Specification:      Jennifer Camacho It’s the owner...
Develop an algorithm and a  flowchart for the following: Problem Specification:      Jennifer Camacho It’s the owner of Amazing Toyota, a company that sells this type of cars in Puerto Rico. She wants a program that displays the amount of salespersons commission. Some companies use a fixed rate to calculate the commission, while others (like Amazing Toyota) use a rate that varies with the amount of sales. If The salesperson sales $15,000 in one moth his commission will be a 2...
simple hypothesis test please be clear with algorithm The United States and Japan often engage in...
simple hypothesis test please be clear with algorithm The United States and Japan often engage in intense trade negotiations. U.S. officials claim that Japanese manufacturers price their goods higher in Japan than in the United States, in effect subsidizing the low prices in the United States with extremely high prices in Japan. According to the U.S. argument, Japanese manufactures accomplish this by preventing U.S. good from reaching the market. An economist decides to test the hypothesis that higher retail prices...
Problem 3 (4+2+2 marks). (a) Implement the following algorithm, which is given a duplicate-free array array...
Problem 3 (4+2+2 marks). (a) Implement the following algorithm, which is given a duplicate-free array array as input, in C++. whatDoIDo (array): 1) Build a heap from array (using buildHeap as explained in class), where the heap starts at position array[0]. 2) Starting from j = size of array - 1, as long as j>0: i. Swap the entries array[0] and array[j]. ii. Percolate down array[0], but only within the subarray array[0..j-1]. iii. Decrement j by 1. Provide three input/output...
Describe an efficient recursive algorithm for solving the element uniqueness problem
Describe an efficient recursive algorithm for solving the element uniqueness problem, which runs in time that is at most O(n2) in the worst case without using sorting.    
1. What is the purpose of Rete algorithm? Describe how it works. 2. What is a...
1. What is the purpose of Rete algorithm? Describe how it works. 2. What is a linearly separable classification problem? Give one example that is not linearly separable.
Problem 1: (10 marks) ALGORITHM COMPLEXITY:Write an algorithm (pseudocode but not a program) that takes a...
Problem 1: ALGORITHM COMPLEXITY:Write an algorithm (pseudocode but not a program) that takes a positive numberias an input, where i=a1a2...an,n>=3(numberwith 3 or more digits, every digit can have the value between 0 and 9–both inclusive). The algorithm should find the largest number jsuch that j=b1..bm, 1<=m<=n(numberwith m digits),andevery bk<=bk+1where1<=k<m and bk,bk+1ε{a1, a2, an}.Also, perform the computational complexity (time complexity)analysis of your algorithm and write the algorithm complexity in Big-Oh notation. Examples:Input: 23720, Output: 237Input: 9871, Output: 9Input: 1789, Output:1789Input: 2372891,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT