This homework problem has me pulling my hair out. We are working with text files in Java using NetBeans GUI application. We're suppose to make a movie list and be able to pull up movies already in the text file (which I can do) and also be able to add and delete movies to and from the file (which is what I'm having trouble with). I've attached the specifications and the movie list if you need it. Any help would be much appreciated and I will continue to work through this programming problem on my own. Thank you.
Citizen Kane drama
Casablanca drama
The Godfather drama
Gone With The Wind drama
Lawrence Of Arabia drama
The Wizard Of Oz musical
The Graduate drama
On The Waterfront drama
Schindler's List drama
Singin' In The Rain musical
It's A Wonderful Life drama
Sunset Boulevard drama
The Bridge On The River Kwai drama
Some Like It Hot drama
Star Wars scifi
All About Eve drama
The African Queen drama
Psycho horror
Chinatown drama
One Flew Over The Cuckoo's Nest drama
The Grapes Of Wrath drama
2001: A Space Odyssey scifi
The Maltese Falcon drama
Raging Bull drama
E.T. The extra-terrestrial scifi
Dr. Strangelove drama
Bonnie And Clyde drama
Apocalypse Now drama
Mr. Smith Goes to Washington drama
The Treasure Of The Sierra Madre drama
Annie Hall comedy
The Godfather Part II drama
High Noon drama
To Kill A Mockingbird drama
It Happened One Night drama
Midnight Cowboy drama
The Best Years Of Our Lives drama
Double Indemnity drama
Doctor Zhivago drama
North By Northwest drama
West Side Story musical
Rear Window drama
King Kong horror
The Birth Of A Nation drama
A Streetcar Named Desire drama
A Clockwork Orange scifi
Taxi Driver drama
Jaws horror
Snow White And The Seven Dwarfs animated
Butch Cassidy And The Sundance Kid drama
The Philadelphia Story drama
From Here To Eternity drama
Amadeus drama
All Quiet On The Western Front drama
The Sound Of Music musical
M*A*S*H comedy
The Third Man drama
Fantasia animated
Rebel Without A Cause drama
Raiders Of The Lost Ark drama
Vertigo drama
Tootsie comedy
Stagecoach drama
Close Encounters Of The Third Kind scifi
The Silence Of The Lambs horror
Network drama
The Manchurian Candidate drama
An American In Paris drama
Shane drama
The French Connection drama
Forrest Gump drama
Ben-Hur drama
Wuthering Heights drama
The Gold Rush drama
Dances With Wolves drama
City Lights drama
American Graffiti drama
Rocky drama
The Deer Hunter drama
The Wild Bunch drama
Modern Times drama
Giant drama
Platoon drama
Fargo drama
Duck Soup comedy
Mutiny On The Bounty drama
Frankenstein horror
Easy Rider drama
Patton drama
The Jazz Singer drama
My Fair Lady musical
A Place In The Sun drama
The Apartment drama
Goodfellas drama
Pulp Fiction drama
The Searchers drama
Bringing Up Baby drama
Unforgiven drama
Guess Who's Coming To Dinner drama
Yankee Doodle Dandy musical
You need to basically do 2 things
1) Add a line to end of the file (Add Movie).
2) Delete some line from middle from file (Delete Movie).
------------------------------------------------------------
For doing 1st call appendStringToFile function with arguments as ("movies.txt", string).
public static void appendStringToFile(String fileName, String
movieStr) {
try{
BufferedWriter fileOut = new
BufferedWriter(new FileWriter(fileName, true));
fileOut.write(movieStr);
fileOut.close();
}catch (Exception e){
System.out.println(e);
}
}
------------------------------------------------------------
For doing 2nd we will simply write all the movies to a new temporary file except the movie we wanted to delete.
Use the following code to do the same:
File inFile = new File("movies.txt");
File tempMovieFile = new File("tempMovies.txt");
BufferedReader reader = new BufferedReader(new
FileReader(inFile));
BufferedWriter writer = new BufferedWriter(new
FileWriter(tempMovieFile));
String deletedMovie = "The Searchers drama";
String currentLine;
while((currentLine = reader.readLine()) != null) {
String line = currentLine.trim();
if(line.equals(lineToRemove)) continue;
writer.write(currentLine +
System.getProperty("line.separator"));
}
writer.close();
reader.close();
boolean successful = tempMovieFile.renameTo(inFile);
This homework problem has me pulling my hair out. We are working with text files in Java using Ne...
need help in Java Now we’ll continue our project by writing a Facebook class that contains an ArrayList of Facebook user objects. The Facebook class should have methods to list all of the users (i.e. print out their usernames), add a user,delete a user, and get the password hint for a user You will also need to create a driver program. The driver should create an instance of the Facebook class and display a menu containing five options: list users...
WONT COMPILE ERROR STRAY / TEXT.H AND CPP PROGRAM SAYING NOT DECLARED HAVE A DRIVER WILL PASTE AT BOTTOM MOVIES.CPP #include "movies.h" #include "Movie.h" Movies *Movies::createMovies(int max) { //dynamically create a new Movies structure Movies *myMovies = new Movies; myMovies->maxMovies = max; myMovies->numMovies = 0; //dynamically create the array that will hold the movies myMovies->moviesArray = new Movie *[max]; return myMovies; } void Movies::resizeMovieArray() { int max = maxMovies * 2; //increase size by 2 //make an array that is...
In this problem, you will create a selectable “To Do” List. To add a task to this list, the user clicks the Add Task button and enters a description of the task. To delete a task from the list, the user selects the task and then clicks the Delete Task button. Open the HTML and JavaScript files provided as start-up files (index.html from within todo_list_Q.zip file). Then, review the HTML in this file. Note, within the div element, there is...
The purpose of this is to use inheritance, polymorphism, object comparison, sorting, reading binary files, and writing binary files. In this application you will modify a previous project. The previous project created a hierarchy of classes modeling a company that produces and sells parts. Some of the parts were purchased and resold. These were modeled by the PurchasedPart class. Some of the parts were manufactured and sold. These were modeled by the ManufacturedPart class. In this you will add a...
In Java. Write a GUI contact list application. The program should allow you to input names and phone numbers. You should also be able to input a name and have it display the previously entered phone number. The GUI should look something like the following, although you are welcome to format it in any way that works. This should be a GUI application with a JFrame. The program should contain two arrays of Strings. One array will contain a list...
Java: student directory GUI You need to implement three classes: Person Student StudentDirectory StudentMain Start by implementing Person and Student classes. Once you are sure you can serialize and deserialize and ArrayList of Students to and from a file, move on to building the GUI application. Person: The Person class should implement serializable interface. It contains the following: Person's first name (String) Person's last name (String) Person's id number Person's date of birth (Date) public String toString(): This method method...
Inventory ManagementObjectives:Use inheritance to create base and child classesUtilize multiple classes in the same programPerform standard input validationImplement a solution that uses polymorphismProblem:A small electronics company has hired you to write an application to manage their inventory. The company requested a role-based access control (RBAC) to increase the security around using the new application. The company also requested that the application menu must be flexible enough to allow adding new menu items to the menu with minimal changes. This includes...
AA. Final Project - Improved JavaFX GUI Personal Lending Library Description: In this project we will improve our personal lending library tool by (1) adding the ability to delete items from the library, (2) creating a graphical user interface that shows the contents of the library and allows the user to add, delete, check out, or check in an item. (3) using a file to store the library contents so that they persist between program executions, and (4) removing the...
JAVA Objective : • Learning how to write a simple class. • Learning how to use a prewritten class. • Understanding how object oriented design can aid program design by making it easier to incorporate independently designed pieces of code together into a single application. Instructions: • Create a project called Lab13 that contains three Java file called Book.java , Bookstore.java and TempleBookstore.java • I’ve provided a screenshot of how your project should look like. • Be sure to document...
moviestruct.cpp #include <iostream> #include <fstream> #include <cstdlib> #include <ostream> #include <fstream> #include <cstdlib> #include <cstring> using namespace std; typedef struct{ int id; char title[250]; int year; char rating[6]; int totalCopies; int rentedCopies; }movie; int loadData(ifstream &infile, movie movies[]); void printAll(movie movies[], int count); void printRated(movie movies[], int count); void printTitled(movie movies[], int count); void addMovie(movie movies[],int &count); void returnMovie(movie movies[],int count); void rentMovie(movie movies[],int count); void saveToFile(movie movies[], int count, char *filename); void printMovie(movie &m); int find(movie movies[], int...