Programming Assignment 3 @ 2022 Dr. Robert Castañeda 1 IS 2063 Programming Lang II with Java Programming Assignment # 3 100 points Due date August 5, 2022 On your flash drive, laptop, or on your home...

1 answer below »
Complete the programming assignment please, all together, one code in java


Programming Assignment 3 @ 2022 Dr. Robert Castañeda 1 IS 2063 Programming Lang II with Java Programming Assignment # 3 100 points Due date August 5, 2022 On your flash drive, laptop, or on your home PC create a folder for your PA. Name your folder in the following manner: lastNameFirstInitialOfYourFirstNameCourseSectionPA3. So, for example if I were creating this folder for my PA and given that my name is Robert Castaneda and let’s say that I was in section 001, my folder name would be CastanedaR001PA3 Next, do the following: Within DrJava, you are to create a Java class for your PA. Like for your folder (above), use the same procedure in naming your PA class. So again, for example, if I were creating the class for my PA and given that my name is Robert Castaneda and let’s say that I was in section 001, my class name for my PA would be CastanedaR001PA3 Now, your PA will show records of people’s names and their age. Your program will manipulate these records in the appropriate way talked about below. The information about these people (there will be 12 of them) will be read in from a file (info.txt). 1) First, you will need to import the following: import java.util.Scanner; import java.util.Random; import java.io.*; @ 2022 Dr. Robert Castañeda 2 The following are variables and constants that you will need to declare in your program (within the main() method): fullName (assigned the null string “”), firstName, lastName, oneLetter, and bigRecord will be strings bigRecordArray will be an array of strings of size 15 tokens will be an array of strings index (assigned the value 0) and age will be integers You will be reading from a file that is called info.txt. So please set up the file as shown in Chapter 4. You may want to specifically look at pages 237 through 244 as a guidance. 2) You will need to read the information from the file info.txt and store it inside your bigRecord. You will need a while loop to do this. There are three items per record (a person). They are: the person’s last name, the person’s first name, and the person’s age. However, for each person their last name and first name are encrypted. More about this later. You are to add the words throws IOException on the same line as your main() method so that it looks like this: public static void main(String[] args) throws IOException After reading in each record of a person, you are to print it out (look at the expected output below as use it as a guide). 3) Next, you are to use the split() method to split up the contents of bigRecord and assign it to tokens. Use a single space as a delimiter. @ 2022 Dr. Robert Castañeda 3 (Even though the file is within the format described earlier, the vowels are replaced by numbers. How you manipulate these records will be described later in the description of the method modifyVowels() ). Next, you are to invoke the method modifyVowels() and pass to it the last name of the person (this is represented by tokens[0]). The returned value from modifyVowels() will be assigned to lastName. Now convert all letters in lastName to upper case. Now, extract out first letter of lastName and assign it to oneLetter (usage of the method substring() will be helpful here). Next, extract all of the remaining letters within lastName (excluding the first letter) and convert them to lower case and reassign it to lastName (again, usage of substring() will be helpful here). Finally, concatenate the oneLetter to lastName and reassign this to lastName. Now for the firstName. You are to invoke the method modifyVowels() and pass to it the first name of the person (this is represented by tokens[1]). The returned value from modifyVowels() will be assigned to firstName. Now convert all letters in firstName to upper case. Next, you are to concatenate the firstName, a single space, and the lastName together and assign it to fullName. For the age of the person, you are to parse tokens[2] to an integer value and assign it to the variable age (usage of Integer.parseInt() will be useful here). @ 2022 Dr. Robert Castañeda 4 Now you are to invoke the method updateAge() and pass to it the argument age. The return value will be reassigned to the variable age. Next, convert age back to a String and reassign it to tokens[2] (usage of Integer.toString() will be useful here). Finally, concatenate fullName, a single space, and tokens[2] together and assign it to bigRecordArray using index as a subscript. Update index appropriately also. After this while loop, close the file. 4) Outside the while loop that you created in steps 2 and 3 above, you are to now print out a header and invoke the method printRecords() and pass to it bigRecordArray and index to print out the records of the people. 5) Now you are to invoke method selectionSort() and pass to it bigRecordArray and index. Now print out a header and invoke the method printRecords() and pass to it bigRecordArray and index to print out the newly sorted records of the people. 6) Also, make sure that you have comment header block at the top of your program and is filled in. The generic comment header block will look something like the following: /** * Programmer: xxx xxx<-- your="" name="" goes="" here="" (first="" name="" followed="" by="" last="" name)="" *="" *="" course:="" is="" 2063.xxx=""><-- where="" xxx="" is="" your="" section="" number="" *="" *="" programming="" assignment="" #="" xxx=""><-- fill="" in="" appropriate="" assignment="" number="" for="" xxx="" *="" @="" 2022="" dr.="" robert="" castañeda="" 5="" *="" due="" date:="" xxx="" x,="" xxxx=""><-- fill in the appropriate due date (month day, year) */ make sure your program has general comments throughout your code. look at my videos for examples. the comment header block and the general comments will be worth points in your overall grade for this assignment. here are brief descriptions of each of these methods and what you need to know to code them: modifyvowels() – in this method it will receive one incoming parameter that is of type string (look at the argument talked about above). you may name this parameter whatever you like. as stated previously, the names in the file (last and first name) are encrypted in the following manner: all vowels are currently replaced by a number. here are the correlations between the numbers and the vowels: 0 represents a 1 represents e 2 represents i 3 represents o 4 represents u 5 represents y you should declare three local variables. the first will be of type int and so will the second. the third will be of type string and should be assigned the null string “”. you will need to use a for loop, so one of your local int variables should be the loop variable and the other local int variable should be assigned the length of the incoming parameter. this length is the method length() not the property length that is associated with arrays. so, the condition of your for @ 2022 dr. robert castañeda 6 loop should incorporate this “length value”. your for loop will loop through your parameter string character by character on every iteration and will look at each character and determine what symbol it represents (look above for this description). you should use a switch statement for this (usage of the method charat() will be useful here). on each iteration you will look at a character in your parameter and if it is a number, replace it with the proper vowel. it is your third local variable (that is of type string) that will be “built up” from all of this action. of course, if the character is not a vowel (i.e., a consonant) you simply concatenate that letter with the current value of your parameter. scanning through one character at a time, eventually all of the characters within your parameter would have been seen and in the end your string local variable will be a complete string with all letters. this method will return the final value of your third local variable (the string local variable). updateage() – this method will receive one parameter (look at the argument talked about above). you may name this parameter whatever you like. you should declare two local variables. the first will be of type int and the second will be an object instantiated from the random class. randomly generate a number and assign this value to the local variable that you declared. you should generate numbers between 0 and 3 inclusive. so, pass the number 4 as an argument to your random number generator to accomplish this. using this random number, use it in a switch statement to determine what kind of update needs to be done to your parameter. the possible outcomes are as follows: 0 - increment your parameter by 1 1 - decrement your parameter by 1 2 - increment your parameter by 2 otherwise - assign the value 21 to your parameter @ 2022 dr. robert castañeda 7 this method will return the value that you assigned to your parameter. printrecords() – this method will receive two parameters (look at the two arguments talked about above). you may name these two parameters whatever you like. nevertheless, the method will print out the records of the incoming array (don’t forget to make usage of the second parameter). you should declare a local variable that is of type int that you will need in this method as the loop variable. this method will not return anything. selectionsort() – this method will have two incoming parameters (you may call them whatever you wish). nevertheless, the first parameter will be correlated with the array bigrecordarray (don’t forget to fill="" in="" the="" appropriate="" due="" date="" (month="" day,="" year)="" */="" make="" sure="" your="" program="" has="" general="" comments="" throughout="" your="" code.="" look="" at="" my="" videos="" for="" examples.="" the="" comment="" header="" block="" and="" the="" general="" comments="" will="" be="" worth="" points="" in="" your="" overall="" grade="" for="" this="" assignment.="" here="" are="" brief="" descriptions="" of="" each="" of="" these="" methods="" and="" what="" you="" need="" to="" know="" to="" code="" them:="" modifyvowels()="" –="" in="" this="" method="" it="" will="" receive="" one="" incoming="" parameter="" that="" is="" of="" type="" string="" (look="" at="" the="" argument="" talked="" about="" above).="" you="" may="" name="" this="" parameter="" whatever="" you="" like.="" as="" stated="" previously,="" the="" names="" in="" the="" file="" (last="" and="" first="" name)="" are="" encrypted="" in="" the="" following="" manner:="" all="" vowels="" are="" currently="" replaced="" by="" a="" number.="" here="" are="" the="" correlations="" between="" the="" numbers="" and="" the="" vowels:="" 0="" represents="" a="" 1="" represents="" e="" 2="" represents="" i="" 3="" represents="" o="" 4="" represents="" u="" 5="" represents="" y="" you="" should="" declare="" three="" local="" variables.="" the="" first="" will="" be="" of="" type="" int="" and="" so="" will="" the="" second.="" the="" third="" will="" be="" of="" type="" string="" and="" should="" be="" assigned="" the="" null="" string="" “”.="" you="" will="" need="" to="" use="" a="" for="" loop,="" so="" one="" of="" your="" local="" int="" variables="" should="" be="" the="" loop="" variable="" and="" the="" other="" local="" int="" variable="" should="" be="" assigned="" the="" length="" of="" the="" incoming="" parameter.="" this="" length="" is="" the="" method="" length()="" not="" the="" property="" length="" that="" is="" associated="" with="" arrays.="" so,="" the="" condition="" of="" your="" for="" @="" 2022="" dr.="" robert="" castañeda="" 6="" loop="" should="" incorporate="" this="" “length="" value”.="" your="" for="" loop="" will="" loop="" through="" your="" parameter="" string="" character="" by="" character="" on="" every="" iteration="" and="" will="" look="" at="" each="" character="" and="" determine="" what="" symbol="" it="" represents="" (look="" above="" for="" this="" description).="" you="" should="" use="" a="" switch="" statement="" for="" this="" (usage="" of="" the="" method="" charat()="" will="" be="" useful="" here).="" on="" each="" iteration="" you="" will="" look="" at="" a="" character="" in="" your="" parameter="" and="" if="" it="" is="" a="" number,="" replace="" it="" with="" the="" proper="" vowel.="" it="" is="" your="" third="" local="" variable="" (that="" is="" of="" type="" string)="" that="" will="" be="" “built="" up”="" from="" all="" of="" this="" action.="" of="" course,="" if="" the="" character="" is="" not="" a="" vowel="" (i.e.,="" a="" consonant)="" you="" simply="" concatenate="" that="" letter="" with="" the="" current="" value="" of="" your="" parameter.="" scanning="" through="" one="" character="" at="" a="" time,="" eventually="" all="" of="" the="" characters="" within="" your="" parameter="" would="" have="" been="" seen="" and="" in="" the="" end="" your="" string="" local="" variable="" will="" be="" a="" complete="" string="" with="" all="" letters.="" this="" method="" will="" return="" the="" final="" value="" of="" your="" third="" local="" variable="" (the="" string="" local="" variable).="" updateage()="" –="" this="" method="" will="" receive="" one="" parameter="" (look="" at="" the="" argument="" talked="" about="" above).="" you="" may="" name="" this="" parameter="" whatever="" you="" like.="" you="" should="" declare="" two="" local="" variables.="" the="" first="" will="" be="" of="" type="" int="" and="" the="" second="" will="" be="" an="" object="" instantiated="" from="" the="" random="" class.="" randomly="" generate="" a="" number="" and="" assign="" this="" value="" to="" the="" local="" variable="" that="" you="" declared.="" you="" should="" generate="" numbers="" between="" 0="" and="" 3="" inclusive.="" so,="" pass="" the="" number="" 4="" as="" an="" argument="" to="" your="" random="" number="" generator="" to="" accomplish="" this.="" using="" this="" random="" number,="" use="" it="" in="" a="" switch="" statement="" to="" determine="" what="" kind="" of="" update="" needs="" to="" be="" done="" to="" your="" parameter.="" the="" possible="" outcomes="" are="" as="" follows:="" 0="" -="" increment="" your="" parameter="" by="" 1="" 1="" -="" decrement="" your="" parameter="" by="" 1="" 2="" -="" increment="" your="" parameter="" by="" 2="" otherwise="" -="" assign="" the="" value="" 21="" to="" your="" parameter="" @="" 2022="" dr.="" robert="" castañeda="" 7="" this="" method="" will="" return="" the="" value="" that="" you="" assigned="" to="" your="" parameter.="" printrecords()="" –="" this="" method="" will="" receive="" two="" parameters="" (look="" at="" the="" two="" arguments="" talked="" about="" above).="" you="" may="" name="" these="" two="" parameters="" whatever="" you="" like.="" nevertheless,="" the="" method="" will="" print="" out="" the="" records="" of="" the="" incoming="" array="" (don’t="" forget="" to="" make="" usage="" of="" the="" second="" parameter).="" you="" should="" declare="" a="" local="" variable="" that="" is="" of="" type="" int="" that="" you="" will="" need="" in="" this="" method="" as="" the="" loop="" variable.="" this="" method="" will="" not="" return="" anything.="" selectionsort()="" –="" this="" method="" will="" have="" two="" incoming="" parameters="" (you="" may="" call="" them="" whatever="" you="" wish).="" nevertheless,="" the="" first="" parameter="" will="" be="" correlated="" with="" the="" array="" bigrecordarray="" (don’t="" forget="">
Answered 1 days AfterAug 03, 2022

Answer To: Programming Assignment 3 @ 2022 Dr. Robert Castañeda 1 IS 2063 Programming Lang II with Java...

Manikandan answered on Aug 04 2022
69 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here