Film Database Application
GET READYMADE FILM DATABASE APPLICATION ASSIGNMENT SOLUTIONS - 100% PLAGIARISM FREE WORK DOCUMENT AT NOMINAL CHARGES!
Design and implement a film database application using MVC architecture. Use the provided FruitList GUI as a starting point. 
Functionality 
Your application allows the user to display, add to and search a list of films stored in a text file database via a GUI:
Java Program
Home.java
import javax.swing.JOptionPane;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;
import javax.swing.*;  
import javax.swing.table.*;
import java.awt.Color;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
import java.awt.*;
import java.awt.event.*;
public class Home 
{
 static VideoItem vitem[] = new VideoItem[1000];
 static int count_videos;
 
 //Beginning main() in OGOS_System.java
 public static void main(String args[])
 {
 //Populate videos. Read the file videos.txt.
 count_videos = Populate_Items("src/Database/videos.txt");
 System.out.println("Videos populated, back in main");
/*
 * All items populated. Now, display the main menu. 
 */
 
 int choice;
 do 
 {
 choice=menu();
 switch(choice)
 {
 case 1: Display();	break;
 case 2: Add();		break;
 case 3: SearchByCode();	break;
 case 4: SearchByTitle();	break;
 case 5: Delete();	break;
 }	//end switch
 }while(choice!=6);	// end of do-while loop
 
 //Write back to videos.txt
 try
 {
 FileWriter fw=new FileWriter("src/Database/videos.txt");
 System.out.println("count_videos = "+count_videos);
 for(int i=0;i<count_videos;++i)
 {
 if(vitem[i].GetValid()!=-1)
 {
 String s = Integer.toString(vitem[i].getItemCode())+"#"+
 vitem[i].getTitle()+"#"+
 Integer.toString(vitem[i].getDownloadSize())+"#"+
 Integer.toString(vitem[i].getPrice())+"#\n";
 System.out.println(s);
 fw.write(s);
 }
 }
 fw.close();
 }
 catch(Exception e)
 {
 System.out.println(e);
 }			
 }	//end of main
 
 public static void SuccessMessage()
 {
 JOptionPane.showMessageDialog(null, "Success!"
 ,"",JOptionPane.INFORMATION_MESSAGE);
 }
 public static void FailureMessage()
 {
 JOptionPane.showMessageDialog(null, "Something went wrong. Please try again!"
 ,"",JOptionPane.INFORMATION_MESSAGE);
 }
 
 public static void SearchByTitle()
 {
 try
 {
 String s = JOptionPane.showInputDialog(null, "Enter movie title"
 ,"Searching a movie",JOptionPane.QUESTION_MESSAGE);
 
 int found = 0;
 
 for(int i=0;i<count_videos;++i)
 {
 if((vitem[i].getTitle().indexOf(s)>=01) && (vitem[i].GetValid()!=-1))
 {
 JOptionPane.showMessageDialog(null, vitem[i].displayInfoLine(),
 "Movie found",JOptionPane.INFORMATION_MESSAGE);
 found = 1;
 }
 }	
 
 if(found==0)
 {
 JOptionPane.showMessageDialog(null,"No results",
 "Search results",JOptionPane.INFORMATION_MESSAGE);
 }
 }
 catch(Exception e)
 {
 FailureMessage();
 return;
 }
 }
 
 public static void SearchByCode()
 {
 try
 {
 String s = JOptionPane.showInputDialog(null, "Enter item-code"
 ,"Searching a movie",JOptionPane.QUESTION_MESSAGE);
 int a = Integer.parseInt(s);
 int found = 0;			
 
 for(int i=0;i<count_videos;++i)
 {
 if((vitem[i].getItemCode()==a) && (vitem[i].GetValid()!=-1))
 {
 JOptionPane.showMessageDialog(null, vitem[i].displayInfoLine(),
 "Movie found",JOptionPane.INFORMATION_MESSAGE);
 found=1;
 }
 }	
 if(found==0)
 {
 JOptionPane.showMessageDialog(null,"No results",
 "Search results",JOptionPane.INFORMATION_MESSAGE);
 }
 }
 catch(Exception e)
 {
 FailureMessage();
 return;
 }
 }
 
 public static void Delete()
 {
 try
 {
 String s = JOptionPane.showInputDialog(null, "Enter item-code"
 ,"Deleting a movie",JOptionPane.QUESTION_MESSAGE);
 int a = Integer.parseInt(s);
 
 for(int i=0;i<count_videos;++i)
 {
 if(vitem[i].getItemCode()==a)
 {
 vitem[i].SetValid(-1);
 SuccessMessage();
 }
 }	
 }
 catch(Exception e)
 {
 FailureMessage();
 return;
 }
 }
 
 public static void Add()
 {
 try 
 {
 System.out.println("Adding a new movie");
 
 String s = JOptionPane.showInputDialog(null, "Enter item-code"
 ,"Adding a new item",JOptionPane.QUESTION_MESSAGE);
 int a = Integer.parseInt(s);
 
 //TODO Check whether an item with the same item code already exists. If yes, return
 
 String b = JOptionPane.showInputDialog(null, "Enter title"
 ,"Adding a new item",JOptionPane.QUESTION_MESSAGE);
 
 s = JOptionPane.showInputDialog(null, "Enter download size"
 ,"Adding a new item",JOptionPane.QUESTION_MESSAGE);
 int d = Integer.parseInt(s);
 
 s = JOptionPane.showInputDialog(null, "Enter price"
 ,"Adding a new item",JOptionPane.QUESTION_MESSAGE);
 int e = Integer.parseInt(s);
 
 System.out.println(a);
 System.out.println(b);
 System.out.println(d);
 System.out.println(e);
 
 VideoItem vd = new VideoItem(a,b,d,e);
 vitem[count_videos] = vd;
 count_videos++;
 SuccessMessage();
 }
 catch(Exception e)
 {
 FailureMessage();
 return;
 }
 }
 
 public static void Display()
 {
 System.out.println("Inside function Display()");
 String[] head={"Sl.no","Itemcode","Title","Download size","Price"};
 
 DefaultTableModel dtm=new DefaultTableModel(head,0);
 JTable tbl=new JTable(dtm);  
 JScrollPane p=new JScrollPane(tbl);
 
 for(int i=0;i<count_videos;++i)
 {
 if(vitem[i].GetValid()!=-1)
 {
 String[] item={Integer.toString(i+1),Integer.toString(vitem[i].getItemCode()),vitem[i].getTitle(),
 Integer.toString(vitem[i].getDownloadSize()),
 Double.toString(vitem[i].getPrice())};
 dtm.addRow(item);
 }
 }
 Utils.PutTableInFrame(p,"Showing all movies");
 System.out.println("End of function Display()");
 }
 
 public static int menu()
 {
 String temp = JOptionPane.showInputDialog(null,"Welcome to Movie database!! "+"\n"+
 "1. View all movies "+"\n"+
 "2. Add a movie to the DB "+"\n"+
 "3. Search movie by movie code"+"\n"+
 "4. Search movie by title"+"\n"+
 "5. Delete movie"+"\n"+
 "6. Exit"+"\n"+
 "Please make your selection ","Online Movie Database System",JOptionPane.QUESTION_MESSAGE);	
 try 
 {
 return(Integer.parseInt(temp));
 }
 catch(Exception e)
 {
 return -1;
 }
 }	//end of function menu()
 
 public static int Populate_Items(String filename)
 {
 try
 {
 BufferedReader reader = new BufferedReader(new FileReader(filename));
 int count = 0;
 String[] values = new String[100];
 String line = "";
 
 line = reader.readLine();
 do 
 {
 //System.out.println(line);
 values = Utils.ParseText(line,'#');
 
 VideoItem vd = new VideoItem(Integer.parseInt(values[0]),values[1],
 Integer.parseInt(values[2]),Integer.parseInt(values[3]));
 vitem[count] = vd;
 ++count;
 }while ((line=reader.readLine())!=null);
 reader.close();
 return count;
 }
 catch (IOException e) 
 {
 e.printStackTrace();
 return 0;
 }
 }	//end of function
}
GET ASSURED A++ GRADE IN EACH FILM DATABASE APPLICATION ASSIGNMENT ORDER - ORDER FOR ORIGINALLY WRITTEN SOLUTIONS!
Utils.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;
import javax.swing.*;  
import javax.swing.table.*;
import java.awt.Color;
import java.awt.Dimension;
public class Utils 
{
 public static int GetLineCount(String filename)
 {
 try
 {
 BufferedReader reader = new BufferedReader(new FileReader(filename));
 String line = reader.readLine();
 int count = 0;
 while (line != null) 
 {
 line = reader.readLine();
 ++count;
 }
 reader.close();
 return count;
 }
 catch (IOException e) 
 {
 e.printStackTrace();
 return -1;
 }
 }
 
 public static int index(String line, int count, char c)
 {
 int i,j=0;
 for(i=0;i<line.length();++i)
 {
 if(line.charAt(i)==c)
 ++j;
 if(j==count)
 return i;
 }
 return i;
 }
 
 public static int CountSymbols(String line, char c)
 {
 int i,j=0;
 for(i=0;i<line.length();++i)
 {
 if(line.charAt(i)==c)
 ++j;
 }
 return j;
 }
 
 public static String[] ParseText(String line, char c)
 {	
 //Break the line into pieces and store it into the Strings[] array
 
 int num_of_sym = Utils.CountSymbols(line,c);
 //System.out.println(num_of_sym);
 
 String texts[] = new String[num_of_sym];
 
 texts[0] = line.substring(0,Utils.index(line,1,c));
 //System.out.println(texts[0]);
 for(int i=1;i<num_of_sym;i++)
 {
 texts[i] = line.substring(Utils.index(line,i,c)+1,Utils.index(line,i+1,c));
 //System.out.println(texts[i]);
 }
 return texts;
 }	
 
 public static void PutTableInFrame(JScrollPane p, String s)
 {
 JFrame frame = new JFrame(); 
 frame.setTitle(s);
 frame.add(p);          
 frame.setSize(1000,600);    
 frame.setVisible(true);
 JOptionPane.showMessageDialog(null,"Close table ?",s,
 JOptionPane.INFORMATION_MESSAGE);
 frame.setVisible(false);
 frame.dispose();
 }
 
 public static int[] ConvertToIntArr(String s)
 {
 System.out.println("Inside Utils.ConvertToIntArr : "+s);
 String line[] = ParseText(s,',');
 
 int[] arr = new int[line.length];
 for(int i=0;i<line.length;++i)
 arr[i] = Integer.parseInt(line[i]);
 return arr;
 }
 
 
}
VideoItem.java
public class VideoItem
{
 int itemCode;
 String title;
 int downloadSize;
 int price;
 int valid;
 
 // constructor
 VideoItem()
 {
 
 }
 
 VideoItem(int a, String b, int c, int d)
 {
 System.out.println("Inside the constructor of VideoItem class");
 itemCode = a;
 title = b;
 downloadSize = c;
 price = d;
 valid = 1;
 }
 
 //Other member functions of VideoItem class
 
 public String getTitle()
 {
 return title;
 }
 
 public int getItemCode()
 {
 return itemCode;
 }
 
 public int getDownloadSize()
 {
 return downloadSize;
 }
 
 public void setDownloadSize(int dsize)
 {
 downloadSize = dsize;
 }
 
 public int getPrice()
 {
 return price;
 }
 
 public void setPrice(int p)
 {
 price = p;
 }
 
 public String displayInfoLine()
 {
 return "Itemcode = "+Integer.toString(itemCode) + " - " + title + ", Down size =  "+
 Integer.toString(downloadSize)+", Price = "+ Integer.toString(price);
 }
 
 public void SetValid(int a)
 {
 valid = a;
 }
 
 public int GetValid()
 {
 return valid;
 }
 
}	//end of class Item
NEVER LOSE YOUR CHANCE TO EXCEL IN FILM DATABASE APPLICATION ASSIGNMENT - HIRE BEST QUALITY TUTOR FOR ASSIGNMENT HELP!