Assume that multiple arithmetic operations? are stored in a file. However, some of the results are wrong. Write a method that finds the operations which the results are wrong in given file. For example, given operations 1.0 + 2.0 = 4.0 %3D 2.5 + 2.5 5.0 %3D 3.0 / 2.0 1.0 %3D the method should return Oth and 2nd line strings. Note: Do not round the numbers in any step of the calculation.
Q: Write a method called boyGirl that accepts a Scanner that is reading its input from a file…
A: Write a method called boyGirl that accepts a Scanner that is reading its input from a file…
Q: Write a method called wordLengths that accepts a Scanner for an input file as its parameter. Your…
A: Please find the answer below :
Q: Write a program that replaces each line of a file with its reverse. For example, if you run java…
A: Program description: The main objective of the Reverse.java file is to read a java file,…
Q: Modify java code for Hw5 (stock,each csv file has headings: Date,Open,High,Low,Close, Adj…
A: import java.util.*; import java.io.*; public class StockData {…
Q: write a program that will open a file called “story.txt” and count the number of occurrences of each…
A: EXPLANATION: Used system call fopen,we have opened the file "file1.txt"in read mode System call…
Q: In the program below for decomposing the entered number into its prime numbers, the location of the…
A: Find the required answer with explanation given as below :
Q: In a file called MarchSundays.java, write a program satisfying these specs: The program asks the…
A: Program code #1:
Q: I am trying to figure out why the sum at the end of my Java code is not working correctly. It keeps…
A: import java.io.FileWriter; import java.io.File;import java.util.Scanner; public class Main{…
Q: In the program below for decomposing the entered number into its prime numbers, the location of the…
A: The correct answer of the above MCQ is b. ss:do{
Q: ume that there is a data file named as “data.txt”. This data file contains integer values in…
A: I have given java code below.
Q: 4) Create a method which takes two int parameters and swaps them. Print the values before and after…
A: #include <iostream> using namespace std; int main() { int x,y; cout<<"Enter 1st…
Q: A file named ClassData.txt contains records of several students. Each record contains student's name…
A: The following information is given: A file "ClassData.txt" with detail is given of each student…
Q: Assume that a N x M matrix is stored in a file. However, the file is corrupted somehow, and some…
A: public String[][] fillData(int n, int m, String file) throws FileNotFoundException { String [][]…
Q: Write a program that asks the user to enter a character. Then pass the character to the following…
A: Program description: The java progrm,Main.java prompts the user to enter a character from the…
Q: Write a static void method that accepts as its only parameter a string file name. Using the data…
A: EXPLANATION: - static void readFile(String filename) : - The file read operation is performed with…
Q: Write a program that will read the file text.txt which is provided and the encrypted message in…
A: Program code: //import the required packages import java.util.*; import java.io.*; //define a…
Q: Using JAVA Your client owns a bookstore, and they need to process an input file containing the…
A: Programming instructions: Include necessary header files. Create a class. In the class, Create a…
Q: Write a program that first reads in the name of an input file, followed by two strings representing…
A: Solution:: Python code :: #Taking inputs from the user file_name=input("Enter the Path and name…
Q: to input names of two persons (preferably of different genders) and output their resulting…
A: The task here includes various operations such as arithmetic operation, logical operation, etc.…
Q: A file named ClassData.txt contains records of several students. Each record contains student's name…
A: import java.util.Scanner;import java.io.*; public class Main { static double…
Q: InputOutput Class: write a program that carries out the following tasks: o Create an object of type…
A: A) Programming instructions: Include necessary header files. Create a class, InputOutput class. In…
Q: Is the character repeating problem Within the Utils class that is provided to you in "Requested…
A:
Q: What is printed by the function foo5()? class Point: def __init__(self, x, y): self.x = x self.y = y…
A: In this problem we need to show the what will be the output of the above code. Need to call the…
Q: . What is the purpose of the line marked as "Line1" in the following code? E = {} fh =…
A: #line1 marked because readline reads only first line of the file and that is indication of comment…
Q: Write a Java program that generates random numbers with your ID as the Class Name. Use a Do-While…
A: Java is a programming language originally developed by James Gosling at Sun Microsystems (which is…
Q: In Java Only: My program is not working correctly, The history teacher at your school needs help…
A: Note: As you have asked to remove the "NullPointerException" from the calculatePoint function of the…
Q: Write a method public static intreadInFile(String line, File file) that returns the position…
A: Program Plan: Import necessary libraries required for file creation,BufferedReader,IOException and…
Q: every line and it splits the line by comm
A: To split the string by space or comma, pass a following regular expression to the split() method -…
Q: For the ReadWords class that is used to read the content of a given text file, which of the…
A: ANSWER C) public ReadWords() throws FileNotFoundException {...}
Q: Write a method which can read and parse a file containing information about weekly feedback from…
A: Actually, program is a executable software that runs on a computer.
Q: In python using beginners methods (no custom classes etc) and small files - How do I have a user…
A: import rebadFile = open('E:\\file.txt', 'r') #read existing fileprint("Old Content…
Q: Write a method named negativeSum that accepts a Scanner as a parameter reading input from a file…
A: Pass 'scanner console' as a parameter which reads input from a file containing a series of…
Q: Write a method that takes a celsius input from user and converts given value to other units of…
A:
Q: Write a program to read and store four student’s name and their Salaries, sort them into an order…
A: Write a program to read and store four student’s name and their Salaries, sort them into an order…
Q: File sourceFolder, String filename
A: Answer: Note: Done accordingly. Please comment for any problem. Please Uprate. Thanks Code: package…
Q: Java: Write a static method named textCount that takes a Scanner representing a file as a parameter…
A: Actually, the code has given below:
Q: Write a method which is passed the name of a text file which contains grades in a course thať's in…
A: public static double highestSemAverage(String filename) throws FileNotFoundException{ Scanner fin…
Q: The extraterrestrials living in the planet Numerion revere a specific type of integers N. In…
A: Program code #1:
Q: Write a program to read and store four student's car number and their distances, sort them into an…
A: For this problem, a class Student with instance variables id, car number and distance is created.…
Q: (Replace words) Suppose you have a lot of files in a directory that contain words Exercisei j.,…
A: Code:- import java.util.*;import java.io.*; public class Exercise_12_27 { /** Main method */ public…
Q: I am trying to figure out why the sum at the end of my Java code is not working correctly. It keeps…
A: the answer is given below:-
Q: REUPLOAD: I need to fill the program to its designated output I have inserted sample runs and the…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: The program should be named: xxxx_Lab8.java (XXXX Is your email ID). 2. Implement the necessary…
A: Here, we have to write java program for the above problem.
Q: need main method that connects to a second method with user input and prints like the example below.…
A: A Java program takes enter values from the command line and prints a string of characters as output.…
Q: Write a program that replaces each line of a file with its reverse. For example, if you run java…
A: JAVA program that replaces each line of file with its reverse import java.util.*;import…
Q: ABC airport has a list of travelers kept in a file (see below) and has asked you to write a complete…
A: import java.util.*;import java.lang.*;import java.io.*; class solution{ public static String[][]…
Q: A store owner keeps a record of daily cash transactions in a text file. Each line contains three…
A: Given
Step by step
Solved in 2 steps
- Assume that multiple arithmetic operations? are stored in a file. However, some of the results are wrong. Write a method that finds the operations which the results are wrong in given file. For example, given operations 1.0 + 2.0 4.0 2.5 + 2.5 = 5.0 3.0 / 2.0 1.0 the method should return Oth and 2nd line strings. Note: Do not round the numbers in any step of the calculation.ABC airport has a list of travelers kept in a file (see below) and has asked you to write a complete Q7 program that reads from the user a filename and a destination and prints all the travelers (Format: --Last name, First name) that travelled to that destination. O points if you code everything in main. You should have at least 2 methods: main and one other method (excluding the readFile method). You can assume that the method: public static String (] [] readFile (String filename) is available (in the same program). That is, you can just use it to read from the file. It returns a String[][] with as many rows as lines in the file, and each row will have as many Strings as comma-separated items on that line in the file. For the sample file below, the String[]] will look like this: [ ["Alex Aiono","Johanesburg", "8-6-2017"], ["Marcus Schultz","Marrakech","1-24-2017"], ..] Sample file (travelers.txt) DO NOT HARDCODE THE FILE NAME. Alex Aiono,Johanesburg,8-6-2017 Marcus Schultz,Marrakech,…Question 3: Write the bin2Dec(String binaryString) method to convert a binary string into a decimal number (your method should return an integer). Implement the bin2Dec method to throw a NumberFormatException if the string is not a binary string. Test your method in a program that prompts the user to input a binary string and uses your bin2Dec method to print out the decimal equivalent of that string. If the method throws an error, have your program catch it and print "Not a binary string." before terminating.
- Java: Write a static method named textCount that takes a Scanner representing a file as a parameter and that reports various statistics about the file. In particular, your method should report the number of lines in the file, the total number of characters (not counting any new-line \n characters) in the file, and the length and text of the longest line. You may assume that the input file has at least one line of input. For example, if the file contains the following text: Twas brillig and the slithy toves did gyre and gimble in the wabe. All mimsey were the borogroves, and the mome raths outgrabe. "Beware the Jabberwock, my son, the jaws that bite, the claws that catch, Beware the JubJub bird and shun the frumious bandersnatch." The program would find that there are 9 lines (blank lines count), a total of 254 characters in the file (33 on the first line, 32 on the next line, 31 on the next line, 28 on the next, 0 on the next, etc) and that the longest line is the one that begins…File Factorials.java contains a program that calls the factorial method of the MathUtils class to compute the factorials of integers entered by the user. Save these files to your directory and study the code in both, then compile and run Factorials to see how it works. Try several positive integers, then try a negative number. You should find that it works for small positive integers (values < 17), but that it returns a large negative value for larger integers and that it always returns 1 for negative integers. Returning 1 as the factorial of any negative integer is not correct—mathematically, the factorial function is not defined for negative integers. To correct this, you could modify your factorial method to check if the argument is negative, but then what? The method must return a value, and even if it prints an error message, whatever value is returned could be misconstrued. Instead it should throw an exception indicating that something went wrong so it could not complete its…Computer Science Consider a look-up service for the television shows on a given date. A file contains information about these shows. Each show’s data appears on two lines. The first line gives the name of the station, the channel, the name of the show, and a rating. These entries are separated by tildes (~). The second line briefly describes the show. Write pseudocode for a method with the header public void readFile(Scanner data) to read the file into a dictionary that will be searched. Decide what data should be the search key and what should be the associated value. Design any classes needed for the key and the value. Write pseudocode for the method Do not write any code for the answer. Use UML, pseudocode, and written Description.
- hello im stuck on a problem and it would be great if you could create a program that prompts the user for a message to encode,as well as an offset to encrypt it with. You will then create and use the following methods:• A validation method that takes in the message (as a string) and the offset integerentered by the user. The method should return “true” if the offset is between 0and 26 inclusively and the message contains only letters and spaces. If it failseither criteria, it should return “false”.• If the validation method returns true, a second encryption method should becalled. This method also takes in the message (as a string) and the offset integerentered by the user. It should convert the message to UPPERCASE, encryptevery letter in the message, and leave the spaces as they were. It should thenreturn the encrypted message. i attached an image of the sample outputIn python using beginners methods (no custom classes etc) and small files - How do I have a user find and replace bad information in a text file? My instructor says: The program will READ in data from a text file named StudyHours.txt. The user corrects any bad data. The program updates the information in StudyHours.txt file. For example if the file contains a letter grade of K which is not a possible letter grade. StudyHours.txt contains the following data: first line full name second line number of credits third line grade desired for each class Example format StudyHours.txt file Aaron RODgers 12 A Tom brady 9 K philip Rivers apple c Joe Theismann 15 B I need to show the user the contents of the file, have them enter in corrections, and then update the file with the correct information with the bad information deleted. So far I have this: import os def main():found = False badFile = open('StudyHours.txt', 'r') print(badFile.read()) search = input('Enter what you want to…Description the file Numbers.java is given below and You will complete this class. A method called input() will askthe user how many numbers will be entered, and then receive those values from the keyboard.HINT: This will require a loop. As you read the numbers, retain the smallest in the min attribute,retain the largest in the max attribute, and add up the numbers into the sum attribute.Add the code to the average() method to calculate the average of the numbers and place it intothe declared variable.
- In JAVA, write a program in a single file that: Main: Creates 10 random doubles, all between 1 and 11, Calls a method that writes 10 random doubles to a text file, one number per line. Calls a method that reads the text file and displays all the doubles and their sum accurate to two decimal places. SAMPLE OUTPUT 10.62691196041722.7377903389094555.4279257388651281.37420580654725091.18587002624988364.1803912764852284.9109699989306755.7108582343439587.7908570073730523.1806714736219543 The total is 47.13JAVA PPROGRAM Please Modify this program with further modifications as listed below: ALSO, take out and change the following in the program: System.out.println("Program terminated."); because the test case does not need it And change this in the program: Please enter the file name or type QUIT to exit:\n so it reperats once for every test case because it repeats twice in every case as shown in the screenshot. I only need it once. I have provided the failed the test cases and the inputs as a screenshot. The program must pass the test case when uploaded to Hypergrade. import java.io.*;import java.util.ArrayList;import java.util.Scanner;public class SymmetricalNameMatcher { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String fileName; do { // Prompt the user to enter a file name or 'QUIT' to exit. System.out.print("Please enter the file name or type QUIT to exit:\n"); fileName =…Program62.javaWrite a program that prompts for a full name (first and last) and assigns it to one string. The program then passes the full name to a void method as its sole parameter. The void method should print the first name, on one line, as many times as indicated by the length of the last name. Sample Output (image below)