diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..001ed93 Binary files /dev/null and b/.DS_Store differ diff --git a/out/.DS_Store b/out/.DS_Store new file mode 100644 index 0000000..409ad9b Binary files /dev/null and b/out/.DS_Store differ diff --git a/out/production/.DS_Store b/out/production/.DS_Store new file mode 100644 index 0000000..0aede84 Binary files /dev/null and b/out/production/.DS_Store differ diff --git a/out/production/c4t-java/.DS_Store b/out/production/c4t-java/.DS_Store new file mode 100644 index 0000000..35a54bf Binary files /dev/null and b/out/production/c4t-java/.DS_Store differ diff --git a/out/production/c4t-java/com/.DS_Store b/out/production/c4t-java/com/.DS_Store new file mode 100644 index 0000000..1e3f56c Binary files /dev/null and b/out/production/c4t-java/com/.DS_Store differ diff --git a/out/production/c4t-java/com/codefortomorrow/.DS_Store b/out/production/c4t-java/com/codefortomorrow/.DS_Store new file mode 100644 index 0000000..2c1a080 Binary files /dev/null and b/out/production/c4t-java/com/codefortomorrow/.DS_Store differ diff --git a/out/production/c4t-java/com/codefortomorrow/beginner/.DS_Store b/out/production/c4t-java/com/codefortomorrow/beginner/.DS_Store new file mode 100644 index 0000000..842516a Binary files /dev/null and b/out/production/c4t-java/com/codefortomorrow/beginner/.DS_Store differ diff --git a/out/production/c4t-java/com/codefortomorrow/beginner/chapter2/.DS_Store b/out/production/c4t-java/com/codefortomorrow/beginner/chapter2/.DS_Store new file mode 100644 index 0000000..e13e80b Binary files /dev/null and b/out/production/c4t-java/com/codefortomorrow/beginner/chapter2/.DS_Store differ diff --git a/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/.DS_Store b/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/.DS_Store new file mode 100644 index 0000000..01a4594 Binary files /dev/null and b/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/.DS_Store differ diff --git a/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/ParallelArrayGradedAssignmentAMunshi copy.class b/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/ParallelArrayGradedAssignmentAMunshi copy.class new file mode 100644 index 0000000..92d8bcd Binary files /dev/null and b/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/ParallelArrayGradedAssignmentAMunshi copy.class differ diff --git a/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/ParallelArrayProgramAMunshi copy.class b/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/ParallelArrayProgramAMunshi copy.class new file mode 100644 index 0000000..d3db6cc Binary files /dev/null and b/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/ParallelArrayProgramAMunshi copy.class differ diff --git a/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/ParallelArrayPrograms copy.class b/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/ParallelArrayPrograms copy.class new file mode 100644 index 0000000..27b0452 Binary files /dev/null and b/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/ParallelArrayPrograms copy.class differ diff --git a/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/twoDArrayProgramsAMunshi copy.class b/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/twoDArrayProgramsAMunshi copy.class new file mode 100644 index 0000000..8a283e5 Binary files /dev/null and b/out/production/c4t-java/com/codefortomorrow/beginner/chapter9/solutions/twoDArrayProgramsAMunshi copy.class differ diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000..35a54bf Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/com/.DS_Store b/src/com/.DS_Store new file mode 100644 index 0000000..1e3f56c Binary files /dev/null and b/src/com/.DS_Store differ diff --git a/src/com/codefortomorrow/.DS_Store b/src/com/codefortomorrow/.DS_Store new file mode 100644 index 0000000..0b080cb Binary files /dev/null and b/src/com/codefortomorrow/.DS_Store differ diff --git a/src/com/codefortomorrow/beginner/.DS_Store b/src/com/codefortomorrow/beginner/.DS_Store new file mode 100644 index 0000000..baad6cc Binary files /dev/null and b/src/com/codefortomorrow/beginner/.DS_Store differ diff --git a/src/com/codefortomorrow/beginner/chapter1/.DS_Store b/src/com/codefortomorrow/beginner/chapter1/.DS_Store new file mode 100644 index 0000000..65267a9 Binary files /dev/null and b/src/com/codefortomorrow/beginner/chapter1/.DS_Store differ diff --git a/src/com/codefortomorrow/beginner/chapter2/.DS_Store b/src/com/codefortomorrow/beginner/chapter2/.DS_Store new file mode 100644 index 0000000..e13e80b Binary files /dev/null and b/src/com/codefortomorrow/beginner/chapter2/.DS_Store differ diff --git a/src/com/codefortomorrow/beginner/chapter9/.DS_Store b/src/com/codefortomorrow/beginner/chapter9/.DS_Store new file mode 100644 index 0000000..fbbe928 Binary files /dev/null and b/src/com/codefortomorrow/beginner/chapter9/.DS_Store differ diff --git a/src/com/codefortomorrow/beginner/chapter9/Solutions/.DS_Store b/src/com/codefortomorrow/beginner/chapter9/Solutions/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/src/com/codefortomorrow/beginner/chapter9/Solutions/.DS_Store differ diff --git a/src/com/codefortomorrow/beginner/chapter9/Solutions/ParallelArrayGradedAssignmentAMunshi.java b/src/com/codefortomorrow/beginner/chapter9/Solutions/ParallelArrayGradedAssignmentAMunshi.java new file mode 100644 index 0000000..5c8a737 --- /dev/null +++ b/src/com/codefortomorrow/beginner/chapter9/Solutions/ParallelArrayGradedAssignmentAMunshi.java @@ -0,0 +1,154 @@ +package parallelArrayGradedAssignmentAMunshi; + +import java.util.Scanner; + +public class ParallelArrayGradedAssignmentAMunshi +{ + + public static void main(String[] args) + { + Scanner reader = new Scanner (System.in); + + // Case, death, and recovery numbers are those reported by John Hopkins University at 2:01 PM on Wednesday 4/22/2020 + // Population is as reported by worldometers.info at 2:01 PM on 4/22/2020 + // Death rate, recovery rate, and infection rate are calculated using above data. + // Alveera's Risk Letter Grade is self determined and is a fun educated guess not actual scientific fact + + //Data + String countries[] = {"United States", "Spain", "Italy", "France", "Germany", "United Kingdom", "Turkey", "Iran", "China", "Russia"}; + String capitals[] = {"Washington D.C.", "Spain", "Rome", "Paris", "Berlin", "London", "Ankara", "Tehran", "Beijing", "Moscow"}; + int population[] = {331002651, 46754778, 60461826, 65273511, 83783942, 67886011, 84339067, 83992949, 1439323776, 145934462}; + int numofcases[] = {826248, 208389, 183957, 159315, 149044, 134635, 95591, 85996, 83868, 57999}; + int deaths[] = {45894, 21717, 25085, 20829, 5165, 18151, 2376, 5391, 4636, 513}; + int recoveries[] = {76070, 85915, 54543, 39850, 99400, 676, 16477, 63113, 77861, 4420}; + double deathrate[] = {Math.round(deaths[0]/(double)numofcases[0]*10000)/100.0, Math.round(deaths[1]/(double)numofcases[1]*10000)/100.0, Math.round(deaths[2]/(double)numofcases[2]*10000)/100.0, Math.round(deaths[3]/(double)numofcases[3]*10000)/100.0, Math.round(deaths[4]/(double)numofcases[4]*10000)/100.0, Math.round(deaths[5]/(double)numofcases[5]*10000)/100.0, Math.round(deaths[6]/(double)numofcases[6]*10000)/100.0, Math.round(deaths[7]/(double)numofcases[7]*10000)/100.0, Math.round(deaths[8]/(double)numofcases[8]*10000)/100.0, Math.round(deaths[9]/(double)numofcases[9]*10000)/100.0}; + double recoveryrate[] = {Math.round(recoveries[0]/(double)numofcases[0]*10000)/100.0, Math.round(recoveries[1]/(double)numofcases[1]*10000)/100.0, Math.round(recoveries[2]/(double)numofcases[2]*10000)/100.0, Math.round(recoveries[3]/(double)numofcases[3]*10000)/100.0, Math.round(recoveries[4]/(double)numofcases[4]*10000)/100.0, Math.round(recoveries[5]/(double)numofcases[5]*10000)/100.0, Math.round(recoveries[6]/(double)numofcases[6]*10000)/100.0, Math.round(recoveries[7]/(double)numofcases[7]*10000)/100.0, Math.round(recoveries[8]/(double)numofcases[8]*10000)/100.0, Math.round(recoveries[9]/(double)numofcases[9]*10000)/100.0}; + double infectionrate[] = {Math.round(numofcases[0]/(double)population[0]*10000)/100.0, Math.round(numofcases[1]/(double)population[1]*10000)/100.0, Math.round(numofcases[2]/(double)population[2]*10000)/100.0, Math.round(numofcases[3]/(double)population[3]*10000)/100.0, Math.round(numofcases[4]/(double)population[4]*10000)/100.0, Math.round(numofcases[5]/(double)population[5]*10000)/100.0, Math.round(numofcases[6]/(double)population[6]*10000)/100.0, Math.round(numofcases[7]/(double)population[7]*10000)/100.0, Math.round(numofcases[8]/(double)population[8]*10000)/100.0, Math.round(numofcases[9]/(double)population[9]*10000)/100.0}; + char riskgrade[] = new char [10]; + + // Determining Risk Grade + for (int x = 0; x < countries.length; x++) + { + if (infectionrate[x] > 0.25 || deathrate[x] > 25) + { + riskgrade[x] = 'A'; + } + else if (infectionrate[x] > 0.2 || deathrate[x] > 15) + { + riskgrade[x] = 'B'; + } + else if (infectionrate[x] > 0.15 || deathrate[x] > 10) + { + riskgrade[x] = 'C'; + } + else if (infectionrate[x] > 0.1 || deathrate[x] > 5) + { + riskgrade[x] = 'D'; + } + else + { + riskgrade[x] = 'F'; + } + } + + // Printing out instructions + System.out.println("The following countries have been stored in our database:"); + System.out.println("[United States, Spain, Italy, France, Germany, United Kingdom, Turkey, Iran, China, Russia]\n"); + System.out.println("The following stats are available for selection:"); + System.out.println("[Capital, Number of Cases, Population, Deaths, Recoveries, Death Rate, Recovery Rate, Infection Rate, Risk Grade]"); + System.out.println("\t**Risk Grade is a rating of how dangerous the virus is in that country, A being most dangerous and F being least dangerous.\n"); + System.out.println("Type \"quit\" to end the program.\n"); + + String country = ""; + String stat = ""; + int index = -1; + + // Enter a country + while (!country.equalsIgnoreCase("quit")) + { + while (index == -1) + { + System.out.print("Which country’s stats would you like to research? "); + country = reader.nextLine(); + // Break While + if (country.equalsIgnoreCase("quit")) + { + index = -2; + } + // Finds index + for (int x = 0; x < countries.length; x++) + { + if (countries[x].equalsIgnoreCase(country)) + { + index = x; + } + } + // Invalid Response + if (index == -1) + { + System.out.println("This response was invalid; try again."); + } + } + + // QUIT GAME + if (country.equalsIgnoreCase("quit")) + { + break; + } + + // Instructions + System.out.print("Which stat would you like? "); + stat = reader.nextLine(); + System.out.println(); + + // Bring stat + if (stat.equalsIgnoreCase("capital")) + { + System.out.println(countries[index] + "'s capital is " + capitals[index] + "."); + } + else if (stat.equalsIgnoreCase("number of cases")) + { + System.out.println(countries[index] + " has " + numofcases[index] + " cases of COVID-19."); + } + else if (stat.equalsIgnoreCase("population")) + { + System.out.println(countries[index] + " has a population of " + population[index] + " people."); + } + else if (stat.equalsIgnoreCase("deaths")) + { + System.out.println(countries[index] + " has " + deaths[index] + " coronavirus related deaths."); + } + else if (stat.equalsIgnoreCase("recoveries")) + { + System.out.println(countries[index] + " has " + recoveries[index] + " people who recovered from COVID-19."); + } + else if (stat.equalsIgnoreCase("death rate")) + { + System.out.println(countries[index] + " has a " + deathrate[index] + "% coronavirus death rate."); + } + else if (stat.equalsIgnoreCase("recovery rate")) + { + System.out.println(countries[index] + " has a " + recoveryrate[index] + "% coronavirus recovery rate."); + } + else if (stat.equalsIgnoreCase("infection rate")) + { + System.out.println(countries[index] + " has a " + infectionrate[index] + "% COVID-19 infection rate."); + } + else if (stat.equalsIgnoreCase("risk grade")) + { + System.out.println(countries[index] + " has a risk grade of " + riskgrade[index] + "."); + } + else + { + System.out.println("This response was invalid; try again."); + } + + // Prepare for loop + index = -1; + System.out.println(); + System.out.println(); + } + reader.close(); + } + +} diff --git a/src/com/codefortomorrow/beginner/chapter9/Solutions/ParallelArrayProgramAMunshi.java b/src/com/codefortomorrow/beginner/chapter9/Solutions/ParallelArrayProgramAMunshi.java new file mode 100644 index 0000000..2d2cf1b --- /dev/null +++ b/src/com/codefortomorrow/beginner/chapter9/Solutions/ParallelArrayProgramAMunshi.java @@ -0,0 +1,82 @@ +package parallelArrayProgramAMunshi; + +import java.util.Scanner; + +public class ParallelArrayProgramAMunshi +{ + + public static void main (String[]args) + { + + Scanner reader = new Scanner (System.in); + + String title[] = {"Game of Thrones", "Breaking Bad", "The Walking Dead", "Supernatural", "FRIENDS", "Doctor Who", "Black Mirror", "The Simpsons", "The Big Bang Theory", "How I Met Your Mother"}; + int seasons[] = {8, 5, 10, 15, 10, 12, 5, 31, 12, 9}; + int episodes[] = {73, 62, 144, 319, 236, 156, 22, 676, 281, 208}; + int wins[] = {313, 138, 69, 22, 71, 113, 23, 173, 67, 25}; + int nominations[] = {505, 217, 195, 85, 211, 195, 75, 309, 236, 90}; + double rating[] = {8.8, 9.0, 8.1, 8.5, 8.5, 7.7, 7.9, 7.2, 7.9, 8.2}; + int start[] = {2011, 2008, 2010, 2005, 1994, 2005, 2011, 1989, 2007, 2005}; + int end[] = {2019, 2013, 2020, 2020, 2004, 2020, 2020, 2020, 2019, 2014}; + + System.out.println("The following shows have been stored in the array:\n"); + System.out.println("[Game of Thrones, Breaking Bad, The Walking Dead, Supernatural, FRIENDS, Doctor Who, Black Mirror, The Simpsons, The Big Bang Theory, How I Met Your Mother]"); + System.out.println("The following stats are available for selection:\n"); + System.out.println("[Seasons, Episodes, Wins, Nominations, Rating, Start Year, End Year]\n"); + System.out.println("Type \"quit\" to end the program.\n"); + + String show = ""; + String stat = ""; + int index = 0; + while (!show.equalsIgnoreCase("quit")) + { + System.out.print("Which show’s stats would you like to research? "); + show = reader.nextLine(); + if (show.equalsIgnoreCase("quit")) + { + break; + } + for (int x = 0; x < title.length; x++) + { + if (title[x].equalsIgnoreCase(show)) + { + index = x; + } + } + System.out.print("Which stat would you like? "); + stat = reader.nextLine(); + if (stat.equalsIgnoreCase("seasons")) + { + System.out.println(show + " has aired " + seasons[index] + " seasons."); + } + if (stat.equalsIgnoreCase("episodes")) + { + System.out.println(show + " has aired " + episodes[index] + " episodes."); + } + if (stat.equalsIgnoreCase("wins")) + { + System.out.println(show + " recieved " + wins[index] + " wins."); + } + if (stat.equalsIgnoreCase("nominations")) + { + System.out.println(show + " recieved " + nominations[index] + " nominations."); + } + if (stat.equalsIgnoreCase("rating")) + { + System.out.println(show + " has a rating of " + rating[index]); + } + if (stat.equalsIgnoreCase("start year")) + { + System.out.println(show + " started airing in " + start[index] + " seasons."); + } + if (stat.equalsIgnoreCase("end year")) + { + System.out.println(show + " last aired in " + end[index] + " seasons."); + } + + System.out.println(); + System.out.println(); + } + + } +} diff --git a/src/com/codefortomorrow/beginner/chapter9/Solutions/ParallelArrayPrograms.java b/src/com/codefortomorrow/beginner/chapter9/Solutions/ParallelArrayPrograms.java new file mode 100644 index 0000000..98f9bd9 --- /dev/null +++ b/src/com/codefortomorrow/beginner/chapter9/Solutions/ParallelArrayPrograms.java @@ -0,0 +1,69 @@ +package parallelArrayPrograms; + +import java.util.Scanner; +public class ParallelArrayPrograms +{ + public static void main(String[]args) + { + //1 + int num[][] = new int [1][5]; + String street[][] = new String [1][5]; + String apt[][] = new String [1][5]; + int zip[][] = new int [1][5]; + initintArray(num, "number"); + initstrArray(street, "street"); + initstrArray(apt, "apartment"); + initintArray(zip, "zipcode"); + System.out.println(); + for (int c = 0; c < num[0].length; c++) + { + if (apt[0][c].equals("-")) + System.out.println(num[0][c] + " " + street[0][c] + " " + zip[0][c]); + else + System.out.println(num[0][c] + " " + street[0][c] + " Apt " + apt[0][c] + " " + zip[0][c]); + } + + //2 + String fn[][] = new String [1][6]; + String li[][] = new String [1][6]; + int id[][] = new int [1][6]; + int pe[][] = new int [1][6]; + int pp[][] = new int [1][6]; + double g[][] = new double [1][6]; + initstrArray(fn, "first name"); + initstrArray(li, "last initial"); + initintArray(id, "student ID"); + initintArray(pe, "points earned"); + initintArray(pp, "points possible"); + for (int c = 0; c < g[0].length; c++) + { + g[0][c] = (pe[0][c])/((double)(pp[0][c])) * 100; + } + System.out.println(); + for (int c = 0; c < fn[0].length; c++) + { + System.out.println(fn[0][c] + " " + li[0][c] + " " + id[0][c] + " " + pe[0][c] + " " + pp[0][c] + " " + (int)g[0][c] + "%"); + } + + } + public static void initintArray (int[][] n, String message) + { + Scanner reader = new Scanner(System.in); + for (int x = 0; x < n[0].length; x++) + { + System.out.print("Please enter a " + message + " " + (x+1) + ": "); + n[0][x] = reader.nextInt(); + } + + } + public static void initstrArray (String[][] n, String message) + { + Scanner reader = new Scanner(System.in); + for (int x = 0; x < n[0].length; x++) + { + System.out.print("Please enter a " + message + " " + (x+1) + ": "); + n[0][x] = reader.nextLine(); + } + + } +} diff --git a/src/com/codefortomorrow/beginner/chapter9/Solutions/twoDArrayProgramsAMunshi.java b/src/com/codefortomorrow/beginner/chapter9/Solutions/twoDArrayProgramsAMunshi.java new file mode 100644 index 0000000..305bde4 --- /dev/null +++ b/src/com/codefortomorrow/beginner/chapter9/Solutions/twoDArrayProgramsAMunshi.java @@ -0,0 +1,95 @@ +package twoDArrayProgramsAMunshi; + +public class twoDArrayProgramsAMunshi { + + public static void main(String[] args) { + + // 1 + int a[][] = new int[4][6]; + int sum = 0; + int max = Integer.MIN_VALUE; + int min = Integer.MAX_VALUE; + for (int x = 0; x < 4; x++) + { + for (int y = 0; y < 6; y++) + { + a[x][y] = (int) (Math.random() * 71 + 7); + System.out.print(a[x][y] + "\t"); + sum += a[x][y]; + if (a[x][y] < min) + min = a[x][y]; + if (a[x][y] > max) + max = a[x][y]; + + } + System.out.println(); + } + System.out.println("Sum: " + sum); + System.out.println("Max: " + max); + System.out.println("Min: " + min); + System.out.println(); + System.out.println(); + + // 2 + String b[][] = new String[3][3]; + String str = "*"; + int ast = 0; + for (int x = 0; x < 3; x++) + { + for (int y = 0; y < 3; y++) + { + b[x][y] = str; + System.out.print(b[x][y] + "\t"); + ast += (x + 1); + + } + System.out.println(); + str += "*"; + } + System.out.println("Number of Asterisks: " + ast); + System.out.println(); + System.out.println(); + + // 3 + int c[][] = new int[5][4]; + for (int power = 2; power < 7; power++) + { + for (int base = 2; base < 6; base++) + { + int res = 1; + for (int j = power; j > 0; j--) + { + + res = res * base; + c[power - 2][base - 2] = res; + } + + System.out.print(c[power - 2][base - 2] + "\t"); + } + System.out.println(); + } + System.out.println(); + System.out.println(); + + //1 + int quiz[][] = new int [3][4]; + for (int row = 0; row < quiz.length; row++) + { + for (int col = 0; col < quiz[row].length; col++) + { + quiz[row][col] = (int) (Math.random() * 37 + 21); + System.out.print(quiz[row][col] + "\t"); + + } + System.out.println(); + } + + sum = 0; + for (int col = 0; col < quiz[1].length; col++) + { + sum+=quiz[1][col]; + } + System.out.println("Sum of row 2: " + sum); + + } +} \ No newline at end of file diff --git a/src/com/codefortomorrow/beginner/chapter9/practice/ParallelArrayGradedAssignmentAMunshi.java b/src/com/codefortomorrow/beginner/chapter9/practice/ParallelArrayGradedAssignmentAMunshi.java new file mode 100644 index 0000000..8c02d6c --- /dev/null +++ b/src/com/codefortomorrow/beginner/chapter9/practice/ParallelArrayGradedAssignmentAMunshi.java @@ -0,0 +1,14 @@ +package parallelArrayGradedAssignmentAMunshi; + +import java.util.Scanner; + +public class ParallelArrayGradedAssignmentAMunshi +{ + + public static void main(String[] args) + { + /*In this assignment, you will be required to have 5 different categories of information regarding a single topic that include String, int, and double array types. The arrays for the program should have 5 elements each. The program should prestore the information. However, the program should allow a Scanner to access information of user choice. You may store the information to the arrays however you see fit, but once it is stored a user should be able to ask for a specific stat for your set of data. The program should loop until the user enters “quit. Once the user types quit, the program should end. You are able to use any notes or previous programs to help aid you in creating this assignment. */ + + } + +} diff --git a/src/com/codefortomorrow/beginner/chapter9/practice/ParallelArrayProgramAMunshi.java b/src/com/codefortomorrow/beginner/chapter9/practice/ParallelArrayProgramAMunshi.java new file mode 100644 index 0000000..40d8677 --- /dev/null +++ b/src/com/codefortomorrow/beginner/chapter9/practice/ParallelArrayProgramAMunshi.java @@ -0,0 +1,32 @@ +package parallelArrayProgramAMunshi; + +import java.util.Scanner; + +public class ParallelArrayProgramAMunshi +{ + + public static void main (String[]args) + { + /*Use parallel arrays to store the following data table below into parallel arrays so that it can be retrieved as requested. You may store the information to the arrays however you see fit, but once it is stored a user should be able to ask for a specific stat for a specific show. The program should loop until the user enters “quit” for the show’s name. Once the user types quit, the program should end. + + +TOP TV SHOWS * Cited from https://www.ratingraph.com/top_tv_shows/ +Title Seasons Episodes Wins Nominations Rating (AVG) Start Year End Year +Game of Thrones 8 73 313 505 8.8 2011 2019 +Breaking Bad 5 62 138 217 9.0 2008 2013 +The Walking Dead 10 144 69 195 8.1 2010 2020 +Supernatural 15 319 22 85 8.5 2005 2020 +FRIENDS 10 236 71 211 8.5 1994 2004 +Doctor Who 12 156 113 195 7.7 2005 2020 +Black Mirror 5 22 23 75 7.9 2011 2020 +The Simpsons 31 676 173 309 7.2 1989 2020 +The Big Bang Theory 12 281 67 236 7.9 2007 2019 +How I Met Your Mother 9 208 25 90 8.2 2005 2014 + + +*/ + + + + } +} diff --git a/src/com/codefortomorrow/beginner/chapter9/practice/ParallelArrayPrograms.java b/src/com/codefortomorrow/beginner/chapter9/practice/ParallelArrayPrograms.java new file mode 100644 index 0000000..a80e280 --- /dev/null +++ b/src/com/codefortomorrow/beginner/chapter9/practice/ParallelArrayPrograms.java @@ -0,0 +1,26 @@ +package parallelArrayPrograms; + +import java.util.Scanner; +public class ParallelArrayPrograms +{ + public static void main(String[]args) + { + /* Store the address information (Number, Street, Apt, and Zip Code) for five individuals. If there is no apartment, the user may enter – and this shouldn’t be included in the printout. Use the data below. + + 23 Chamberlain Ave 08852 + 451 Avenue Q Apt B 10101 + 1 K St Apt P 23456 + 1111 Pitt Ave 19146 + 1313 Elm St Apt Z 08628 + +If you want to try a char array, you will need the Scanner command which is something like: +char c = scan.next().charAt(0); + +2. Allow a user to enter the information for an assignment completed by 6 students, including first name, last initial, student ID number, points earned, and points possible. Then display the information on 6 lines and include the grade as a percent on the assignment. + +Alexandria R 009988602 50 50 100% + +*/ + + } +} diff --git a/src/com/codefortomorrow/beginner/chapter9/practice/twoDArrayProgramsAMunshi.java b/src/com/codefortomorrow/beginner/chapter9/practice/twoDArrayProgramsAMunshi.java new file mode 100644 index 0000000..63b4880 --- /dev/null +++ b/src/com/codefortomorrow/beginner/chapter9/practice/twoDArrayProgramsAMunshi.java @@ -0,0 +1,31 @@ +package twoDArrayProgramsAMunshi; + +public class twoDArrayProgramsAMunshi { + + public static void main(String[] args) { + + /*Fill a 4 X 6 integer array with 24 random values from 7 to 77. +Print the values in 4 rows of 6 elements. +Using the same array, keep track of the sum of all the values in the array. Display the sum on its own line under the values. +Keep track of the maximum and minimum value in the array. Display the max and min on the line below the sum. + +Fill a 3 X 3 string array so that the values in each row are “*”, “**”, “***”. +Print the values in 3 rows of 3 elements, each separated by a tab. +Fill the array in a loop, with a separate variable that will keep track of the number of asterisks in each term. + +Fill a 5 X 4 integer array according to the following pattern: + +4 9 16 25 +8 27 64 125 +16 81 256 625 +32 243 1024 3125 +64 729 4096 15625 + +Print the values in 5 rows of 4 elements. +Use nested loops to fill the values into the array, rather than just declaring the values initially. +*hint*: You can set the values of the first row. (You will then need a loop to print the first row separately from the rest of the array.) + +*/ + + } +} \ No newline at end of file