Menu

[Solved] Part 1 Heads Response Underneath Part 2 Instructions Understand Wrong Anyone Help Q37249590

So, there was a Part 1 I did, as a heads up. My response isbelow underneath the Part 2 instructions. I do not understand whatI am doing wrong! Can anyone help?[To be completed in Part 2] 5. Median The median is the value that falls at the middle of the sorted set of values Ifthere isYou will change the printing to the file completed in Part 1 to match these new requirements. You will print the following in2 Quick Access Investment Managerl 10 11e inport java.io.File; //all the inpoggorts til 14 12 inport java.io. FileNotFoundExcQuick Access prog08 investmentmanagerjava testt, java 51 52 53 else /try-quirements All Find 57 59 61 63 65 Scanner fileReadeQuick Access to investment [j] = inv; //investment 94 95 96 int typesnew int[51 for int1-8; 1 <investmentSum; i++) トAll 98 FiQuick Access rjave testt. java 151 132 133 134 135 136 137 138 3139 148 3141 142 143 144 145 ystem.out.print unLnNn Systen.o

[To be completed in Part 2] 5. Median The median is the value that falls at the middle of the sorted set of values Ifthere is an odd number of the set of values, the median is the middle element (i.e., there are the same number of values above and below the median value a. b. i. For example, the median of [2, 6, 10, 11, 65] is 10.0 IF there is an even number of the set of values, the center two values are averaged to calculate the median c. For example, the median of [2, 6, 10, 11, 65, 98] is 10.5 i. You will change the printing to the file completed in Part 1 to match these new requirements. You will print the following information to the file specified by the user: Sorted (descending) list of investments, one per line After leaving a couple of blank lines, you will output the following, formatted to print 3 places past the decimal Mean: Median: Minimum: Maximum: Number of As: Number of Bs: Number of Cs Number of Ds: Number of Fs Total Number of Investments: Step 4: Sorting the array [To Be Tackled in Part 2] You will need to sort the array into descending order for analysis. You will implement a BubbleSort method that uses the short circuit approach to sorting an double array. You will also implement a Swap method that is called by the Bubble Sort method to swap elements of an integer array Step 5: Binary Search [To Be Tackled in Part 2] After the output to the file has been generated, you will prompt the user to search for a particular investment value in the array, 0 or more times. If the value is not found in the array the BinarySearch method, should return a value of 0. You should give the user feedback on either the location of the value in the array or a message that the value is not found in the array Ifthe value is found more than once in the array, any position in which the value is found is fine For example: Would you like to search for an investment amount? (Y/N)Y Enter investment amount: 147.50 Investment amount 147.50 is found at position o Would you like to search for a investment amount? (Y/N) Y Enter investment amount: 10075.45 investment amount 10075-451s found at position 34 Would you like to search for a grade? (Y/N) N 2 Quick Access Investment Managerl 10 11e inport java.io.File; //all the inpoggorts til 14 12 inport java.io. FileNotFoundException; 13 import java.io. FileReader; 14 inport java.util.Scanner: 15 16 public class progeB_investmentmanager 17 18 19 public static void main(String[l args) All Find Scanner inputnew Scanner(Systen.in); //scanner throws FileNotFoundException//handlin 21 Scanner Input new Scanner(System.in); //scanner 24 25 26 27 28 29 30 31 File fileinput null; if《true) //++input System.out.println( Input file name:”; //user input //input String inputFileInput.next; rileTnput new File( input File); if (ieInput.exists)) nputtile 34 //tile DNE 36 37 38 try input: Scanne throw new FileNotFoundException(“File not found-try again: “); //handler 43 45 47 catch (FileNotFoundException e) /catch exception System.out.println(“File not found- try again: ” //output finally //try-guirements 50 51 Problems @Javadoc鳳Declaration search曰CongoleX eterminated> prog08 investmentmanager (Java Appication] /LibraryyJava/JavavirtualMachinesidk-11.0.2.jdk/ContentsyHomeybinjava (Apr 23, 2019, 12:47:35 AM) Input file name: File not found- try again: Exception in thread “main'” įava.io. FileNotFoundException: aaaa 《No such file or directory) at java.base/java.io.FileInputStream.open&(Native Method) at java.base/java.io. FileInputStream, open(EileInputStream java:219) at java.base/java.io.FileInputStream, cinit (EileInputStream java: 157) at java.base/va.io.FileReader.cinit (EileReader java:75 at prog88_investnentmanager.main(erog8 investmentnanager java:59) Smart Insert 22:11 Quick Access prog08 investmentmanagerjava testt, java 51 52 53 else /try-quirements All Find 57 59 61 63 65 Scanner fileReader-new Scanner(new FileReader(ileInput)); boolean firstし1ne true ; doublel investmentnull; /investment nullouLLnuL int investnentSum8; int indexe double sun-e; /investment total // İndex //sum 67 68 69 70 71 72 73 74 75 if (fileReader.hasNext(O) if (firstLine) investmentSum= Integer.parseInt(fileReader.nextLine()) ; investment new doublelinvestmentSun): /investment sum firstLine = false; else 78 investment [index) Double.parseDouble(fileReader.nextLine()); sum+-investment[indexl: I/sum and investment index+t input: Scanne 83 for(int 1-8;1 <investmentSum; 1++) 85 86 87 for(int j 1+1;jeinvestmentSunsj++) //char + 1, investment = sun if(investment[il>investment [j]) 90 91 92 double inv investment [i]; investment[ilinvestnent [j]: Problems @Javadoc鳳Declaration search曰CongoleX eterminated> prog08 investmentmanager (Java Appication] /LibraryyJava/JavavirtualMachinesidk-11.0.2.jdk/ContentsyHomeybinjava (Apr 23, 2019, 12:47:35 AM) Input file name: File not found- try again: Exception in thread “main'” įava.io. FileNotFoundException: aaaa 《No such file or directory) at java.base/java.io.FileInputStream.open&(Native Method) at java.base/java.io. FileInputStream, open(EileInputStream java:219) at java.base/java.io.FileInputStream, cinit (EileInputStream java: 157) at java.base/va.io.FileReader.cinit (EileReader java:75 at prog88_investnentmanager.main(erog8 investmentnanager java:59) Smart Insert 51: 18 Quick Access to investment [j] = inv; //investment 94 95 96 int typesnew int[51 for int1-8; 1 <investmentSum; i++) トAll 98 Find /investment sum 100 if (investnentl1] 1258) else if(investment [i] 1108 &&investment[i] 1500) B else if(investment [i] 900 & investment[i] 110) /C else if (investment [í] >= 750 && investment [1] < g00} //D else if(investment[il <750) /Es types [a]+1 types [1] +-1; types [2]1 types [3]1 types [4] +α 1; 102 103 104 105 106 107 108 109 118 112 113 114 115 116 System.out.println /blanklinee System.out.print l //blankline System. out.printn”Mean: “+(sun investmentSum)); //mean Systen.out.printn(“Minimum: $”investment (01); //min Systen. out.printIn(“Maximum: “investnent linvestmentSum-11 //max! System. out.printIn(“nn” System.out.printIn(Number of A’s: “+ types [a); I/a System.out.print 1n(“Number of в’s: ” + types [1] ); //b Systen.out.print1n(“Number of C’5: ” + types [2] ); //С System.out.print Ln(“Number of D’s: “types [3]); IId System.out.printLn(“Number of F’s: “types [4]); 1/t Systen.out.printLn(“Total Number of Investnents: “investmentSum); System.out.print Ln(“Enter input tile name for program use: “); System.out.printLn(“nnn”//spacex3 System . out.printf(“%15s 45s%n”, “Mean: “, sum/investmentSum); System . out.printf(“915s 45s%n.., “Median:”); //median Systen.out.print f(“415s 45s%n.., “Minimun : ” + investment [9] ); //min Systen.out.printf(“415s 45s%n.., “Maximun : ” + investment [investmentSum-1)); System.out.print Ln(“nnn”) Systen, out.printf(“415s %-5s %n”, “Number of A’s. ㅌ + types [ol); //a Systen.out.printf(“415s %-5s %n”, “Number of B’s. .. + types [1]); //b System, out.printf(“415s %-5s %n”, “Number of C’s: “. + types [2]); //c 118 128 121 122 123 124 125 126 127 128 129 130 131 132 133 134 input: Scanne //nax! Problems @Javadoc鳳Declaration search曰CongoleX eterminated> prog08 investmentmanager (Java Appication] /LibraryyJava/JavavirtualMachinesidk-11.0.2.jdk/ContentsyHomeybinjava (Apr 23, 2019, 12:47:35 AM) Input file name: File not found- try again: Exception in thread “main'” įava.io. FileNotFoundException: aaaa 《No such file or directory) at java.base/java.io.FileInputStream.open&(Native Method) at java.base/java.io. FileInputStream, open(EileInputStream java:219) at java.base/java.io.FileInputStream, cinit (EileInputStream java: 157) at java.base/va.io.FileReader.cinit (EileReader java:75 at prog88_investnentmanager.main(erog8 investmentnanager java:59) Writable Smart Insert 93:35 Quick Access rjave testt. java 151 132 133 134 135 136 137 138 3139 148 3141 142 143 144 145 ystem.out.print unLnNn” Systen.out.print f(“Y15s %-5s %n”, “Number of A’s. ” + types [0]); //a System.out.printf”$15s 5″ “Number of B’s: “+ types [11): //b System.out.printf(“%15s 9-5s %n. “Number of C’s. ” + types [2)); //c Systen.out.printf(“*15s %-5s %n”, “Number of D’s. ” + types [3]); //d System.out.printf(“Y15s %-5s en”, “Number of F’s. ” + types [4]); //f System, out. printf(“%15s %-5s en”, “Total Number of Investments: ” + investment Sun); to Find int bubble-in.next); System.out.printt(“Would you like to search for an investnent amount? (Y/N) ” int bubble2-in.next); Systen.out.printf(“Enter investment amount: “); Systen.out.print.in”Investment amount”, bubble2) System.out.println(“is found at position “) Systen.out.printLn(“Nould you like to search for a investnent amount? (Y/N)”: int investmentamount-in.nextint) System.out.print ln(“Enter investment amount) System.out.printfl”investment amount”, investmentamount) System.out.printf(“is found at position 34”) System.out.printLn(“Nould you like to search for a grade? (Y/N)” 0147 羊148 149 150 151 152 153 154 155 156 157 158 159 168 BubbleSort(int larray) Outi boolean sorted -false; int i- 1; while (sorted t if array.length) sorted true; else sorted for(int true; j 8; input: Scanne j++)囤 j < array- th-i; 162 163 164 165 166 167 168 169 170 if (arraylj]< array [j+1]) swap(array, , 1+1): sorted-false; 14+2 172h 173 Problems @Javadoc鳳Declaration search曰CongoleX eterminated> prog08 investmentmanager (Java Appication] /LibraryyJava/JavavirtualMachinesidk-11.0.2.jdk/ContentsyHomeybinjava (Apr 23, 2019, 12:47:35 AM) Input file name: File not found- try again: Exception in thread “main” java.io.FileNotFoundException: aaaa (No such file or directory at java.base/java.io.FileInputStream.open&(Native Method) at java.base/java.io. FileInputStream, open(EileInputStream java:219) at java.base/java.io.FileInputStream, cinit (EileInputStream java: 157) at java.base/va.io.FileReader.cinit (EileReader java:75 at prog88_investnentmanager.main(erog8 investmentnanager java:59) Writable Smart Insert 166: 14 Show transcribed image text [To be completed in Part 2] 5. Median The median is the value that falls at the middle of the sorted set of values Ifthere is an odd number of the set of values, the median is the middle element (i.e., there are the same number of values above and below the median value a. b. i. For example, the median of [2, 6, 10, 11, 65] is 10.0 IF there is an even number of the set of values, the center two values are averaged to calculate the median c. For example, the median of [2, 6, 10, 11, 65, 98] is 10.5 i.
You will change the printing to the file completed in Part 1 to match these new requirements. You will print the following information to the file specified by the user: Sorted (descending) list of investments, one per line After leaving a couple of blank lines, you will output the following, formatted to print 3 places past the decimal Mean: Median: Minimum: Maximum: Number of As: Number of Bs: Number of Cs Number of Ds: Number of Fs Total Number of Investments: Step 4: Sorting the array [To Be Tackled in Part 2] You will need to sort the array into descending order for analysis. You will implement a BubbleSort method that uses the short circuit approach to sorting an double array. You will also implement a Swap method that is called by the Bubble Sort method to swap elements of an integer array Step 5: Binary Search [To Be Tackled in Part 2] After the output to the file has been generated, you will prompt the user to search for a particular investment value in the array, 0 or more times. If the value is not found in the array the BinarySearch method, should return a value of 0. You should give the user feedback on either the location of the value in the array or a message that the value is not found in the array Ifthe value is found more than once in the array, any position in which the value is found is fine For example: Would you like to search for an investment amount? (Y/N)Y Enter investment amount: 147.50 Investment amount 147.50 is found at position o Would you like to search for a investment amount? (Y/N) Y Enter investment amount: 10075.45 investment amount 10075-451s found at position 34 Would you like to search for a grade? (Y/N) N
2 Quick Access Investment Managerl 10 11e inport java.io.File; //all the inpoggorts til 14 12 inport java.io. FileNotFoundException; 13 import java.io. FileReader; 14 inport java.util.Scanner: 15 16 public class progeB_investmentmanager 17 18 19 public static void main(String[l args) All Find Scanner inputnew Scanner(Systen.in); //scanner throws FileNotFoundException//handlin 21 Scanner Input new Scanner(System.in); //scanner 24 25 26 27 28 29 30 31 File fileinput null; if《true) //++input System.out.println( Input file name:”; //user input //input String inputFileInput.next; rileTnput new File( input File); if (ieInput.exists)) nputtile 34 //tile DNE 36 37 38 try input: Scanne throw new FileNotFoundException(“File not found-try again: “); //handler 43 45 47 catch (FileNotFoundException e) /catch exception System.out.println(“File not found- try again: ” //output finally //try-guirements 50 51 Problems @Javadoc鳳Declaration search曰CongoleX eterminated> prog08 investmentmanager (Java Appication] /LibraryyJava/JavavirtualMachinesidk-11.0.2.jdk/ContentsyHomeybinjava (Apr 23, 2019, 12:47:35 AM) Input file name: File not found- try again: Exception in thread “main'” įava.io. FileNotFoundException: aaaa 《No such file or directory) at java.base/java.io.FileInputStream.open&(Native Method) at java.base/java.io. FileInputStream, open(EileInputStream java:219) at java.base/java.io.FileInputStream, cinit (EileInputStream java: 157) at java.base/va.io.FileReader.cinit (EileReader java:75 at prog88_investnentmanager.main(erog8 investmentnanager java:59) Smart Insert 22:11
Quick Access prog08 investmentmanagerjava testt, java 51 52 53 else /try-quirements All Find 57 59 61 63 65 Scanner fileReader-new Scanner(new FileReader(ileInput)); boolean firstし1ne true ; doublel investmentnull; /investment nullouLLnuL int investnentSum8; int indexe double sun-e; /investment total // İndex //sum 67 68 69 70 71 72 73 74 75 if (fileReader.hasNext(O) if (firstLine) investmentSum= Integer.parseInt(fileReader.nextLine()) ; investment new doublelinvestmentSun): /investment sum firstLine = false; else 78 investment [index) Double.parseDouble(fileReader.nextLine()); sum+-investment[indexl: I/sum and investment index+t input: Scanne 83 for(int 1-8;1 investment [j]) 90 91 92 double inv investment [i]; investment[ilinvestnent [j]: Problems @Javadoc鳳Declaration search曰CongoleX eterminated> prog08 investmentmanager (Java Appication] /LibraryyJava/JavavirtualMachinesidk-11.0.2.jdk/ContentsyHomeybinjava (Apr 23, 2019, 12:47:35 AM) Input file name: File not found- try again: Exception in thread “main'” įava.io. FileNotFoundException: aaaa 《No such file or directory) at java.base/java.io.FileInputStream.open&(Native Method) at java.base/java.io. FileInputStream, open(EileInputStream java:219) at java.base/java.io.FileInputStream, cinit (EileInputStream java: 157) at java.base/va.io.FileReader.cinit (EileReader java:75 at prog88_investnentmanager.main(erog8 investmentnanager java:59) Smart Insert 51: 18
Quick Access to investment [j] = inv; //investment 94 95 96 int typesnew int[51 for int1-8; 1 = 750 && investment [1]

Expert Answer


Answer to So, there was a Part 1 I did, as a heads up. My response is below underneath the Part 2 instructions. I do not understan… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *