The
Your project is to read in a series of fractions from a text file, which will have each line formatted as follows: “A/B”. A sample text file is listed below, and the purpose of your program is to read in each fraction and count the number of occurrences for the current fraction. When all the input is consumed (or as the input is consumed), your program will print out its list of unique fraction and their corresponding count — see the output below (and you may assume no blank lines or misleading characters; see the text file link on the website for one of the actual inputs I’ll use when testing your submission).
The fractions should always be represented as two integers - DO NOT USE DECIMALS.
Only use arrays to hold your data. Do not use Java's ArrayList. We will discuss in class how to grow your array.
Sample Text Input
6/3
7/3
6/3
12/6
Sample Console Output
6/3 has a count of 3
7/3 has a count of 1
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- : A monochrome screen is stored as a single array of bytes, allowing eight consecutivepixels to be stored in one byte. The screen has width w, where w is divisible by 8 (that is, no byte willbe split across rows). The height of the screen, of course, can be derived from the length of the arrayand the width. Implement a function that draws a horizontal line from (xl, y) to (x2, y).The method signature should look something like:drawLine(byte[] screen, int width, int xl, int x2, int y)arrow_forwardWrite a program that reads movie data from a csv (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the csv file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator (|) in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the csv file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Ex: If the input of the program is: movies.csv and the contents of movies.csv…arrow_forwardWrite a program in C that create a 3-by-5 array. All elements in the array are random integer numbers between 1 and 100. Then, put all elements of the two-dimensional array into a one-dimensional array. Finally, calculate the mean value and the median value of 1-D array. Print out the 2-D array, original 1-D array, sorted 1-D array, and the mean value and the median value of 1-D array.arrow_forward
- For JAVA.arrow_forwardWrite a complete program to do the following: The main program calls a method to read in (from an input file) a set of people's three-digit ID numbers and their donations to a charity (hint: use parallel arrays). Then the main program calls a method to sort the ID numbers into numerical order, being sure to carry along the corresponding donations. The main program then calls a method to print the sorted lists in tabular form, giving both ID numbers and donations. Then the main program calls another method to sort the donation amounts into descending order, carrying along the corresponding ID numbers. It then, once again, prints the sorted lists, giving both ID numbers and donations. Finally it prints some statistics (see below). Here are the details: The main program calls a method to read in the data from a file. (This method will declare and create the input file variable. Don't forget to throw exceptions.) The data consists of sets of lines of data, each of which contains a person's…arrow_forwardI need to write a Java ArrayList program called Search.java that counts the names of people that were interviewed from a standard input stream. The program reads people's names from the standard input stream and from time to time prints a sorted portion of the list of names. All the names in the input are given in the order in which they were found and interviewed. You can imagine a unique timestamp associated with each interview. The names are not necessarily unique (many of the people have the same name). Interspersed in the standard input stream are queries that begin with the question mark character. Queries ask for an alphabetical list of names to be printed to the standard output stream. The list depends only on the names up to that point in the input stream and does include any people's names that appear in the input stream after the query. The list does not contain all the names of the previous interviews, but only a selection of them. A query provides the names of two people,…arrow_forward
- I could really use some help with a problem I got for coding. A screenshot showing an example would help.arrow_forwardWrite a program that queries information from three files(given to you). The first file contains the names and telephone numbers of a group of people. The second file contains the names and Social Security numbers of a group of people. The third file contains the names and annual income of a group of people. The groups of people should overlap. Your program should ask the user for a telephone number and then print the name, Social Security number, and annual income, if it can determine that information. Sample run1: Enter the phone number (7 digits, with a dash): 555-1234 555-1234 is associated with Bob Bob's SSN is 000300021 Bob's salary is 55000 Sample run2: Enter the phone number (7 digits, with a dash): 675-4566 Couldn't find a name associated with that number. Sample run3: Enter the phone number (7 digits, with a dash): 000-2345 000-2345 is associated with John John's SSN is 000000004 John's salary is 65000 python languagearrow_forwardwrite the java programarrow_forward
- java a. A method named contains exists that takes an array of Strings and a single String, in that order, as arguments and returns a boolean value that is true if the array contains the given String. Assume that an array of Strings named names is already declared and initialized. Call the method to see if the array contains the name "Fred", and save the result in a new variable named fredIsHere. b. Given a method named printMessage that takes a String argument and returns nothing, call the method to print out "I love Java!".arrow_forwardI need help with creating a Java program described below: Minesweeper.Write a program that reads three numbers, m, n, and p and produces an m-by-n Booleanarray where each element is occupied with probability p. In the minesweeper game, occupiedcells represent bombs and empty cells represent safe cells.Print out the array using an asterisk for bombs and a period for safe cells.Then, create an integer two-dimensional array with the number of neighboring bombs (above,below, left, right, or diagonal). * * . . . * * 1 0 0. . . . . 3 3 2 0 0 . * . . . 1 * 1 0 0Write your code so that you have as few special cases as possible to deal with, by using an(m+2)-by-(n+2) Boolean array.arrow_forwardWrite a program in java that will continue to prompt the user for numbers, storing them in an array, until they enter "Done" to finish, then prompts the user for a file name so that these values can be saved to that file. For example, if the user enters "output.txt", then the program should write the numbers that have been read to "output.txt".arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education