Your Java program will be reading input from a file name strīnput.txt. Each record contains String firstname String lastName String strSalary (which will be converted to a double if it's valid – see below) char status String cityState (city and state and combine together but separated by a comma)
Q: Suppose the disk file foobar.txt consists of the six ASCII characters foobar Then what is the output…
A: output is f
Q: Does the class PrintWriter have a constructor that accepts a string (for a filename) as an argument,…
A: Yes , class PrintWriter accept the string as name of the file ,that is need to manipulate in the…
Q: Write a program that allows the user to enter name and phone number. Have the program accept input…
A: Please find the answer below :
Q: PYTHON PROGRAM Write a program that will ask a user to input a word and that will check if…
A: Take user input Check if it's a palindrome word or not if YES: Save the word in Palindromes.txt file…
Q: Needs to be written in java using Scanner for user input: Write a program that allows the user…
A: import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.FileWriter;import…
Q: Write a program that reads a file one character at a time and prints out how many times each of the…
A: File name: “Vowels.java” import java.io.FileInputStream; import java.io.FileNotFoundException;…
Q: Write a java application that allows a user to input customer records (ID number, first & last…
A: Input the number of customers Then use a loop to iterate for the input and use FileWriter for…
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: Can this code be modified so there are three sorted files merged instead of two. ( To compile:…
A: Here, I have to write a solution to the above question.
Q: You have a file called (Trapezium.txt). The file contains three lines. Each line contains 3 sides…
A: Java code: import java.io.File; import java.util.Scanner; public class Main { public static void…
Q: you should create a program that takes a file name as an argument, and prints the hex dump of it.…
A: This is complete code that takes a file name as an argument and prints the hex dump of it.
Q: Modify the code so that it writes the contents of String[] into a file named fileLoop1.txt CODE…
A: Java file writer class is used to write character oriented data to a file. It is character oriented…
Q: Write a code fragment where you read user’s entries from the keyboard into three variables - an item…
A: Note: Answering in python as no language is mentioned. Input : item ID (int) item name (string)…
Q: N JAVA What is the error in readFile()? public void readFile(){ FileInputStream fbStream =…
A: Here we are creating a method readFile() Then we create FileInputStream, Scanner reference variables…
Q: Write a program that allows the user to enter name and phone number. Have the program accept input…
A: DirectoryWrite.java import java.io.FileWriter;import java.io.IOException;import…
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: Java's Scanner class has many hasNext methods that can check input for a specific type (e.g.…
A: The answer to the above question is true. The Scanner is responsible for breaking the input into…
Q: What are the contents of the file out.txt after the execution of the following code? advice - 'earn…
A: In this program after splitting by \n we have the content earn awesome kicks driving on route one
Q: In Python, which of the following opens read_it.txt for reading in data text_file varible. a.…
A: 1) In python we use built-in open() function to open the file The open() function returns a file…
Q: Write a program that reads lines of characters froma text file and writes each line as a UTF string…
A: The java program is: import java.io.*; class Exercise17_04 { public static void main(String[]…
Q: i got this error when I try to compile my code. What should I do? Should i change the name of my…
A: We have two option to solve this error: 1) If both class(CompactDisc & Song) in one class then,…
Q: In a file called RemoveVowels.java, write a program that: Asks the user to enter a word of text.…
A: A java program to print the word with all vowels removed is given below;Program:File name:…
Q: Which Java statement correctly writes a string as a line (i.e. followed by new-line character) to a…
A: given data is which java statement correctly writes a string as a line (i.e. followed by new-line…
Q: What is the values in x after running the following code segment? my file = open ('test.txt') x = 0…
A: According to the information given:- We have to find out the value of x after running the program.
Q: The history teacher at your school needs help in grading a True/False test. The students’ IDs and…
A: The, code has given below:
Q: Hey, this is my code below and I cannot seem to get the import.java.io.*; to create and save…
A: I have checked the code and run it accordingly. The code for StaffManager.java is as follows:…
Q: The following program aims to read lines from a text file and prints them on screen Question…
A: The requirement states that from a text file, lines should be read and then will be displayed on the…
Q: Write a program that reads a file one character at a time and prints out how many characters are…
A: File name: “Characters.java” import java.io.File; import java.io.FileInputStream; import…
Q: Write a program that replaces each line of a file with its reverse. For example, if you run java…
A: The required java program is provided below in the next step.
Q: Can someone help me understand why the output file prints an extra number 1, even though the input…
A: File Stream in C++ : C++ gives the accompanying classes to perform yield and contribution of…
Q: describe the use of each variable below that is used in the program above Input output buf a key…
A: #include<iostream>#include<string>#include<fstream>using namespace std;class…
Q: What is wrong with this code it creates a file Exercise17_1 but no input into the file? package…
A: According to the provided information: We have to find out the problem in the program.
Q: Write a program that finds all occurrences of a word in all the filesunder a directory, recursively.…
A: Program: //include the required header files import java.io.*; import java.util.Scanner;…
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: Print the file on the BlueJ console Java Filename: input.txt Number of lines: 5 Longest Line:…
A: The resultant Java code is:import java.io.*;import java.util.Scanner; /*** Write a description of…
Q: 1. Write a Java program that reads the file "input.txt" and calculates and prints the average of all…
A: import java.io.*;public class Main{ public static void main(String[] args) throws IOException…
Q: Write a program that meets the followingrequirements:■■ Get an audio file from the class directory…
A: Program approach Import required classes from JavaFX packages. Create a class PlayAudio that…
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: Write a program, called RemoveText, that removes all the occurrences of a specified string from a…
A: According to the guidelines i can answer only first questions
Q: PYTHON PROGRAMMING Write a program that will ask a user to input a word and that will check if the…
A: Basically, user will be asked to enter number of strings as input, until one wants to quit oneself…
Q: This is a python file Fix this code and the output is the attachment #filename:…
A: You have used “from modValidateEmail import *” and this is not a module in python library and there…
Q: Modify Counter into a program that tells you only the number of lines that are a) shorter than ten…
A: for implementing given problem, that will tell us number of lines that are shorter than 10…
Q: Here is the code that needs to be debugged, Ive done most of it but I think there is a problem in…
A: The ask is to debug the given program which is trying to compare two files and find out which one is…
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: Please TYPE the program, execute it, and capture outputs Modify it so that it write the contents of…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: Consider the following program (includes not shown). filel only contains the letter z. Int…
A: Note: The answer of the first question is given only. Introduction: The given code has a fork()…
Q: dent data that consists of a Student number, First name, Surname, and average assignment mark.…
A: Write a Java application that allows a user to enter student data that consists of a Student…
Java program involves the use of Strings, characters and file I/O.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images
- Write a program that prompts the user to enter afile name and displays the occurrences of each letter in the file. Letters are caseinsensitive. Here is a sample run:Enter a filename: Lincoln.txt ↵EnterNumber of As: 56Number of Bs: 134...Number of Zs: 9This is a python file Fix this code and the output is the attachment #filename: modValidateEmail.py def isValidMSUMEmail(email): if email.count('@') != 1: return False tmp= email.split('@') if len(tmp) == 0: return False userName = tmp[0] if not userName[0].isalpha(): return False for c in userName: if not c.isalpha() and c != '.': return False inst= tmp[1] if inst != 'mnstate.edu': return False else: return True #filename: UnitTestValidEmail.py from unittest import * from modValidateEmail import * class TestValidEmail(TestCase): #create a subclass of unittest.TestCase def testUserName(self): self.assertEqual(isValidMSUMEmail('.joe@mnstate.edu'),False) self.assertEqual(isValidMSUMEmail('joe4@mnstate.edu'),False) self.assertEqual(isValidMSUMEmail('joe$smith@mnstate.edu'),False) self.assertEqual(isValidMSUMEmail('joe.smith@mnstate.edu'),True) def…write a program that replace each line of a file with its reverse. for example, if you run: java Reverse HelloPrinter.javathen the contents of HelloPrinter.java are changed to retnirPolleH ssalc clibup{)sgra ][gnirtS(niam diov citats clibup{wodniw elosnoc eht ni gniteerg a yalpsiD // ;) "!dlroW ,olleH " (nltnirp.tuo.mestyS}}
- I need help Print the file on the BlueJ console Java Filename: input.txt Number of lines: 5 Longest Line: 10 Total number of characters: 33 Asterisk character found at 3,2 xxxxxxxxx xxxxxxx xxx*xxxxxx xx xxxxx Work done so far (my code) // we need to import this library for classes to read and write filesimport java.io.*;import java.util.Scanner;import java.io.FileReader; /*** Write a description of class FileStats here.** @author (Tanishq Verma)*/public class FileStats{ /*** Constructor for objects of class FileStats*/public FileStats(){ } public static void main(String args[]) { // Assignment 5 Part A // print out a message to help show where we are at in the consoleSystem.out.println("\n\nFileStats program running!!");// create a scanner object to read from the keyboardScanner keyboard = new Scanner(System.in); // Get the filename from user inputSystem.out.print("Enter the filename: ");String filename = keyboard.nextLine(); // Create a new File objectFile file = new…I need some helping fixing my code for this method(in screenshot). Also could you explain tokens please! public static double[][] readFile (java.io.File file) throws FileNotFoundException{ String[] temp = new String[10]; int row = 0; int colum = 0; int i = 0; int k = 0; double[][] Fill = null; Scanner sc; try { sc = new Scanner(file); String[] token; while(sc.hasNextLine()){ temp[row] = sc.nextLine(); //split = line.split(" "); row++; } Fill = new double[row][]; for(; i<row; i++){ token = temp[i].split(" "); colum = token.length; Fill[i] =new double[colum]; for(; k<token.length; k++) { Fill[i][k]=Double.parseDouble(token[k]); } k = 0; i++; } sc.close(); for(int p = 0; p<Fill.length;p++) { for(int v =0; v<Fill[colum].length; v++) { System.out.println(Fill[row][colum]+ " "); } System.out.println(); } }catch( FileNotFoundException e) { e.getMessage(); } return Fill; } }The problem is the following : Write a program that asks the user for the name of a file. The program should display the contents of the file with each line preceded with a line number followed by a colon. The line numbering should start at 1. Please edit this scanner to JOptionPane. I don't really know how to do that. //Java Program by Yuiri Fujita and Darrick Drewry 10/30/2020 import java.util.Scanner;import java.io.*; public class LineNumbers { public static void main(String[] args) throws IOException {// TODO Auto-generated method stubScanner input = new Scanner(System.in);String userFileName;System.out.println("Please enter the name of the file.( Enter LineNumbers.txt)");userFileName = input.nextLine();File file = new File( userFileName);while( !file.exists() ){System.out.println( userFileName + " does not exist. Please enter a different file name");userFileName = input.nextLine();file = new File ( userFileName);}Scanner fileToScan = new Scanner (file);String line;int counter =…
- The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:TFFTFFTTTTFFTFTFTFTTEvery other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:ABC54301 TFTFTFTT TFTFTFFTTFTindicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points. Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale:90%–100%, A; 80%–89.99%, B; 70%–79.99%, C; 60%–69.99%, D; and…Write a program, reading the temperature data from an input file, translating them to another temperature scale by the choice of user (F2C, C2F, K2C, C2K, K2F, F2K) and writing the calculated temperature values in output file. it is input file and output file java code . i am giving you the code you need to implement the code with I/O file import java.util.Scanner; public class Lab15{ public static void main(String[] args) { Scanner Keyboard = new Scanner(System.in); double Frahenhite, Celsius, Kelvin ; int input = 1;while (input==1){for (int i = 1; i<=2; i++) { System.out.println("Choose an option"); System.out.println("FTC - Fahrenheit to Celsius"); System.out.println("CTF - Celsius to Fahrenheit"); System.out.println("FTK - Fahrenheit to Kelvin"); System.out.println("KTF - Kelvin to Fahrenheit"); System.out.println("CTK - Celsius to Kelvin"); System.out.println("KTC - Kelvin to Celsius");…Write a program that reads a text file named as “input.txt” and performs the following operations:1. Write each word in the text file in reverse order to the file named as“output.txt” . (Example: If the text file contains ”Hello World!”, then itshould write to the output file ”olleH dlroW!”)2. Print the number of words.3. Print the number of words starting with a capital letter.4. Print the number of words that contain no characters other than Englishletters.In this challenge you are supposed to:1. Comment every function with a description explaining what it does andhow it does it.2. Research and learn how to read and write into text files by using properlibrary functions in C.In your program, you can assume that1. Both the input file (input.txt) and the output file (output.txt) will beplaced on the same folder as your program’s executable (.exe).2. In the input file, the length of the words will be at most 100.
- Your client owns a bookstore, and they need to process an input file containing the titles of all their books to remove duplicates. Write a program that reads all of the titles from an input file called SamsBookstore.txt and writes them to an output file called SamsDuplicates.txt. When complete, the output file should contain all duplicated titles found in the input file. For JAVA code Create a text file using the following books: And Then It's Spring Baby Bear Sees Blue Beach Feet Jimmy the Greatest! Boot & Shoe Boy & Bot Cat Tale Creepy Carrots! Jimmy the Greatest! Dog in Charge Eggs 1 2 3 Extra Yarn Ganesha's Sweet Tooth Green Happy Like Soccer H.O.R.S.E.: A Game of Basketball and Imagination The Insomniacs Boy & Bot It's a Tiger! Jimmy the Greatest! King Arthur's Very Great Grandson Me and Momma and Big John The Quiet Place Robin Hood Step Gently Out Up, Tall and High Z Is for Moose The Elephant's Friend and Other Tales from Ancient India.…What would be the printout of the following code if the same file.txt was used as above? int main() { fstream file("file.txt", ios::in); char ch; file.get(ch); while (!file.eof()) { cout << ch << " "; file.get(ch); } file.close(); return 0;} Group of answer choices I have a dream. I h a v e a d r e a m . Ihaveadream. I have a dream.I have a dream.Write a program that reads the-zen-of-python.txt and writes each line to UpdatedZen.txt, a new text file. It capitalizes the first character of each line and adds a period to the end of each line before writing it back to updatedzen.txt. the-zen-of-python.txt file contents: beautiful is better than ugly explicit is better than implicit simple is better than complex complex is better than complicated flat is better than nested sparse is better than dense readability counts special cases aren't special enough to break the rules although practicality beats purity errors should never pass silently unless explicitly silenced in the face of ambiguity, refuse the temptation to guess there should be one-- and preferably only one --obvious way to do it although that way may not be obvious at first unless you're Dutch now is better than never although never is often better than *right* now if the implementation is hard to explain, it's a bad idea if the implementation is easy to explain, it…