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

  Display a welcome message to your user

Write a one screen description of your initial reactions to Java. Reactions may be both positive and negative. At the end of this module you will be asked to write a reply to these initial reactions.

  Create console based java program that displays hello world

Create a console based, non-GUI Java program using NetBeans Integrated Development Environment (IDE) that displays Hello world!

  Write the flow of execution of application

Write the flow of execution of application step by step and briefly explain the functionality of each function being called (like the first step would be to instantiate Frame and then instantiate Panel and place it into the Frame).

  Your task for this project is to design a program to help a

your task for this project is to design a program to help a videorental store operatorrecord clients transactions. the

  Program for exploring various ICT Careers

ICT221 Java Programming Assignment - Your task is to build an interactive graphical program for exploring various ICT Careers

  How would one of these be used in a database

Tables, instances, rows, columns, fields, result sets, triggers, stored procedures, and blobs. These are common to many databases.

  Define two different physical representations for strings

Define an ADT for character strings. Your ADT should consist of typical functions that can be performed on strings, with each function defined in terms of its input and output. Then define two different physical representations for strings.

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

  Write a program that reads in a text file and then computes

Write a program that reads in a text file and then computes and prints a table of letter frequencies. For example, if the file is the text of "A Tale of Two Cities", found in the file at data/tales.txt , the program will print

  Can we run java byte code on android since android

Can we run java byte code on android since android is also java based

  Find a path from a source vertex to the destination vertex

Find a path from a source vertex to the destination vertex in a graph. Start the search by making the current vertex the source vertex.

  Inheritancedemo

Create a New Project named InheritanceDemo . 2. Create a new class called Person and cut and paste the Person.java file from Blackboard into the class. Create a new class called Student and cut and paste the Student.java file from Blackboard into the..

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