ISM3230 In-class lab Module 3 – Working with Strings and String Methods Spring 2021TASKYou are working for a farm corporation that serves as a major supplier of lettuce to the US andinternational markets. The corporation owns a large number of fields spread across a large number offarm locations in the lettuce-growing region.You are helping to build a system tracking the origin of lettuce back to the field where it was grownacross the many farm locations and fields where the corporation grows lettuce. This system will not onlyhelp with planning and forecasting, but will also allow for tracking food-borne illness for public healthpurposes. Your task involves transforming data about each head of lettuce into an intermediary codethat is later sent into a bar code generator, to be included on the packaging. The inputs to your programwill eventually be supplied by other systems, but for testing purposes you will let the user enter the datafrom the keyboard.There are three input strings. These strings come in formats produced by other systems; these formatscannot be changed. The input strings and their formats are as follows:• The variety of lettuce. This could be any word or sequence of words. Variety names areguaranteed to be at least 4 letters long. Variety examples are: “romaine”, “RUBY Loose Leaf”,“Cimmaron”, “BIBB”, “Tom Thumb”, etc.• The location ID within the corporation. This ID consists of a number that represents the farm ID,followed by the word “id” in any case, followed by a number that represents the field ID. Forexample, “54id4”, “9083ID451”, “8Id30” are three examples of location IDs.• The harvest date of the lettuce. This comes in a format of day/month, where day is a numberbetween 0 and 31 and month is a full name of the month in any capitalization (February, July,etc.) Examples of production dates are: “1/February”, “15/MARCH”, “31/december”. The twoparts of the date string are separated by a ‘/’ character. There are no spaces allowed in theproduction date string. Note that the day may be one or two characters long and the month canhave any capitalization.The output of the program is a string code that can later be used to generate a bar code for thepackaging. It consists of some parts of each of the inputs. The code has the following format:VVV-Mm-fieldID-farmID• VVV holds the first three letters of the variety in uppercase• Mm encodes the first and last letters of the month, with the first letter in uppercase and the lastletter in lowercase• fieldID that is the second set of digits in the location ID• farmID that is the first set of digits in the location ID• all subparts of the code are separated with a hyphen (minus sign) “-”As input, let the user enter strings for the variety, location ID, and harvest date, assuming the formattingdescribed above.As output, print the formatted barcode sequence.1. Create a new NetBeans project called yourname_Lab3.2. Prompt user to enter the variety. Use Scanner’s method nextLine() to read the variety into aString variable. You must read the variety into one variable even if it contains multiple words.o Do not use next() method.3. Prompt user to enter the location ID. Use Scanner’s method nextLine() to read the wholelocation code string into a single String variable.o Do not simplify this lab by taking separate user inputs for farmID and fieldID.4. Prompt user to enter harvest date. Use Scanner’s method nextLine() to read the whole datestring into a single String variable.o Do not simplify this lab by taking separate user inputs for date and month.5. Checkpoint 1: Print out all the user input variables. Make sure that you have 3 variables thathold the data, and that they are appropriately named. They are all String types. For example:6. Create the pieces of the bar code by extracting various elements of data from the inputs andstoring them in appropriately-typed variables. Store individual pieces in separate variables withnames indicating what data they hold.o A summary of helpful string manipulation methods is provided below. Your task is tofigure out how to use those methods to achieve the goal set out in this lab.o HINT: you may need to use a combination of methods to find and extract each of thebarcode data elements required in this lab.7. Checkpoints: You should work on each part separately and print out the part of the code to thescreen. You may find it useful to print out even subparts of the individual code parts. Forexample, when finding the first and last letters of the month, one approach is to extract thewhole month into a separate variable. Printing the position of the slash and then printing themonth string would be a good idea to check that it is correctly extracted:Another example is the variety code. Print it out when you obtain the 3 letters and again whenyou convert them to uppercase:8. Finally, concatenate together all pieces to form the final code, and store the final barcode in onestring variable.9. Print the code to the screen.10. Make sure that your prompts and output follow the examples in the sample output, includingwording, spacing, and punctuation.11. When your code is working, upload your .java file to the Lab 3 dropbox.String manipulation methodsMethod Return TypeDescriptionconcat(String str) String Concatenates the specified string to the end of this string.indexOf(String str) int Returns the index within this string of the first occurrence of the specified substring.indexOf(String str, int fromIndex) int Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.lastIndexOf(String str) int Returns the index within this string of the last occurrence of the specified substring.length() int Returns the length of this string.substring(int beginIndex) String Returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string.substring(int beginIndex, int endIndex) String Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex – 1.toUpperCase() String Converts all of the characters in this String to upper case.toLowerCase() String Converts all of the characters in this String to lower case.SAMPLE OUTPUT
Approximate price: $22
We value our customers and so we ensure that what we do is 100% original..
With us you are guaranteed of quality work done by our qualified experts.Your information and everything that you do with us is kept completely confidential.You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.The Product ordered is guaranteed to be original. Orders are checked by the most advanced anti-plagiarism software in the market to assure that the Product is 100% original. The Company has a zero tolerance policy for plagiarism.The Free Revision policy is a courtesy service that the Company provides to help ensure Customer’s total satisfaction with the completed Order. To receive free revision the Company requires that the Customer provide the request within fourteen (14) days from the first completion date and within a period of thirty (30) days for dissertations.The Company is committed to protect the privacy of the Customer and it will never resell or share any of Customer’s personal information, including credit card data, with any third party. All the online transactions are processed through the secure and reliable online payment systems.By placing an order with us, you agree to the service we provide. We will endear to do all that it takes to deliver a comprehensive paper as per your requirements. We also count on your cooperation to ensure that we deliver on this mandate.
Basic Java Coding essay
Never use plagiarized sources. Get Your Original Essay on
Basic Java Coding essay
Hire Professionals Just from $11/Page