|Get Selected Weeks Solution with ONLY||NOT||Add Selected Tutorials To Cart|
In this assignment, you are to design an inventory management program for a car dealership that specializes in one-of-a-kind automobiles. All of the automobiles currently in stock are listed in the text file, “AutosInStock.txt”. When an automobile is sold, your program should move it from the “AutosInStock” textfile into another textfile “AutosSold” textfile. If the AutosSold textfile doesn’t not already exist (and it doesn’t the first time your application is run), your program should create it. Further, when a customer fails to make payments on an automobile that they have purchased from the dealership, the automobile is repossessed and re-entered into stock. Therefore, your program should move any repossessed automobile from the AutosSold text file back into the AutosInStock text file. The contents of the two text files should be displayed in listboxes when the application starts. Clicking a “Sell Auto” button removes the car from the AutosInStock listbox AND text file into the AutosSold listbox AND text file. After each “move”, the listboxes should be refreshed. A quit button should be included to exit the application.
Design your form as depicted in the diagram below.
1. The text files needed for this assignment should be placed in the bin\debug folder of the project. Note that you will not have a text file for AutosInStock. Your program should create it when it doesn’t already exist.
2. When the form opens, populate the Autos in stock listbox with the names of the cars listed in the AutosInStock text file and populate the Autos Sold listbox with the cars listed in the AutosSold text file.
3. Do NOT use arrays to populate the listboxes, but instead, use LINQ queries that read directly from the text files.
4. Use the StreamWriter in conjunction with IO.File.AppendText and IO.File.CreateText to append new directories and create new text files. (Note: You will need to use the WriteLine method to write the name of the new file to each text file.)
5. To display the contents of the directories file, use a LINQ query. Loop over all of the items in the query using a For each statement to populate the listbox.
6. Before displaying the contents of the AutosInStock and AutosSold files, make sure the files exist first. You will need to use the IO.File.Exists method in your checks.
7. Use good programming practices by clearing the listboxes before refreshing them when a change is made that affects their contents.
8. Remember to close the files after accessing them.
9. To remove a listing from a directory, you may find this code helpful as it selects only those records in the file that are not the one the user wants to remove. The code should then write the results of this query back to the file:
Private Sub RemoveFromFile(ByVal filename As String, ByVal item As String)
Dim query = From auto In IO.File.ReadAllLines(filename)
Where auto <> item
10. Include appropriate error checking (i.e. check to make sure something has been selected in one of the listboxes before trying to move it to the other listbox.)
11. Use appropriate naming conventions for all controls and variables. Make sure the form has a title. Include appropriate internal documentation (i.e. comments in your code).
My tutorial contains Visual Basic Project (using Visual Studio).
If you have more questions, please contact me via email email@example.com
I will help you any time
Thank you !