
Concept explainers
The program does not run in hypergrade can you please MODIFY THIS program ASAP BECAUSE it does not pass all the test cases when I upload it to hypergrade. I have provided the correct test cases as a screenshot as well as the failed test cases. It says 0 out of 4 passed. The program must pass the test case when uploaded to Hypergrade.
Files data are down below:
PleaseExplainABitMoreInTheWayOfFootnotes.FromTheGivenTextIt'sNotClearWhatAreWeReadingAbout.
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
class Main {
// Driver code
public static void main(String[] args) {
// scanner object used to take user input
Scanner sc = new Scanner(System.in);
// loop iterates until user enters "quit" or "QUIT"
while (true) {
System.out.print("Please enter the file name or type QUIT to exit:\n");
String fileName = sc.nextLine();
if (fileName.equalsIgnoreCase("QUIT")) {
break;
}
try {
// open file in read mode
BufferedReader reader = new BufferedReader(new FileReader(fileName));
String line;
StringBuilder result = new StringBuilder();
// for each line
while ((line = reader.readLine()) != null) {
String formattedSentence = formatSentence(line);
result.append(formattedSentence).append("\n");
}
System.out.println(result.toString());
reader.close();
} catch (IOException e) {
System.out.println("File '" + fileName + "' is not found.");
}
}
}
// creating a method
public static String formatSentence(String sentence) {
StringBuilder formatted = new StringBuilder();
int i=0;
for (char c : sentence.toCharArray()) {
if (Character.isLetter(c)) {
if (Character.isUpperCase(c)) {
if(i != 0){
formatted.append(" ");
}
if(i == 0){
formatted.append(Character.toUpperCase(c));
}
else{
formatted.append(Character.toLowerCase(c));
}
} else {
formatted.append(Character.toLowerCase(c));
}
} else if (c == '.' || c == '!' || c == '?') {
formatted.append(c).append(" ");
i = -1;
}
else{
formatted.append(c);
}
i++;
}
return formatted.toString();
}
}
text1.txtENTER
Stop and smell the roses.\n
Test Case 2
txt1.txtENTER
File 'txt1.txt' is not found.\n
Please re-enter the file name or type QUIT to exit:\n
text1.txtENTER
Stop and smell the roses.\n
Test Case 3
text2.txtENTER
A true rebel you are! Everyone was impressed. You'll do well to continue in the same spirit.\n
Please explain a bit more in the way of footnotes. From the given text it's not clear what are we reading about.\n
Test Case 4
somefile.txtENTER
File 'somefile.txt' is not found.\n
Please re-enter the file name or type QUIT to exit:\n
anotherbadfile.txtENTER
File 'anotherbadfile.txt' is not found.\n
Please re-enter the file name or type QUIT to exit:\n
quitENTER
![Test Case 1 Failed Show what's missing
Please enter the file name or type QUIT to exit: \n
text1.txt ENTER
Stop and smell the roses.\n
Test Case 2 Failed Show what's missing
Please enter the file name or type QUIT to exit: \n
txt1.txt ENTER
File txt1.txt' is not found.\n
Please re-enter the file name or type QUIT to exit: \n
text1.txt ENTER
Stop and smell the roses.\n
Test Case 3 Failed Show what's missing
Please enter the file name or type QUIT to exit: \n
text2.txt ENTER
A true rebel you are! Everyone was impressed. You'll do well to continue in the same spirit.\n]
Please explain a bit more in the way of footnotes. From the given text it's not clear what are we reading about.\n
Test Case 4 Failed Show what's missing
Please enter the file name or type QUIT to exit: \n
somefile.txt ENTER
File 'somefile.txt' is not found.\n
Please re-enter the file name or type QUIT to exit: \n
anotherbadfile.txt ENTER
File 'anotherbadfile.txt' is not found.\n
Please re-enter the file name or type QUIT to exit: \n
quit ENTER
Test Case 1
Failed
Test Case 2
Please enter the file name or type QUIT to exit: \n
text1.txt ENTER
Stop And Smell The Roses.\n
\n
Please OUTPUT TOO LONG
Failed
Show what's missing
Test Case 3 Failed
Show what's missing
Please enter the file name or type QUIT to exit: \n
txt1.txt ENTER
File txt1.txt' is not found.\n
Please enter the file name or type QUIT to exit: \n
text1.txt ENTER
Stop And Smell The Roses.\n
\n
Please enter the fi... OUTPUT TOO LONG
Show what's missing
Please enter the file name or type QUIT to exit: \n
text2.txt ENTER
ATrue Rebel You Are! Everyone Was Impressed. You'll Do Well To Continue In The Same Spirit.\n
Please Explain ABit More In The Way Of Footnotes. From The Given Text It's Not Clear What Are We Reading About.\n
\n
Please enter the file name or
Test Case 4 Failed Show what's missing
OUTPUT TOO LONG
Please enter the file name or type QUIT to exit: \n
somefile.txt ENTER
File 'somefile.txt' is not found.\n
Please enter the file name or type QUIT to exit: \n
anotherbadfile.txt ENTER
File 'anotherbadfile.txt' is not found.\n
Please enter the file name or type QUIT to exit: \n
quit ENTER](https://content.bartleby.com/qna-images/question/4a622fca-73d4-4da3-9ba3-ed9a4ec8ef98/b3f6cef8-4735-4806-8e63-e2806579eaff/6gyuebi_thumbnail.png)


Step by stepSolved in 4 steps with 2 images

- astfoodStats Assignment Description For this assignment, name your R file fastfoodStats.R For all questions you should load tidyverse, openintro, and lm.beta. You should not need to use any other libraries. suppressPackageStartupMessages(library(tidyverse)) suppressPackageStartupMessages(library(openintro)) suppressPackageStartupMessages(library(lm.beta)) The actual data set is called fastfood. Continue to use %>% for the pipe. CodeGrade does not support the new pipe. Round all float/dbl values to two decimal places. All statistics should be run with variables in the order I state E.g., "Run a regression predicting mileage from mpg, make, and type" would be: lm(mileage ~ mpg + make + type...) To access the fastfood data, run the following: fastfood <- openintro::fastfood Create a correlation matrix for the relations between calories, total_fat, sugar, and calcium for all items at Sonic, Subway, and Taco Bell, omitting missing values with na.omit(). Assign the…arrow_forwardFor main.CPP file in lines 32 and 33 on visual studio community 2022 it's saying that getline is unidentified why is that and how do i fix it.arrow_forwardpythhon 3arrow_forward
- PLEASE DONT COPY OFF OTHER POSTS CODE help with java..plzz paste indented code add comments tooarrow_forwardYou are given 2 text files named drywet.txt and wetwet.txt. wetwet.txt data file refers to the probability of next day being a wet day if the current day is wet. drywet.txt data file refers to the probability of next day being a wet day if the current day is dry. NOTE: the data for the same location in wetwet.txt and drywet.txt will have the same line number. These files are in the format of: (excerpt from wetwet.txt)-97.58 26.02 0.76 0.75 0.77 0.74 0.80 0.86 0.94 0.97 0.89 0.77 0.74 0.77 -97.19 26.03 0.73 0.76 0.75 0.71 0.79 0.85 0.92 0.95 0.90 0.81 0.76 0.75 -98.75 26.35 0.74 0.76 0.76 0.73 0.67 0.84 0.83 0.85 0.80 0.71 0.71 0.76 … In each line, the first and second numbers represent the location’s longitude and latitude. The following 12 numbers represent the probability of the next day being a wet day of the month. For example, on the first line of the excerpt above 0.75 means that in February (4th column), there is a 75% of chance that the next day is a wet day if today is a wet…arrow_forwardcreate an image file programmatically. Your image file should be called OnTheFlyPy.ppm and the code you write to create should be in a public static void makePPM() method defined in the provided Main.java class. Your OnTheFlyPy.ppm should be be 100 pixels wide and 100 pixels tall and the PPM header lines should be correct. The first two rows and last two rows in the OnTheFlyPy.ppm should be red (Red=255, Green=0, Blue= 0). The first two columns and last two columns in the OnTheFlyPy.ppm (except for the part that overlaps with the red pixels you created in the previous part) should should be blue (Red=0, Green=0, Blue= 255). The remaining pixels in your OnTheFlyPy.ppm image should be white (Red=255, Green=255, Blue= 255). Here is a picture of what your final image should look like: import java.io.*; public class Main{ public static void main(String[] args) { makePPM(); } public static void makePPM() { } }arrow_forward
- JAVA PPROGRAM ASAP Please Modify this program ASAP BECAUSE IT IS HOMEWORK ASSIGNMENT so it passes all the test cases. It does not pass the test cases when I upload it to Hypergrade. Because RIGHT NOW IT PASSES 0 OUT OF 1 TEST CASES. 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.File;import java.io.FileNotFoundException;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String fileName; System.out.println("Please enter the file name or type QUIT to exit:"); fileName = keyboard.nextLine().trim(); while (!fileName.equalsIgnoreCase("QUIT")) { File file = new File(fileName); if (file.exists()) { int wordCount = countWords(file); System.out.println("Total number of words: " + wordCount + "\n);…arrow_forwardAmong other things, the purpose of this assignment is to assess the student's ability to write a program dealing with sorting, arrays, and collections. seed = 3 Input: Ann Chris chris don don chris chris Bill Intermediate Results: Ann Bill Chris don Final Results: PROGRAM SPECIFICATIONS don Chris Bill Ann seed = 4 Beginning with the file that you downloaded named Proj04.java, create a new file named Proj04Runner.java to meet the specifications given below. Input: ann Ann Ann Don Don don Chris Chris Intermediate Results: ann Chris Don Note that the code in the file named Proj04.java. Final Results: ann Don Chris seed = 5 Input: Ann ann Ann Bill don bill Chris Ann Intermediate Results: Ann Bill Chris don Be sure to display your name in the output as indicated. When you place both files in the same folder, compile them both, and run the file named Proj04.java with a command-line argument of 6, the program must display the text shown below on the command line screen. Final Results: don…arrow_forwardJAVA PPROGRAM ASAP Please Modify this program ASAP BECAUSE IT IS HOMEWORK ASSIGNMENT so it passes all the test cases. It does not pass the test cases when I upload it to Hypergrade. Because RIGHT NOW IT PASSES 1 OUT OF 7 TEST CASES. I have provided the failed the test cases as a screenshot. The program must pass the test case when uploaded to Hypergrade. import java.io.File;import java.io.FileNotFoundException;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String fileName; while (true) { System.out.println("Please enter the file name or type QUIT to exit:"); fileName = keyboard.nextLine().trim(); if (fileName.equalsIgnoreCase("QUIT")) { break; // Exit the loop when "QUIT" is entered } File file = new File(fileName); if (file.exists()) { int wordCount = countWords(file);…arrow_forward
- A Personal Fitness Tracker is a wearable device that tracks your physical activity, caloriesburned, heart rate, sleeping patterns, and so on. One common physical activity that mostof these devices track is the number of steps you take each day.If you have downloaded this book’s source code from the Premium Companion Website,you will find a file named steps.txt in the Chapter 06 folder. (The Premium CompanionWebsite can be found at www.pearsonglobaleditions.com/gaddis.) The steps.txt filecontains the number of steps a person has taken each day for a year. There are 365 linesin the file, and each line contains the number of steps taken during a day. (The first line isthe number of steps taken on January 1st, the second line is the number of steps taken onJanuary 2nd, and so forth.) Write a program that reads the file, then displays the averagenumber of steps taken for each month. (The data is from a year that was not a leap year,so February has 28 days.) (in python)arrow_forwardAccording to the below screenshot of an app, build an Android App that has a set of java files that implement an adapter with RecyclerView. The details of the java files you need to create are described below. The first java file should contain a data field which is in this case: Movie_name, Director_name, Production_year. The second java file contains MovieViewHolder. The third java file contains the MovieAdapter which is act as a bridge between the data items and the View inside of RecycleView. The Mainactivity java file will contain some samples data to display.arrow_forwardA Stationery supplier “Adwaat Al Maktabiyah” needs a program to display sales as per regions and add the sales to the file called sales.txt. The files Personal Details.txt and Sales.txt have been provided. You may download and use them in your program. They are as shown below: PersonalDetails.txt Id First name Last Name Region E111 Alvin Jones East C121 Blake Kivell Central C253 Edda Jardine Central Sales.txt Rep_Id OrderDate Region Item Units UnitCost E111 1/6/2020 East Pencil 95 1.99 C121 1/23/2020 Central Binder 50 19.99 C253 2/9/2020 Central Pencil 36 4.99 Note: - Use structures in the coding and declare structure array as public as shown below. The question 7 doesn’t need arrays. Structure personaldetails Dim rid As String ' Employee id Dim fn As String 'First name Dim ln As String 'Last name Dim rn As String ' Region he belongs to End Structure Structure Regionalsales Dim id As String 'employee id Dim od As Date 'Order Date Dim region As String…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





