Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Software: Create a small business software (Michaels Inc.) that will help the bu

ID: 3634665 • Letter: S

Question

Software:
Create a small business software (Michaels Inc.) that will help the business owner to input a list of items which will include information on prices, stock, expiry date, etc.

Then sort them by prices, stock, expiry date, etc. The purpose of the program is to help the owner know everything about the items he inputted in the software and then compare them with one another in a quick and organized manner.


The program should complete the following functionalities:

*User Input
*Using Arrays
*Using a Menu
*Using Methods
*Creating a Dynamic System (add, enter, delete, modify)
*Searches and Sorts



*Important* This program needs to work with java 1.4.2. Please make sure it works with this version.

I have a program already made from a previous task. It is a program about a TV station.

Configure the following program (TVSHOW) to do what the above instruction asks.

//TVShow.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class TVShow
{
    static ArrayList ListTvShows = new ArrayList();
    public static void main(String[] args)
    {
        InputStreamReader inp = null;
        BufferedReader input = null;
        int nOption = 0;
        try
        {
            inp = new InputStreamReader(System.in);
            input = new BufferedReader(inp);
            while(true)
            {
                System.out.println("1. Enter TV Shows/ Add a TV Show.");
                System.out.println("2. Modify TV Show.");
                System.out.println("3. Delete TV Show.");
                System.out.println("4. Sort TV Shows.");
                System.out.println("5. Show all TV Shows.");
                System.out.println("6. Exit.");
                System.out.println(" Choose an option(1-6) >> ");
                nOption = Integer.parseInt(input.readLine());
              
                switch(nOption)
                {
                    case 1:
                        AddTVShow(input);
                        break;
                    case 2:
                        ModifyTVShow(input);
                        break;
                    case 3:
                        DeleteTVShow(input);
                        break;
                    case 4:
                        SortTVShow(input);
                        break;
                    case 5:
                        ShowAllTVShows();
                        break;
                    case 6:
                        System.out.println("Exiting program. Press any key to continue....");
                        input.read();
                        System.exit(0);
                        break;
                }
            }
        }
        catch(Exception exp)
        {
        }
    }
  
    private static void AddTVShow(BufferedReader input) throws IOException
    {
        TVShowTemplate tmpObject = null;
        while(true)
        {
            tmpObject = new TVShowTemplate();
            System.out.println("Name of the TV Show >> ");
            tmpObject.ShowName = input.readLine().toString();
            System.out.println("Day of the TV Show "+tmpObject.ShowName+"(Mon...Sun) >> ");
            tmpObject.Day = input.readLine().toString();
            System.out.println("Time of the TV Show "+tmpObject.ShowName+" (in HH:MM AM/PM format) >> ");
            tmpObject.Time = input.readLine().toString();
            if(tmpObject != null)
                ListTvShows.add(tmpObject);
          
            System.out.println(" Do you want to add another TV Show?(y/n) >>");          
            if(!input.readLine().toLowerCase().equals("y"))
                break;
        }
    }

    private static void ModifyTVShow(BufferedReader input) throws IOException
    {
         TVShowTemplate tmpObject = null;
         System.out.println("Name of the TV Show to modify >> ");
         String OldTVShowName = input.readLine();
         int index = getTVShowIndexByName(OldTVShowName);
         if(index == -1)
         {
             System.out.println(" TV Show " + OldTVShowName+ " not found.");
         }
         else
         {
             tmpObject = (TVShowTemplate)ListTvShows.get(index);
             showTVShow(tmpObject);
             System.out.println("What you want to modify (Name|Day|Time)? >>");
             String strOption = input.readLine();
             if("name".equals(strOption.toLowerCase()))
             {
                System.out.println("New Name of the TV Show >> ");
                tmpObject.ShowName = input.readLine().toString();
             }
             else if("day".equals(strOption.toLowerCase()))
             {
                System.out.println("New Day of the TV Show "+tmpObject.ShowName+"(Mon...Sun) >> ");
                tmpObject.Day = input.readLine().toString();
             }
             else if("time".equals(strOption.toLowerCase()))
             {
                System.out.println("New Time of the TV Show "+tmpObject.ShowName+" (in HH:MM AM/PM format) >> ");
                tmpObject.Time = input.readLine().toString();
             }
             else
             {
                 System.out.println("Unable to locate the propety entered..");
             }
             ListTvShows.set(index, tmpObject);
         }
    }
  
    private static int getTVShowIndexByName(String Name)
    {
        int index = -1;
        TVShowTemplate tmp =null;
        for(int i=0;i<ListTvShows.size();i++)
        {
            tmp = (TVShowTemplate)ListTvShows.get(i);
            if(tmp.ShowName.toLowerCase().equals(Name.toLowerCase()))
            {  
                index = i;
                break;
            }
        }
        return index;
    }
  
    private static void showTVShow(TVShowTemplate tshow)
    {
        System.out.println(tshow.ShowName+" "+tshow.Day+" "+tshow.Time);
    }
  
    private static void DeleteTVShow(BufferedReader input) throws IOException
    {
         System.out.println("Name of the TV Show to delete >> ");
         String OldTVShowName = input.readLine();
         int index = getTVShowIndexByName(OldTVShowName);
         if(index == -1)
         {
             System.out.println(" TV Show " + OldTVShowName+ " not found.");
         }
         else
         {
             ListTvShows.remove(index);
             System.out.println(" TV Show " + OldTVShowName+ "deleted successfully.");
         }
    }

    private static void SortTVShow(BufferedReader input) throws IOException
    {
         System.out.println("Enter the key to sort (Name|Day|Time)? >>");
         String strOption = input.readLine();
         int nSize = ListTvShows.size();
         String str1, str2;
         if("name".equals(strOption.toLowerCase()))
         {
             for(int i = 0;i<nSize;i++)
             {
                 for(int j = (i+1);j<nSize;j++)
                 {
                     str1 = ((TVShowTemplate)ListTvShows.get(i)).ShowName;
                     str2 = ((TVShowTemplate)ListTvShows.get(j)).ShowName;
                   
                     if(str1.compareToIgnoreCase(str2) > 0)
                     {
                         TVShowTemplate tmp = (TVShowTemplate) ListTvShows.get(i);
                         ListTvShows.set(i, (TVShowTemplate) ListTvShows.get(j));
                         ListTvShows.set(j, tmp);
                     }
                 }
             }
         }
         else if("day".equals(strOption.toLowerCase()))
         {
             for(int i = 0;i<nSize;i++)
             {
                 for(int j = (i+1);j<nSize;j++)
                 {
                     str1 = ((TVShowTemplate)ListTvShows.get(i)).Day;
                     str2 = ((TVShowTemplate)ListTvShows.get(j)).Day;
                   
                     if(str1.compareToIgnoreCase(str2) > 0)
                     {
                         TVShowTemplate tmp = (TVShowTemplate) ListTvShows.get(i);
                         ListTvShows.set(i, (TVShowTemplate) ListTvShows.get(j));
                         ListTvShows.set(j, tmp);
                     }
                 }
             }
         }
         else if("time".equals(strOption.toLowerCase()))
         {
             for(int i = 0;i<nSize;i++)
             {
                 for(int j = (i+1);j<nSize;j++)
                 {
                     str1 = ((TVShowTemplate)ListTvShows.get(i)).Time;
                     str2 = ((TVShowTemplate)ListTvShows.get(j)).Time;
                   
                     if(str1.compareToIgnoreCase(str2) > 0)
                     {
                         TVShowTemplate tmp = (TVShowTemplate) ListTvShows.get(i);
                         ListTvShows.set(i, (TVShowTemplate) ListTvShows.get(j));
                         ListTvShows.set(j, tmp);
                     }
                 }
             }
         }
         else
         {
             System.out.println("Unable to locate the propety entered..");
         }
         ShowAllTVShows();
    }

    private static void ShowAllTVShows()
    {
         System.out.println("****** TV Show management Program ******** ");
         System.out.println("Name Day Time");
         for(int i=0;i<ListTvShows.size();i++)
         {
           
             showTVShow((TVShowTemplate)ListTvShows.get(i));
         }
    }
}
class TVShowTemplate
{
    public String ShowName = "";
    public String Day = "";
    public String Time="";
}

Explanation / Answer

the code is long and requires good formatting for easier reading, I sent it to you by inbox. It has the following: store_data.txt file with some sample items, these are loaded when the store is launched, and saved before you exit. Item.java file with the approriate item fields, and methods for comparison and sorting JavaStore.java main class that has an array if Items, methods for insert, modify, remove, search by name, search by price (greater or less or equal) , search by stock (same as price) and search by expiration date. Sort alphabetically, by price, by stock and by expiration date. a Main menu with all the main operations as options to choose from - relying on user input for insert/remove/upadte/search etc Sub menus: 1 for sorting, another for searching And the main execution method. Please note that the File object declared in JavaStore points to the path to "store_data.txt" depending on where you're executing your java files from, and what path you set for generating the .class files, you may need to adjust that to reflect the actual file path on your machine. (can be local :"stode_data.txt" if everything is under one same folder. That might be best. Also, note that I've tried using basic java classes and double checked whether it's 1.4 comatible whenever I remembered to, but you'll still have to double check and get bacl to me on that. I think it'll be fine, but PM me if it isn't. Check your inbox :) And remember to rate.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote