order Now

Jamesblent

Programming Assignment 6 Instructions

Adapted from Introduction to Programming Using Visual Basic 2012, 9/E, David I. Schneider.

 

The figures below show the output of a Visual Basic program that displays information about Bachelor degrees conferred in 1981 and 2006, the percentage of change, and a histogram for the 2006 data.  Create this program using arrays.  The program should allow a user to display any of these tables as an option and to quit as a fourth option.  The first table is ordered alphabetically by field of study.  The second table is ordered by decreasing percentages, and the last table is ordered by increasing number of degrees.

 

Deliverables:

  1. 1.      Write a Visual Basic program that displays the information below.
  2. 2.      Do not prompt the user to enter the degree information. 
  3. 3.      Use the information below to populate your arrays.
  4. 4.      Use a DataGridView control to display the data.
  5. 5.      Order the data as described above.
  6. 6.      Use appropriate software development guidelines, such as clearing the grid before populating it with new data when a button is clicked and including a title on the form.

 

Note:  The histogram displays one asterisk for every 10,000 degrees conferred.

 

 Programming Assignment 7 Instructions

Adapted from Introduction to Programming Using Visual Basic 2012, 9/E, David I. Schneider.

 

Create and Maintain Telephone Directories

 

Write a Visual Basic program to create and maintain telephone directories.  Each telephone directory should be contained in a separate text file.  In addition, a file named Directories.txt should hold the names of the telephone directories.  At any time, names of all the telephone directories should be displayed in a list box.  After a telephone directory is selected, it becomes the current phone directory.  The following buttons should be available.

  1. a.       Create a new telephone directory. (The filename should be provided by an input dialog box.)  A new text file should be created for the directory, and the name of the new directory should be added to the Directories.txt file.  The Phone Directories listbox should immediately be refreshed to reflect the new directory, and the new directory should be automatically seleted from the listbox.  Note that this selection should trigger the procedure that sets the current directory and updates the contents of the current directory textbox.  Also note that the list of directories is displayed in ascending order in the listbox.
  2. b.      Add a listing (as given in textboxes) to the end of the current phone directory.  This action should update the text file containing the listings of the current directory and refresh the grid to display the newly added listing.
  3. c.       Delete a name (as specified in the “Name” text box) from the current phone directory.  This action should update the text file containing the listings of the current directory.  As is good software development practice, you should prompt the user with a messagebox that allows him to confirm the deletion before any permanent action is taken to delete the entry from the file.  The grid should also refresh to show the removal of the listing.
  4. d.      Display the names and phone numbers in the current phone directory.  (Note that the listings are displayed in ascending order in the table.)

 

Design your form as depicted in the diagram below.

 

 

 

 

 

Helpful hints:

  1. 1.      The text files needed for this assignment should be placed in the bin\debug folder of the project.
  2. 2.      When the form opens, populate the directories listbox with the names of the directories.
  3. 3.      Use an array and IO.ReadAllLines to populate the array with the list of directories.
  4. Use the StreamWriterin 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 Directories.txt.)
  5. When the user clicks the Create a New Phone Directory button, prompt him to enter the name using an InputBox.  If the user fails to enter a name, display a message to him (i.e. “Invalid directory name”), and do not proceed to create a new directory.  If the operation is successful, make the new directory the current directory.
  6. 6.      Before adding a new directory, make sure it doesn’t already exist. You may find it helpful to use Array.IndexOf in your check.
  7. 7.      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.
  8. 8.      Before displaying the contents of the directories file, make sure the file exists first.  You will need to use the IO.File.Exists method in your check.
  9. 9.      Use good programming practices by clearing the listbox and table before refreshing them when a change is made that affects their contents.
  10. 10.  Remember to close the files after accessing them.
  11. 11.  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:

Dim query = From line InIO.File.ReadAllLines(fileName)

Let name = line.Split(“,”c)(0)

LetphoneNum = line.Split(“,”c)(1)

Where name <>txtName.Text

Select name &”,”&phoneNum

IO.File.WriteAllLines(fileName, query.ToArray)

 

  1. 12.  Use a DataViewGrid control to display the contents of a specific directory.
  2. 13.  Include appropriate error checking (i.e. check for blank names, phone numbers, etc.)
  3. 14.  Use appropriate naming conventions for all controls.

 

We are always aiming to provide top quality academic writing services that will surely enable you achieve your desired academic grades. Our support is round the clock!

[order_calculator]