Create a new project and add a class Code

Assignment Help JAVA Programming
Reference no: EM132238867

Homework - Bar Codes

Description - The Zone Improvement Plan (ZIP) Code is used by the Postal Service to efficiently deliver mail. For this assignment, we will only consider the first iteration, 5-digit zip code. The zip code can be encoded into a bar code like the one in attached file.

The bar code consists of groups of 5 symbols. Each 5-symbol group represents a number. The bar code has 32 symbols, so it represents a 6-digit number demarcated by a starting | and a closing |. The six digits represent the 5-dight zip code and the check digit which is always placed at the end. Consider the example above. The first symbol | is ignored, as is the last. So, the first five symbols are three half-bars followed by two full-bars. We can write it like - :::|| where the colon (:) is the half-bar and the pipe (|) is the full-bar. The symbol (:::||) represents the number 1. The table below shows the representation for each number.

Digit

Bar 1

Bar 2

Bar 3

Bar 4

Bar 5

1

0

0

0

1

1

2

0

0

1

0

1

3

0

0

1

1

0

4

0

1

0

0

1

5

0

1

0

1

0

6

0

1

1

0

0

7

1

0

0

0

1

8

1

0

0

1

0

9

1

0

1

0

0

0

1

1

0

0

0

Note, the 0 represents the half-bar colon (:) and the 1 is the full-bar pipe (|).

As you can see the symbol :::|| would match the digit 1.

To calculate the check digit, sum all digits of the 5-digit code and choose a check digit which would make the sum a multiple of 10.

Specifications - You will need to complete the following:

1. Create a new project and add a class Code.

2. You will allow the user to select one of two options:

a. Decode a bar code

b. Encode a zip code

3. If the user chooses to decode a bar code

a. Prompt the user for the bar code - 32 chars long with colons (:) for half-bars and pipes (|) for full bars. Remember 5 symbols per digit with a check digit and the demarcating full-bars.

b. Display the decoded bar code as the 5-digit zip code and separately the check digit. Also, display if the zip code is correct. Does the check digit match what is should be?

4. If the user chooses to encode a zip code

a. Prompt the user for the 5-digit zip code (as an integer) and display the full bar code with the demarcating full-bars and the check digit (all 32 chars).

b. Also, display the calculated check digit showing the math is correct - Consider something like:

Sum of digits is 14.

14 + 6 = 20

Therefore, the check digit is 6.

5. DO NOT assume the user will enter valid data. When asking for a zip code, be sure to check it is a positive integer value. When asking for the bar code, be sure it is only 32 chars long and only contains the colon and pipe symbols.

6. You will need to create the following methods to solve the problem. Each method must be implemented.

a. int getInteger(String prompt) // get an integer from the user using the given prompt.

b. int getInteger(String prompt, int min, int max) // get an integer from the user with the given prompt within the given range - min and max inclusive.

c. String encodeDigit(int digit) // given a digit get the symbol for that digit, example 1 would return :::||

d. String encodeZipCode(int zipCode) // given the zip code, return the entire bar code for the zip code - should be 32 chars long.

e. int decodeSymbol(String symbol) // given a symbol like :::||, return the integer value. So :::|| should return 1.

f. int decodeBarCode(String barCode) // given the entire bar code, return the 5- digit bar code.

g. int sumDigits(int number) // given a number, return the sum of the digits.

h. int getCheckDigit(int sum) // given a sum, return the check digit for that sum.

i. Int getCheckDigit(String barCode) // given a full bar code, return the check digit.

7. Do not forget the Javadoc

Documentation - You will create one document.

A text document (.docx, .rtf, .pdf) which contains the following:

Your name and assignment.

A screenshot of your code output for three different test runs of each option: encode and decode. These are your main test cases.

You will also need to show each method works as expected. These are method test cases. Write code that tests each method and shows they work as expected. Each method needs three test cases. Show a screenshot of the method test cases.

You also need to explain in detail the following:

  • What is the importance of writing your own JavaDoc?
  • Explain the parts of each JavaDoc block.
  • What is method overloading? What abstract programming concept does it represent?

Remember to be specific in your responses.

Attachment:- Assignment File.rar

Reference no: EM132238867

Questions Cloud

Do you think that the act is reasonable or unreasonable : Do you think that the Act is reasonable or unreasonable? Why or why not? Do you believe that this will increase the financial burden that many hospitals.
Write a brief description of the proposed strategy : For this assignment, you will complete a TOWS matrix and portfolio analysis, and use any other appropriate analysis tools, to determine alternative strategies.
Address what you find innovative about the link : Identify one of the resources at the CDC Wonder site above and describe how a nurse might use this information in practice. Address what you find innovative.
Developing recommendations for a team charter : In 3-5 pages, develop recommendations for a team charter and provide communication and collaboration strategies for a new interprofessional team.
Create a new project and add a class Code : For this assignment, we will only consider the first iteration, 5-digit zip code. Create a new project and add a class Code
Was gerry negligent when he hit the golf ball that injured : Can Patty be legally fired from her job for making negative comments about her boss and her company on social media?
Analysis of the organizational efficiency : The new CEO has selected your consulting firm to give him/her an analysis of the organizational efficiency.
How goals get you to where you want to be counterpoints : How Goals get you to where you want to be Counterpoints? Is Disagreement About Goal - Advantage And Disadvantage Of Goal I am also attaching file
How will you explain the benefits of the policy to them : Name the key stakeholders you will consult when developing the policy. How will you explain the benefits of the policy to them?

Reviews

len2238867

2/20/2019 11:56:23 PM

You will create one document. A text document (.docx, .rtf, .pdf) which contains the following: Your name and assignment. A screenshot of your code output. You will also need to show each method works as expected. Remember to be specific in your responses. What to Submit - You need to submit your Java file along with your document. Make sure your documents are in the correct format and all your files include your name and assignment. DO NOT zip your files. NOTE – DO NOT manipulate the zip code integers as a string. Make sure you accept the zip code as an integer and parse it as an integer. Hint – use a combination of the mod (%) and / operator to pull the zip code apart. You should not be converting the integer to a string to manipulate it, keep it as an integer.

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd