[Solved]42 L T 2 10 Pm Project 4 Project4pdf Project4 Computer Science 111l Intro Algorithms Progr Q37041069




42% l AT&T 2:10 PM くProject 4 Project4.pdf aビ山 Project4 Computer Science 111L intro to Algorithms and Programming:ava Lab Programming Preject 84 PictureViewer (30 poines) Due: 4/22/1 Phase 1 (3 points) Is this phase, we will revisit the concept of an algorithm. Remember, an algorithm is a detaled set of instructions which describe how you intend to solve a specific problem in a finite amout of time Therefore, to complete this phase, you must design 3 algorithms. Write out both a fow chart and pieudocode for the algorithma, then show these algorithms to me in lab clans Here is a description of each algorithm Given an integen-type parameter named euerent nber, a global integer variable named inage number, and two gobal symbolc constants final statie Int MIN NUMBER1 tinal statle Int MAX UMDER8 atatle int image number a Write an algorithm named forward which increanes the value passed to ies parameter r by sne each time the algorithm is invoked. in other words, when forvard is invoked and passed a number lke 1, then forvard returns a value of 2. When forward is invoked and passed a value of 2, then forward returns a value of 3. However, when MAK NUNBER is reached the algorithm should”wap around”and returm NIN NUMBER. This algorithm must nexer return a value larger tham MAX MBER Write an algorithm named backwardwhich decreases the value passed to its parameter current nunber by gne each time the algorithm is inwoked. In other words, when backward is invoked and passed a number lke 8, then backward returns a value of7. When backward is invoked and passed runn er like 7, then backw.ฮdreturns a value of However, when MZN NUNeaR is reached, the algorithm shouls STOP and return the value of MTN SOBER This algotm will NEVER wrap around Write an algorithm named createFileNane which concatenates and returns a Sing lke pictureX ipe where X is the value of the input parameter current nunber In other words, when ereatefileName is invoked and passed a number line &, thencreateFileNane retures the String picture8 ipe. When createFSleNane is invoked and passed a number lke 1, then createrileSame returns the Sering picturel-JP 1-2 of 5 Dashboard To Do Notifications Inbox Calendar 42% l AT&T 2:10 PM くProject 4 Project4.pdf aビ山 Phase 2 (12 points) Is tho phase, you will implement your algorithms in an actual Jawa class by adding six methods to the atached PictureViewer class your own methods to this class Your methods should behave as described in your Phave 1 algorithms that in, the forward0method should “wrap around when it reaches the lant number, she backvardl) method should STOP when it reaches the first number, and the createFileNane method should return the Strine picture8ipe when the method is invoked and passed a number lke & simply ad Your forward ) and baekvard O methods MUST use a parameter mamed eurrent number for input and MUST return an int-type value, they MUST NOT use the global inage nunber variable directly. Aso, both methods SHOULD use the symbolic constants HIN NUMBER and MAX NUMBER instead of the hardcoded, literal numbers 3 and & Don’t bry to make the methods overly complex, they should be very simple; when forward O is passed a current nunber of 3, the method returms a 4 When backward) is passed a current number of 6, the method returns a5 The ero ateri lesane() method wศ use a parameter named current nunber for nput, and wal return a String representing a filename like plictereX ie, where X is the value of eurrent munber Use the following method headers pubiie statie int forvardlint current nunber return the new nunber pubiie atatse int backwardiint current nunber) [ / return the ew number The atatie methods above should use the symbolic conatants // JNNtletk, MAXNCDENER. Do not use hardcoded 1 8 – – pubiie statie Sezing czeateFileNane (int eurzent unbez) f return a Stelng representing a filenane Ilke pieturex.3p9 t where X is the value of the paraneter, current nunber pubiie statio string createRandonane Return a String representing a tilenane 1ke pieturex.jp f where X is a random munber between MIN NUNBER and NAx ND Dashboard To Do Notifications Inbox Calendar ( 42% 2:10 PM .’ll AT&T令 < Project 4 Project4.pdf a [ pubiie statle vold shoMena urite loop t- Inside the loop, diaplaya mena with optiona .N fot each of the each of the methods abone s wellas an exit option 2 Print the value of the global inage umber varlable. Prompt the user for a menu option cholce 4. Get tho usoz.a ธอtu option ehoice, then invoke the correet method ualngSHITCH For example, if your menu shows option 1. Forward, and the user’s menu option choice 1s 1, the switch should then invoke the forward) nethod ubiie statle vold main(Stringtl args) Learning how to invoke a nethod is crucial to this chapter // s。DO NOT a k a fellow student 0τ even the at ructor how /f to do this The createRandonsame () method han NO input and returs a String representing a flename lke picture X.ipE. where X is a random number between MEX NUR and Mx inclusive. The menu displayed by shovenu) should have options for invoking forwardo backwardl createFi1eanell and createRandonNanell. Be sure to use global image unber as the Remember to update inage umber by assigning it the numbers retumed by the forwardjor backvard) method. Also, when the exit option is chosen in shovhenall, use System.exit con to terminate the the inage number in the NetBeans cosole output window methods and print Atthis point, your program hould display a menu, invoke Phase 3 (9 points) This phase will require you to write two overloaded methods. An overloaded method is one that has the SAME NAME as another method, but different lst of parameters. We can createあ嬲hod with the same name as another, as long as it has a different ist of parameters. The dference must be in either the number of parameters or in the data types of those parameters. Add the ollowing OVERLOADED methodi to your PictureViewer class Dashboard To Do Notifications Inbox Calendar 42% l AT&T 2:10 PM < Project 4 Project4.pdf a [ pubise statie vold forward This nethod is allowed to rloaded nethod. use the global inage nunber variable for both // input and @stput. In other words, the method should check t inage number+1is less than // equal to ,uAX-Ntieci. If ↓t ia· then the // sethod inereases irage humber by 1. othwerise / the nethod sets image nhusber to MIN NUMBER // This method should “Wrap around” 1ke the fiest / torward) method does pubiie statie vold backwardo nethod is al // Ove rloaded method. This allowed to use the global inage nunber variable for both inpat and out put. in other words the method shoutd check f image nunber-1 is greater than or equal to MIN MMBER It it is, then If the nethod decreases inage nnber by Othervise the nethod sets image number to HIN NUBERLike the first backvard) method, // this ธethod should E? “wzap aะ○und” In addition to having a different Iint of parameters Ino parameter at all versus one parameterl these NEW method overloads will operate differently Instead of using a parameter for input and a retuned value for output, these new method overloads are allowed to use the global image nunbsr variable. Add two new options to your progran’s menu to invoke these new, overloaded methods. Both the forvardl) and backwardj method overloads should do basically the same thing as the original forvardl) and backwardl methods, but these overloaded versions do NOT require a parameter and de not return anything Test your program. Make sure you can page forward using both fervard DO NOT CONTINUE TO PHASE and backward using both Dashboard To Do Notifications Inbox Calendar 42% l AT&T 2:10 PM Project 4 Project4.pdf Q Phase 4 (6 points) This phase will require you to add some code to invoke the existing showWindovo method, pass toit the filenames (Strings) that the createFilelane0 and createRandonNane) methods create In your shodlenu0 method’s swm九under the case which invokes your creater. leNaneo method, add a statement which invokes the showwindowll method, passing the String returned by createFileNamell as the argument. Also in your showHenullmethod’s switch, under the case which invokes your createRandonNaneD method, add a statement which invokes the showwindow) method, passing the String returned by Test your pregram. You should be able to page” forward and backward with proper behavior when are reached. When invoked, a frame containing an image should appear onscreen you may need toclick a button the taskbar to see R). The correct filename should be shown at the top of the frame. in other words, if the createrileNamell method is invoked when inage nurber s 7,a frame will open and the frame should show a picture and the title bar of the frame should be picture7 ipE If the ero4teRandoe Nate() method is invoked, a trame will open and the from should show ล picture and the title bar of the frame should be arandom filename between and including picturel jpg to pictures ipE All 8 pictures in this project ane different from one another Remember to write a Universal cemment header at the top of your source code file. When you have completed the exercise, ZIP the entire project folder and upload this ZP fle to Canvas n NetBeans, click File, select Export Project, cick To Pselect the location where you want the 2 fle to be saved, type the name of the DP file, Project4 aip in the textbox, click the Save button, then click the Export button. If the IDE you are using does not have an export project to-zip option, you may have to manually DP the file by navigating to the project folder in a fle browser and selecting your O5’s “compress folder” option Under Mac O5, the tle browser is called Finder which offers a Compress Folder option Under Windows, the file browser is called File Explorer and it effers a Send to w Compressed (ripped) folder Dashboard To Do Notifications Inbox Calendar Show transcribed image text 42% l AT&T 2:10 PM くProject 4 Project4.pdf aビ山 Project4 Computer Science 111L intro to Algorithms and Programming:ava Lab Programming Preject 84 PictureViewer (30 poines) Due: 4/22/1 Phase 1 (3 points) Is this phase, we will revisit the concept of an algorithm. Remember, an algorithm is a detaled set of instructions which describe how you intend to solve a specific problem in a finite amout of time Therefore, to complete this phase, you must design 3 algorithms. Write out both a fow chart and pieudocode for the algorithma, then show these algorithms to me in lab clans Here is a description of each algorithm Given an integen-type parameter named euerent nber, a global integer variable named inage number, and two gobal symbolc constants final statie Int MIN NUMBER1 tinal statle Int MAX UMDER8 atatle int image number a Write an algorithm named forward which increanes the value passed to ies parameter r by sne each time the algorithm is invoked. in other words, when forvard is invoked and passed a number lke 1, then forvard returns a value of 2. When forward is invoked and passed a value of 2, then forward returns a value of 3. However, when MAK NUNBER is reached the algorithm should”wap around”and returm NIN NUMBER. This algorithm must nexer return a value larger tham MAX MBER Write an algorithm named backwardwhich decreases the value passed to its parameter current nunber by gne each time the algorithm is inwoked. In other words, when backward is invoked and passed a number lke 8, then backward returns a value of7. When backward is invoked and passed runn er like 7, then backw.ฮdreturns a value of However, when MZN NUNeaR is reached, the algorithm shouls STOP and return the value of MTN SOBER This algotm will NEVER wrap around Write an algorithm named createFileNane which concatenates and returns a Sing lke pictureX ipe where X is the value of the input parameter current nunber In other words, when ereatefileName is invoked and passed a number line &, thencreateFileNane retures the String picture8 ipe. When createFSleNane is invoked and passed a number lke 1, then createrileSame returns the Sering picturel-JP 1-2 of 5 Dashboard To Do Notifications Inbox Calendar
42% l AT&T 2:10 PM くProject 4 Project4.pdf aビ山 Phase 2 (12 points) Is tho phase, you will implement your algorithms in an actual Jawa class by adding six methods to the atached PictureViewer class your own methods to this class Your methods should behave as described in your Phave 1 algorithms that in, the forward0method should “wrap around when it reaches the lant number, she backvardl) method should STOP when it reaches the first number, and the createFileNane method should return the Strine picture8ipe when the method is invoked and passed a number lke & simply ad Your forward ) and baekvard O methods MUST use a parameter mamed eurrent number for input and MUST return an int-type value, they MUST NOT use the global inage nunber variable directly. Aso, both methods SHOULD use the symbolic constants HIN NUMBER and MAX NUMBER instead of the hardcoded, literal numbers 3 and & Don’t bry to make the methods overly complex, they should be very simple; when forward O is passed a current nunber of 3, the method returms a 4 When backward) is passed a current number of 6, the method returns a5 The ero ateri lesane() method wศ use a parameter named current nunber for nput, and wal return a String representing a filename like plictereX ie, where X is the value of eurrent munber Use the following method headers pubiie statie int forvardlint current nunber return the new nunber pubiie atatse int backwardiint current nunber) [ / return the ew number The atatie methods above should use the symbolic conatants // JNNtletk, MAXNCDENER. Do not use hardcoded 1 8 – – pubiie statie Sezing czeateFileNane (int eurzent unbez) f return a Stelng representing a filenane Ilke pieturex.3p9 t where X is the value of the paraneter, current nunber pubiie statio string createRandonane Return a String representing a tilenane 1ke pieturex.jp f where X is a random munber between MIN NUNBER and NAx ND Dashboard To Do Notifications Inbox Calendar
( 42% 2:10 PM .’ll AT&T令
Expert Answer
Answer to 42% l AT&T 2:10 PM くProject 4 Project4.pdf aビ山 Project4 Computer Science 111L intro to Algorithms and Programming:… . . .
OR

