Concept explainers
Write a
message in there. Please write back the decrypted message into the output.txt file.
When you see the message in the output.txt file, you need to submit the java code
file. You need to use Rot13 class for decrypting the message.
Do not need to submit in the output.txt file.
file example:
public class FileExample {
public static void main(String[]args){
try {
//create file object for input.txt
File in_file = new File("src/input.txt");
//create file object for output.txt
File out_file = new File("src/output.txt");
//read the input.txt file with Scanner
Scanner read = new Scanner(in_file);
//write the output.txt file with PrintWriter
PrintWriter w = new PrintWriter(out_file);
while(read.hasNextLine()){
w.write(read.nextLine());
}
//don't forget to close
w.close();
// while(scan.hasNext()){
// System.out.println(scan.next());
// }
}catch(Exception ex){
ex.getStackTrace();
}
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 4 images
- You are given a file, input.txt, that contains some even number of lines. Each line contains two values: a number and a string. For this task, you need to write a Java code to calculate the sum of the numbers in two consecutive lines of input.txt and write the sum in another file, output.txt. Check the following example for details: 123 100 50 50 45 55 input.txt output.txt Line 1: 223 Line 2: 100 Line 3: 100 Here, the first output is 223 which is equal to 123 + 100. The second output is 100 which is equal to 50+ 50 and so on. The three dots at the end of input.txt means that there are many more lines in the file.arrow_forwardWrite the code in java and please don't plagiarize or copy from other sources write it on your own. Read carefully and follow the instructions in the question. Thank you.arrow_forwardExplain the concept of two-way data binding with custom data types and complex objects. What challenges may arise when implementing it?arrow_forward
- In 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…arrow_forwardPlease write the Java program for the given scenario Create a CourseException class that extends Exception . Create a Course class with String that holds a college course’s department (for example, CSE), a course number (for example, 101), and a number of credits (for example, 3) and whose getdata() member function requires values for each field., throw a CourseException if the department does not consist of three letters, if the course number does not consist of three digits between 100 and 499 inclusive, or if the credits are less than 0.5 or more than 6. Write an application and display an appropriate message when a Course object is created.arrow_forwardWrite a python program that prompts the user for their favorite basketball team. It should be able to read the list of teams provided below in a file called favorite_teams.txt and check if their team is in that file. Teams in the file:JazzBullsMavericksSpursIf the team is in the file let the user know that their team is in the list of favorites. If the team is not in the file, add the team to the end of the file. Also, let the user know that their team will be added to the file.Sample Run in File:What is your favorite NBA team? Jazz [Enter]Your team Jazz is in the listFile before and after run: JazzBullsMavericksSpurs Sample Run not in File:What is your favorite NBA team? Pelicans [Enter]Your team Pelicans is not in the list. It will be added.File before run: JazzBullsMavericksSpursFile after run:JazzBullsMavericksSpursPelicansarrow_forward
- Using JavaFX, create a simple calculator application, like the following: The operators is ( + : " addition process" , -:subtraction process", *:"multiplication process" , /:"division process" , C : "Clear" , H: "History"); Validate that the first number and second is a numeric value if it is not throwing an exception. When clicking the operators (+, -, *, /): the result will display at the bottom, and stored in history. When clicking C, clear the first, second number and the history5 When clicking H, the history will display at the bottom.6 When the user click / and the second number is 0 throw an arithmetic exception. help_outlinefullscreenarrow_forwardWrite a Java program that reads from a URL and searches for a given word in the URL and creates a statistic file as an output. The statistic file needs to include some information from the URL. URL address Number of words in the URL page Number of repetitions for a given word displays the number of times the word appears. You need to have two functions, one for reading from the URL and the other function for searching the word.arrow_forwardJava Your program must read a file called personin.txt. Each line of the file will be a person's name, the time they arrived at the professor's office, and the amount of time they want to meet with the professor. These entries will be sorted by the time the person arrived. Your program must then print out a schedule for the day, printing each person's arrival, and printing when each person goes in to meet with the professor. You need to print the events in order of the time they happen. In other words, your output will be sorted by the arrival times and the times the person goes into the professor's office. In your output you need to print out a schedule. In the schedule, new students go to the end of the line. Whenever the professor is free, the professor will either meet with the first person in line, or meet with the first person in line if nobody is waiting. Assume no two people arrive at the same time. You should solve this problem using a stack and a queue. You can only…arrow_forward
- Write a program that will input the contents of a text file containing integers then writes each number and the frequency of that number appearing in the file. The output should look like the following sample output: Number Frequency 1 2 3 3 Also, copy the contents of the text file under your code Hints: Sort the list in ascending order before counting the numbers.arrow_forwardWrite some C++ code to sort an array of predefined data types using a template function.arrow_forwardWrite a Java program that opens a file and counts the whitespace-separated words in that file. You may obtain the name of the input file either from the command line or via prompt and user input. Be sure to clearly document the method chosen. You may test your program using any number of text files; however, you must be sure to test your program using the Sample Text File provided at the end (excerpt.txt). Sample Text File There was nothing so VERY remarkable in that; nor did Alice think it so VERY much out of the way to hear the Rabbit say to itself, `Oh dear! Oh dear! I shall be late!' (when she thought it over afterwards, it occurred to her that she ought to have wondered at this, but at the time it all seemed quite natural); but when the Rabbit actually TOOK A WATCH OUT OF ITS WAISTCOAT- POCKET, and looked at it, and then hurried on, Alice started to her feet, for it flashed across her mind that she had never before seen a rabbit with either a waistcoat-pocket, or a watch to…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