Welcome to AssignmentCache!

Search results for 'Access College Pet Sitters'

Items 1 to 10 of 32 total

per page
Page:
  1. 1
  2. 2
  3. 3
  4. 4

Grid  List 

Set Ascending Direction
  1. Programming with Microsoft VB 2017 Diane Zak Chapter 11 Utilities Solution

    Programming with Microsoft VB 2017 Diane Zak Chapter 11 Utilities Solution

    Regular Price: $7.00

    Special Price $5.00

    Programming with Microsoft VB 2017 Diane Zak Chapter 11 Utilities Solution

    Open the Utilities Solution.sln file contained in the VB2017\Chap11\Utilities Solution-DataGrid folder.
    a. Create a SQL Server database named Utilities.mdf.
    b. Add the Bills table definition shown in Figure 11-64 to the database. The Month field's (Is Identity), Identity Increment, and Identity Seed properties are set to True, 1, and 1, respectively. (Recall that you need to expand the Identity Specification property to access these properties.)
    c. After defining the table, click the Update button and then click the Update Database button.
    d. Open the Data Sources window and start the Data Source Configuration Wizard. Connect the Utilities.mdf file to the application. Include the entire Bills table in the dataset.
    e. Set the Utilities.mdf file's Copy to Output Directory property to "Copy if newer".
    f. Drag the Bills table to the form. Set the DataGridView control's AutoSizeColumnsMode property to Fill.
    g. Open the DataGridView control's task list and click Dock in Parent Container. Click Edit Columns. Change the Month column's AutoSizeMode property to ColumnHeader.
    h. Click Electricity in the Edit Columns dialog box, click DefaultCellStyle, click the ... (ellipsis) button, click Format, click the ... (ellipsis) button, click Numeric, and then click the OK button. The Format box now shows N2. Change the Alignment property to MiddleRight and then click the OK button to close the CellStyle Builder dialog box.
    i. Now, format the Water and Gas columns using the Numeric setting with two decimal places. Also, align the values in both columns using the MiddleRight setting. When you are finished setting the properties, close the Edit Columns dialog box.
    j. Change the form's Size property to 330, 200.
    k. Open the Code Editor window and enter an appropriate Try...Catch statement.
    l. Save the solution and then start the application. Enter the three records shown in Figure 11-64. (Recall that the Month field is an auto-numbered field. The numbers 1, 2, and 3 will appear when you click the Save Data button.)
    m. Stop the application and then start it again to verify that the three records were saved.

    Learn More
  2. WEB460 Lab 2 of 7 Creating and Using Master Pages Checkout Page

    WEB460 Lab 2 of 7: Creating and Using Master Pages

    Regular Price: $12.00

    Special Price $10.00

    WEB460 Lab 2 of 7: Creating and Using Master Pages

    Scenario/Summary
    In this Lab, you create a master page for our bookstore website and then modify the checkout and order confirm pages from last week's lab to use the master page.

    Deliverables
    The deliverables for this week's lab are the following:
    pgCheckOut.aspx
    pgCheckOut.aspx.cs
    pgConfirm.aspx
    pgConfirm.aspx.cs
    Web460Store.master
    Web460Store.master.cs
    web.config
    Please zip and submit the entire web project folder.

    Lab Steps
    STEP A: Create a New Web Site Project
    In this step, we set up a new project and copy the files from the Week 1 Lab into it. This allows us to begin our lab this week where we left off last week and to add common elements to both pages.
    1. To start this week's project, create a new Empty Web Application project.
    2. Copy the four files from last week's Lab into the folder for this new project. Be careful not to move the files. We want to work on a copy of last week's lab and leave the original untouched. The website folder should have the following files:
    pgCheckOut.aspx
    pgCheckOut.aspx.cs
    pgConfirm.aspx
    pgConfirm.aspx.cs
    web.config
    web.Debug.config ( optional: it depends on the version of Visual Studio you are using)
    3. Set pgCheckOut.aspx as the start page and test your application. It should perform just as it did last week.

    STEP B: Create a Master Page
    In this step, we add a master page to our project.
    1. Right-click on the name of your project and select Add => Add New Item ...
    2. Select Master Page as the type of item to add. Be sure that Place code in separate file. is checked.
    3. Name the master page Web460Store.master and click OK to create the maser page for our site.

    STEP C: Design Your Master Page
    Our master page contains elements that we want common to all pages on our website, such as the header, the footer, and two side-by-side content areas. We mark areas that content pages can fill with the ContentPlaceHolder tag.
    We also want a Label control that our content pages can modify to display messages directed to the user. Making the Label accessible to content pages requires editing the C# code for the master page, which we do in the next step.
    1. View the source for Web460Store.master. We first set the title and a content area in the head of the master page. Make any changes necessary to the <head> tag so that it matches the code below:
    <head runat="server">
    <title>WEB460 Book Store</title>
    <asp:ContentPlaceHolder id="HeadPlaceHolder" runat="server">
    </asp:ContentPlaceHolder>
    </head>
    2. Next we create the page template in the <body> of the master page. We use a table to assist with the layout. The first row of the table is the header for our page, displaying the company name and motto. It also contains the Label we will use to send messages to the user. The second table row has two content areas side by side for the website pages to place content and additional controls. The last row of the table is the page footer.
    Edit the <body> of your master page so that it looks like the following block of code:
    <body>
    <form id="form1" runat="server">
    <table style="padding: 10px; border: 1px solid black;">
    <tr style="background-color:lightcyan; text-align: center;">
    <td colspan="2">
    <!-- page header -->
    <h1>WEB 460 Book Store</h1>
    <h2>Providing you 100% more than 360 degrees</h2>
    <!-- Label for content pages to display user message -->
    <strong><span style="color:red;">
    <asp:Label ID="lblUserFeedBack" Runat="server">Welcome Traveler!</asp:Label>
    </span></strong>
    </td>
    </tr>
    <tr style="vertical-align: top;">
    <td>
    <!-- Left content area -->
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" Runat="server">
    </asp:ContentPlaceHolder>
    </td>
    <td>
    <!-- right content area -->
    <asp:ContentPlaceHolder ID="ContentPlaceHolder2" Runat="server">
    </asp:ContentPlaceHolder>
    </td>
    </tr>
    <tr style="background-color:lightgrey; text-align: center;">
    <td colspan="2">
    <!-- page footer -->
    Copyright DeVry University<br />
    <strong>User's GUID:
    <asp:Label ID="lblGUID" Runat="server" /></strong>
    </td>
    </tr>
    </table>
    </form>
    </body>

    STEP D: Expose the Label Control to Content Pages
    In this step, we modify the C# code file for our master page, Web460Store.master.cs, to modify text displayed on the Label controls.
    1. We need to establish set properties for the Label lblUserFeedback so that our content pages can change the message displayed to the user. Add the following method to the class Web460Store:
    public Label UserFeedBack
    {
    get { return lblUserFeedBack; }
    set { lblUserFeedBack = value; }
    }
    2. To provide a tool we can use for security in the future, we want to display the user GUID (globally unique identifier) for this page call. We only want to generate the GUID the first time the page is loaded (not on postback). We can accomplish this by adding the following code to the master page's Page_Load method:
    if (!Page.IsPostBack)
    {
    lblGUID.Text = System.Guid.NewGuid().ToString();
    }

    STEP E: Modify pgCheckOut to Use Our Master Page
    In this step, we modify pgCheckOut.aspx to use the master page we created earlier. Since the master page contains <head>, <body>, and <form> tags, we do not need those in our content page, so we will be removing them as part of this step. We also must map the content on this page to the ContentPlaceHolder controls on the master page.
    1. We begin by adding MasterPageFile="~/Web460Store.master" to the page directive to indicate that this page references our master page:
    <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Web460Store.master" CodeFile="pgCheckOut.aspx.cs" Inherits="pgCheckOut" %>
    2. So we have access controls the master page has exposed to us, such as the Label for user feedback. We need to add the following directive next:
    <%@ MasterType VirtualPath ="~/Web460Store.master" %>
    3. We can then remove the <!DOCTYPE>, <html>, and <head> tags because we will be using the ones defined in the master page. Also remove the <body> and <form> tags, but leave the content.
    4. Next we map the body content to the two ContentPlaceHolder controls on the master page. The customer name, address, and phone number should be in the left content area (ContentPlaceHolder1) and the credit card information in the right content area ( ContentPlaceholder2 ). We bracket the content for each with an ASP.NET Content control.
    5. Before the Label control for the customer's first name, place the line:
    <asp:Content ID="ContentArea1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    6. Just after the line for the phone number TextBox control, close the first content area with the line:
    </asp:Content>
    7. On the next line, we begin the second content area the same way as the first begins:
    <asp:Content ID="ContentArea2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    8. We close the second content area at the end of the file, after the submit button:
    </asp:Content>
    At this point, the pgCheckOut.aspx design view should look similar to the following:

    STEP F: Update the Master Page User Feedback Label
    On pgCheckOut.aspx we want the user to enter billing information. We can modify the master page Label lblUserFeedback by updating the master page's UserFeedBack property we setup earlier. So this happens when the page is loaded, making the Page_Load method in pgCheckOut.aspx.cs look like this:
    protected void Page_Load(object sender, EventArgs e)
    {
    Master.UserFeedBack.Text = "Please enter billing information.";
    }

    STEP G: Modify pgConfirm to Use the Site Master Page
    In this step, we transform the confirmation page pgConfirm to use the website master page in a similar way to how we modified pgCheckOut.
    First, modify pgConfirm.aspx:
    1. Remove unneeded HTML tags and modify the page directives as necessary.
    2. The left content area should contain the customer's name and address.
    3. The right content area should contain the customer credit card information and the Submit Order button.
    4. Remove the status label lblStatus because we will use the master page's user feedback Label.
    Then, because we removed lblStatus, we need to modify pgConfirm.aspx.cs:
    5. When the page first loads, it should display the user feedback message:
    Please confirm your billing information.
    6. After the user presses the Submit Order button, the user feedback should be:
    Your order has been submitted for processing.
    7. If there is an exception thrown by PreviousPage.IsCrossPagePostBack, it should display the message:
    Sorry, there was an error processing your request.
    When the application is rTuonpning, pgConfirm should appear similar to the following:

    STEP H: Finalize Your Lab
    1. Save your work!
    2. Test it!
    3. Make changes as appropriate until it works.
    4. Remember to add comments for each step being performed.

    Learn More
  3. CIS407 Lab 4 PayrollSystem ASP.NET Application frmMain

    CIS407 Lab 4 of 7: Web Forms with Database Interaction PayrollSystem ASP.NET Application

    Regular Price: $12.00

    Special Price $10.00

    CIS407 Lab 4 of 7: Web Forms with Database Interaction PayrollSystem ASP.NET Application

    Lab Overview
    Scenario/Summary
    In this lab, we will start with the form that we created in Week 2 (frmPersonnel) and add functionality to INSERT records into a database table and SELECT records for display to the user. We will create a typed dataset, a Data Layer class, several functions to access the data, and a connection to a database. We also will add a search form to allow the user to search records in the database and display the results of that search. Please watch the tutorial before beginning the Lab.

    Lab Steps
    Deliverables
    All files are located in the subdirectory of the project. The project should function as specified:
    When you press the Submit button in frmPersonnel, a record should be saved in the tblPersonnel table having the FirstName, LastName, PayRate, StartDate, and EndDate that you entered on the form. Add a search feature to the project. Update your main navigation page with the new options. Once you have verified that it works, save your website, zip up all files, and submit it.

    STEP 1: Data Layer
    1. Open Microsoft Visual Studio.NET.
    2. Click the ASP.NET project called PayrollSystem to open it.
    3. Open the clsDataLayer class and add the following function:
    // This function saves the personnel data
    public static bool SavePersonnel(string Database, string FirstName, string LastName,
    string PayRate, string StartDate, string EndDate)
    {
    bool recordSaved;
    try {
    // Add your comments here
    OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" +
    "Data Source=" + Database);
    conn.Open();
    OleDbCommand command = conn.CreateCommand();
    string strSQL;
    // Add your comments here
    strSQL = "Insert into tblPersonnel " +
    "(FirstName, LastName, PayRate, StartDate, EndDate) values ('" +
    FirstName + "', '" + LastName + "', " + PayRate + ", '" + StartDate +
    "', '" + EndDate + "')";
    // Add your comments here
    command.CommandType = CommandType.Text;
    command.CommandText = strSQL;
    // Add your comments here
    command.ExecuteNonQuery();
    // Add your comments here
    conn.Close();
    recordSaved = true;
    } catch (Exception ex) {
    recordSaved = false;
    }
    return recordSaved;    
    }

    4. In the frmPersonnelVerified form, go to the Page_Load() event and add the following code after the existing code (but still in the Page_Load event handler):
    // Add your comments here
    if (clsDataLayer.SavePersonnel(Server.MapPath("PayrollSystem_DB.accdb"),
    Session["txtFirstName"].ToString(),
    Session ["txtLastName"].ToString(),
    Session ["txtPayRate"].ToString(),
    Session ["txtStartDate"].ToString(),
    Session ["txtEndDate"].ToString()))
    { txtVerifiedInfo.Text = txtVerifiedInfo.Text + "\nThe information was successfully saved!"; }
    else
    { txtVerifiedInfo.Text = txtVerifiedInfo.Text + "\nThe information was NOT saved.";  }
    5. Add comments for all code containing // Add your comments here.
    6. Test your work to make sure that no errors occur! (Make sure to put in valid date values for the date data entry fields).
    STEP 2: Data Display and Search
    7. Using the skills that you learned in Week 3, create a new DataSet for the tblPersonnel table (call the DataSet dsPersonnel).

    8. Using the skills that you learned in Week 3, create a new function called GetPersonnel in the clsDataLayer class. This function should retrieve all data from the tblPersonnel table and return it in the form of a dsPersonnel DataSet. Use the GetUserActivity function as an example.

    9. Create a new Web form called frmViewPersonnel.

    10. Using the skills that you learned in Week 3, add a GridView control (called grdViewPersonnel) to the form. This GridView control will be used to display data from the tblPersonnel table. Add the ACIT logo at the top of the page and make sure it links back to frmMain.

    11. Add the following code to the Page_Load() function in frmViewPersonnel.
    if (!Page.IsPostBack)
    {
    //Declare the Dataset
    dsPersonnel myDataSet = new dsPersonnel();
    //Fill the dataset with shat is returned from the method.
    myDataSet = clsDataLayer.GetPersonnel(Server.MapPath("PayrollSystem_DB.accdb"));
    //Set the DataGrid to the DataSource based on the table
    grdViewPersonnel.DataSource = myDataSet.Tables["tblPersonnel"];
    //Bind the DataGrid
    grdViewPersonnel.DataBind();
    }

    12. Return to the frmPersonnel Web form and add a button ((ID) = btnViewPersonnel, Text = View Personnel) which, when clicked, will display form frmViewPersonnel.

    13. Open the frmPersonnelVerified form and add a button ((ID) = btnViewPersonnel, Text = View Personnel) which, when clicked, will display form frmViewPersonnel. NOTE: This is the same button with the same functionality that you added to form frmPersonnel in the previous step. Also, add a new link and linked image to frmMain called View Personnel that will go to the new frmViewPersonnel page you created.
    Let's test the View Personnel page. Start your program in Internet Explorer. Click on Add New Employee and add yourself to the database and press Submit. Once you are on the personnel verified form, click the View Personnel button. You should see the data that you just entered.
     
    14. You will now add a Search feature to allow the user to find and display data. The user will enter a last name and the Web application will display the grid of employees with all employees that match that last name.

    15. Create a new Web form called frmSearchPersonnel. Add the hyperlinked ACIT logo to this page. Also, add a new item on frmMain (with a Link button and Image button) called Search Personnel.

    16. On the frmSearchPersonnel form, add a label that displays "Search for employee by last name:". Next to the label, add a text box with an ID of txtSearch. Add a button with an ID of btnSearch and set the text of the button to "Search".

    17. When the frmSearchPersonnel Search button is pressed, the frmViewPersonnel is displayed. At this point, no searching is actually happening, but you have the forms that you need and the navigation is working. Now you can focus on the coding that you will need to do to have the grid only display matching employees.

    18. Before calling the GetPersonnel method that you added previously in the lab, you will need to get the value that is in the Request["txtSearch"] item. When the form posts the search page results to the frmViewPersonnel, the name value pair for the search value is passed as part of the Request object. This value will need to be assigned to a string variable. To do this task, add the following line of code in the code block below to the Page_Load function in frmViewPersonnel after the line: dsPersonnel myDataSet = new dsPersonnel();
    string strSearch = Request["txtSearch"];
    Then, modify the call of the GetPersonnel function one line below to add the strSearch as one of the arguments:
    myDataSet = clsDataLayer.GetPersonnel(Server.MapPath("PayrollSystem_DB.accdb"), strSearch);

    19. Modify the GetPersonnel method that you added in the clsDataLayer.cs class to include a new parameter called strSearch of type string. Add string strSearch as an argument to the function as below:
    public static dsPersonnel GetPersonnel(string Database, string strSearch)
    Then modify the sqlDA select statement within the GetPersonnel function to test if a value is entered for a search parameter.
    if (strSearch == null || strSearch.Trim()=="")
    { sqlDA = new OleDbDataAdapter("select * from tblPersonnel", sqlConn); }
    else
    { sqlDA = new OleDbDataAdapter("select * from tblPersonnel where LastName = '" + strSearch + "'", sqlConn); }
    20. Test the search so that when you enter a last name, employees with that last name are returned. Make sure that when you access frmViewPersonnel and you are not searching, all employees are returned.
    STEP 3: Test and Submit
    Run your project and test it as follows:
    The frmMain form should be displayed first.
    Click on the Add New Employee hyperlink to go to the frmPersonnel data entry form. Click the View Personnel button on this form. The frmViewPersonnel form should be displayed in the browser, but at this point, there should not be very many personnel listed.
    Use the Back button in your Web browser to return to the frmPersonnel form and enter some personnel data for a few employees, similar to the following:
     
    Now, click the Submit button. The frmPersonnelVerified form should be displayed, showing the data you entered, and you should get a message saying that the data were successfully saved, like this example.
     
    You should be able to view the employee records by clicking the View Personnel link on the home page.
     
    Test the Search feature and make sure that entering no search string returns all of the data and that typing in a last name will return all employees with the same last name.

    NOTE: Make sure that you include comments in the code provided where specified (where the " // Your comments here" line appears) and for any code that you write, or else a 5-point deduction per item (form, class, function) will be made.

    Learn More
  4. CIS407 Lab 3 PayrollSystem

    CIS407 Lab 3 PayrollSystem ASP.NET Application

    Regular Price: $12.00

    Special Price $10.00

    CIS407 Lab 3 PayrollSystem ASP.NET Application

    STEP 1: Step Title
    1. Open Microsoft Visual Studio.NET.
    2. Open the PayrollSystem website by clicking on it in the Recent Projects list, or by pulling down the File menu, selecting Open Website, navigating to the folder where you previously saved the PayrollSystem, and clicking Open.
    3. Download the PayrollSystem_DB.accdb file from the Files section and save it on your local computer. (Note: your operating system may lock or block the file. Once you have copied it locally, right click on the file and select Properties and then Unblock if available). Then add it to the PayrollSystem website as follows: In Visual Studio, in the Solution Explorer click Website, Add Existing Item, then navigate to the PayrollSystem_DB.accdb file you downloaded, and click the Add button.
    Make sure you select file types, which include *.accdb, *.accdb, etc. Otherwise, you will not be able to see the database file to select.
    4. Now we need to create a new connection to the PayrollSystem_DB.accdb. To begin, click View Server Explorer.
    5. When the Server Explorer toolbox appears, click the Connect to Database button.
    6. When the Add Connection dialog appears, click the Change button. In the Change Data Source dialog, select MS Access Database File; Uncheck Always use this Selection; then click OK.
    Press Continue to get the following screen.
    7. Click the Browse button to navigate to the PayrollSystem_DB.accdb file in your website folder, then click Open. (NOTE: Be sure you select the PayrollSystem_DB.accdb file in your PayrollSystem website folder, not the one you originally downloaded from the Files section). Click Test Connection. You should receive a message that the test connection succeeded. Click OK to acknowledge the message, then click OK again to close the Add Connection dialog.
    8. The PayrollSystemDB.accdb should be added to the Server Explorer. Expand the database, then expand the Tables entry under the database until you see tblUserActivity. Leave the Server Explorer window open for now as you will be returning to it in a moment.
    9. Create a new dataset by selecting Website-> Add New Item. Under Templates, select the Dataset item. Enter dsUserActivity.xsd for the name. Click Add.
    10. If the following message appears, select Yes. You want to make this dataset available to your entire website.
    11. If the TableAdapter Configuration Wizard dialog appears, click Cancel. (We will be configuring a Data Adapter for this dataset later in C# code, so we do not need to run this wizard.)
    12. Drag-and-drop the tblUserActivity table from the Server Explorer window into the dsUserActivity dataset in the editor window.
    NOTE: If you see a message that says your connection uses a local data file that is not in the current project, that indicates you did not select the correct PayrollSystem_DB.accdb file when you created your data connection. To fix this problem, click No, then right-click on PayrollSystemDB.accdb in the Server Explorer window and choose Modify Connection. Click the Browse button, navigate to the PayrollSystemDB.accdb file that is in your PayrollSystem website folder, and click Open. Test the connection, then click OK.
    Click the Save icon on the toolbar to save the dsUserActivity.xsd dataset.
    (You can now close the Server Explorer window if you wish.)
    13. Create a new class to contain the C# code that will access this dataset. To do so, click Website, Add New Item. In the Add New Item dialog, select the Class template, and enter clsDataLayer for the name. Make sure the Language is set to Visual C#. Click Add.
    14. If the following message appears, select Yes. You want to make this class available to everything in your solution.
    15. Add the following to the top of your class, below any other using statements created for you by Visual Studio.
    Add to top of class
    // Add your comments here
    using System.Data.OleDb;
    using System.Net;
    using System.Data;
    16. Add the following three functions inside the squiggly braces for the public class clsDataLayer class, above the beginning of the public clsDataLayer() constructor and save the class.
    Class
    // This function gets the user activity from the tblUserActivity
    public static dsUserActivity GetUserActivity(string Database)
    {
    // Add your comments here
    dsUserActivity DS;
    OleDbConnection sqlConn;
    OleDbDataAdapter sqlDA;
    // Add your comments here
    sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database);
    // Add your comments here
    sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn);
    // Add your comments here
    DS = new dsUserActivity();
    // Add your comments here
    sqlDA.Fill(DS.tblUserActivity);
    // Add your comments here
    return DS;
    }
    // This function saves the user activity
    public static void SaveUserActivity(string Database, string FormAccessed)
    {
    // Add your comments here
    OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" +
    "Data Source=" + Database);
    conn.Open();
    OleDbCommand command = conn.CreateCommand();
    string strSQL;
    strSQL = "Insert into tblUserActivity (UserIP, FormAccessed) values ('" +
    GetIP4Address() + "', '" + FormAccessed + "')";
    command.CommandType = CommandType.Text;
    command.CommandText = strSQL;
    command.ExecuteNonQuery();
    conn.Close();
    }
    // This function gets the IP Address
    public static string GetIP4Address()
    {
    string IP4Address = string.Empty ;
    foreach (IPAddress IPA in
    Dns.GetHostAddresses(HttpContext.Current.Request.UserHostAddress)) {
    if (IPA.AddressFamily.ToString() == "InterNetwork") {
    IP4Address = IPA.ToString();
    break;
    }
    }
    if (IP4Address != string.Empty) {
    return IP4Address;
    }
    foreach (IPAddress IPA in Dns.GetHostAddresses(Dns.GetHostName())) {
    if (IPA.AddressFamily.ToString() == "InterNetwork") {
    IP4Address = IPA.ToString();
    break;
    }
    }
    return IP4Address;
    }
    STEP 2: frmUserActivity, frmPersonnel, frmMain
    17. Create a new web form called frmUserActivity. Switch to Design Mode and add the ACIT logo to the page as an ImageButton and link it back to frmMain. Below the image button add a panel. To the panel, add a Label and GridView (found under the Toolbox, Data tab) having the following properties.
    Property Value
    Label – Text User Activity
    GridView – (ID) grdUserActivity
    18. Go to the Page_Load method by double clicking an empty space on the page and add the following code.
    Page_Load method for frmUserActivity.aspx
    if (!Page.IsPostBack) {
    // Declares the DataSet
    dsUserActivity myDataSet = new dsUserActivity();
    // Fill the dataset with what is returned from the function
    myDataSet = clsDataLayer.GetUserActivity(Server.MapPath("PayrollSystem_DB.accdb"));
    // Sets the DataGrid to the DataSource based on the table
    grdUserActivity.DataSource = myDataSet.Tables["tblUserActivity"];
    // Binds the DataGrid
    grdUserActivity.DataBind();
    }
    19. Open the frmMain form, add a new link button and image button to point to the new frmUserActivity. Find an image to use for the image button and add the new option as View User Activity.
    20. Go to the frmMain Page_Load and add the following code.
    frmMain.aspx Page_Load code
    // Add your comments here
    clsDataLayer.SaveUserActivity(Server.MapPath("PayrollSystem_DB.accdb"), "frmPersonnel");
    21. In the Solution Explorer, right click on the frmMain.aspx form and select Set As Start Page. Run your project. When you open the project, a record should be saved in the tblUserActivity table with the IP address, form name accessed (frmPersonnel), and the date accessed. When you click the View Activity button, you should see at least one record with this information.
    23. You will now add server side validation code to the frmPersonnel page. Currently, when the Submit button is pressed, the frmPersonnelVerified page is displayed. This is because the frmPersonnelVerified page is set as the Submit button's PostBackUrl property. Instead of having the page go directly to the frmPersonnelVerified page when the Submit button is pressed, we want to do some server side validation. If any of the validation rules fail, we will redisplay the frmPersonnel page with the fields in question highlighted in yellow with an error message displayed.
    First, it is important to understand what is currently happening when the submit button is pressed. This is causing a postback of the form to the frmPersonnelVerified form. When this postback happens, all of the data in the fields on the frmPersonnel form are sent to the frmPersonnelVerified form as name value pairs. In the Page_Load code of frmPersonnelVerified these values are picked up from the Request object and displayed. Each name value pair will be in the Request object as the ID of the control containing the value and the value itself. We can pass data between pages by using Session state instead. In order to do validation on the values but still have the values visible on the frmPersonnelVerified page, we will need to change not only the PostBack URL of the frmPersonnel page but also how the frmPersonnelVerified form is getting the data—it will need to get it from Session state rather than from the Request object.
    In order to do this, we will make the following changes.
    1. Clear the Submit button PostBackURL Property on the frmPersonnel form. Remove the value in the PostBackUrl that is highlighted.
    2. In the btnSubmit_Click event handler get each value from the data entry fields and set Session state items for each. (instructions below)
    3. Change the frmPersonnelVerified code behind to get the values from the Session state items you created in the previous step. (instructions below)
    When you are done with these steps, you should be able to enter data on the frmPersonnel data entry form and then click the Submit button. The frmPersonnelVerified page should then be displayed with the values that were in the data entry fields on frmPersonnel.
    23. Add a label to the frmPersonnel form with an ID of lblError. Do not place the label to the right or left of any of the controls on the form. Add it below the controls or above the controls. The text property of this label should be set to an empty string.
    24. Add code to perform server side validation in response to the submit button being clicked. Here are the business rules we want to enforce (remember this will be server C# code in the frmPersonnel code behind): Fields may not be empty or filled with spaces. If any field is empty, turn that field background color to yellow and add to/create an error message to be shown in the error label. The end date must be greater than the start date. If the end date is less than the start date, turn both date fields yellow and add to/create an error message to be shown in the error label. If all fields validate properly then the session state items should be set properly and the user should see the frmPersonnelVerified form with all the values displayed.
    frmPersonnel.aspx Lab Hints
    1. The server side validation should be in the Submit button's event handler. There is a Trim method on the string object that will automatically remove spaces from the beginning and end of a string. To test if txtFirstName is empty or filled with spaces, use the following code.
    if (Request["txtFirstName"].ToString().Trim() == "")
    2. To set the background color of the txtFirstName field, use the following code.
    txtFirstName.BackColor = System.Drawing.Color.Yellow;
    3. To set a value in session state and redirect the response to the frmPersonnelVerified.aspx do the following. txtFirstName is the key and txtFirstName.Text is the value.
    Session["txtFirstName"] = txtFirstName.Text;
    //Need to set session variables for all text boxes
    Response.Redirect("frmPersonnelVerified.aspx");
    4. You may want to create variables to work with for validation rather than using the Request item objects directly.
    To turn a string into a DateTime object you can use the DateTime method Parse. If you had a date value stored in a string called strDate, you could turn it into a DateTime object like this.
    DateTime myDateTimeObject = DateTime.Parse(strDate);
    You can compare two DateTime objects by using the DateTime.Compare method. If you had two DateTime objects called dt1 and dt2 you can check to see if dt1 is greater than dt2 by doing this.
    if (DateTime.Compare(dt1,dt2) > 0)
    DateTime.Compare will return a 0 if the two dates are equal, a 1 if dt1 is greater than dt2, and a -1 if dt1 is less than dt2.
    If you put in an invalid date for either of the date fields, you will get an exception/server error when trying to parse the values. We will address this in a later lab—for now make sure you enter valid dates (valid meaning a date in the form of mm/dd/yyyy).
    5. An example of the code you might want to use to test if the end date is after the start date follows.
    DateTime startDate = DateTime.Parse(Request["txtStartDate"]);
    DateTime endDate = DateTime.Parse(Request["txtEndDate"]);
    if (DateTime.Compare(startDate, endDate) > 0)
    {
    txtStartDate.BackColor = System.Drawing.Color.Yellow;
    txtEndDate.BackColor = System.Drawing.Color.Yellow;
    Msg = Msg + "The end date must be a later date than the start date.";
    //The Msg text will be displayed in lblError.Text after all the error messages are concatenated
    validatedState= false;
    //Boolean value - test each textbox to see if the data entered is valid, if not set validState=false.
    //If after testing each validation rule, the validatedState value is true, then submit to frmPersonnelVerified.aspx, if not, then display error message
    }
    else
    {
    txtStartDate.BackColor = System.Drawing.Color.White;
    txtEndDate.BackColor = System.Drawing.Color.White;
    }
    Remember to clear the PostBackURL property of the Submit button!
    frmPersonnelVerified.aspx Lab Hints
    When using the Session state in frmPersonnel.aspx for txtFirstName, you used the following code: Session["txtFirstName"] = txtFirstName.Text;
    To get this same value back from the session we use the key and the Session object in the Page_Load of frmPersonnellVerified.aspx (instead of using Request, use Session) as follows.
    Session["txtLastName"].ToString()
    STEP 3: Verify and Submit
    23. View the video above on what functions your lab should have so far.
    24. Run your project. When you open the project and go to the main menu form a record should be saved in the tblUserActivity table with the IP address, form name accessed (frmPersonnel), and the date accessed. When you click the View Activity button you should see at least one record with this information. The validation and error display should work for entering data. All navigation and hyperlinks should work.
    Once you have verified that it works, save your project, zip up all files, and submit it.

    NOTE: Make sure you include comments in the code provided where specified (where the " //Your comments here" is mentioned) and for any code you write, or else a five-point deduction per item (form, class, function) will be made. You basically put two forward slashes, which start the comment; anything after the // on that line is disregarded by the compiler. Then type a brief statement describing what is happening in the following code. Comments show professionalism and are a must in systems. As a professional developer, comments will set you apart from others and make your life much easier if maintenance and debugging are needed.

    Learn More
  5. CIS407 Lab 1 PayrollSystem Default Page

    CIS407 Lab 1 PayrollSystem ASP.NET Application

    Regular Price: $8.00

    Special Price $5.00

    CIS407 Lab 1 PayrollSystem ASP.NET Application

    In this Lab, you will create an Annual Salary Calculator ASP.NET Web application using Visual Studio.NET.
    For the Labs, you will use the Microsoft Visual Studio software application. You have two options for using this application:
    - You may use a copy of Visual Studio that is installed on your local PC. If you do not already have this software, there is a link in the Syllabus (in the Textbook and Required Materials section) that you can follow to obtain a copy at low or no cost through the DeVry Student Software Fulfillment Center.
    or
    - You may run Visual Studio over the Web from the DeVry Lab (Citrix) server. Instructions for using the Lab (Citrix) server are on the Lab page under the Introduction & Resources Module.
    Throughout this course, you will be creating a Web application for a fictitious company called ACIT (Academy of Computing and Information Technology). To get familiar with the development environment, follow the Lab Steps to create a simple Annual Salary Calculator ASP.NET Web application. You will be adding to this application each week.

    Overview of Fictitious Company
    The Academy of Computing and Information Technology is a mid-size indie (independent) film studio that is in need of a payroll system. We have outgrown our current system, a simple spreadsheet, to the extent that it takes three people over one week to pay everyone on a timely basis.

    Overview of Our Company
    We have over 2,000 full-time and part-time employees. We produce comedy, fiction, and science fiction films with budgets of $250K–$20 million. We have produced over 50 films since we first began 20 years ago.
    We are very profitable and have strong links to many of the industry's most powerful people.

    Current Payroll System
    Our current system consists of mostly manual processing using an MS Excel spreadsheet to control who gets paid.
    The system consists of the three payroll staff members reviewing each of the full-time staff members' wages, calculating how many hours they worked based on their hourly rate, and paying them by issuing a check.
    The check needs to be entered in another worksheet for each of the people who were paid so that we can tell when it went out, how much it was for, and if it was cashed or not. If a [Date_Cashed] is entered, we deduct that amount from our working payroll capital account to track how much money we have for payroll.
    This process is then repeated for all part-time staff and independent contractors.

    Our Needs
    We need a more automated way to pay our staff. We need to use the same logical flow as a basis, yet improve on it by having a way to
    1. easily calculate the projected annual salary based on rate and number of hours;
    2. search, enter, update, and delete staff and independent employee information in one place;
    3. search, enter, update, and delete payroll automation information for the employee to set up recurring payments or one-time payments;
    4. produce reports to show the following: (a) summary of who got paid per week, (b) summary of all payments per week, (c) details of any employee to-date (allow entry of a specific employee ID);
    5. allow transactions to be rolled back in case we pay someone too much;
    6. make use of transaction processing in case the system unexpectedly shuts down;
    7. ensure the system is secure (logins required);
    8. allow only authorized payroll personnel to control all aspects of the system;
    9. allow only authorized payroll personnel to view transactions and user activity;
    10. allow only authorized payroll personnel to e-mail reports to users using the e-mail on file; and
    11. incorporate error handling into all processes in the system and e-mail any errors to the technical support people.

    Required Software
    Microsoft Visual Studio.Net
    Access the software at https://lab.devry.edu (Links to an external site.)Links to an external site..
    Steps: 1, 2, and 3
    STEPs 1–3: Create Website and Home Page
    Please watch this video for a similar example to the one we are doing. It introduces event handlers, getting data from textboxes, performing basic calculations, and formatting the output to be displayed:
    In this Lab, we will learn how to create a simple ASP.NET Web application using Microsoft Visual Studio.NET. The application will display the text "Hello, World" on the home page.
    1. Open Microsoft Visual Studio.

    2. Create a new ASP.NET website called "PayrollSystem."
    To do this, select File -> New -> Web Site

    You will get the following screen which shows Visual Basic.

    Select Visual C# template on the left of your screen if it is not already selected. Notice that your screen will now show Visual C# instead of Visual Basic.

    Click Browse at the bottom of the screen to change Web Location, if necessary to get the screen below.

    Notice that my Web Location is now different.
    Select ASP.NET Empty project and click OK to get the screen below.

    Right-click on the project name from Solution Explorer, then select Add->Add New Item to get the following screen.

    Select Web Form, accept Default.aspx file, and click Add to get:

    Click Design at the bottom left-hand of the window to show the following:

    Edit the Default.aspx file (the home page for your site) to add the message "Greetings and Salutations. I will master ASP.NET in this course."
    To do this, if necessary, click the Design button below the editing window to switch to Design view, then click in the editing window and type " Greetings and Salutations. I will master ASP.NET in this course." (without the quotes) to get the following screen.

    Click the Save button on the toolbar to save the changes to Default.aspx.
    STEPs 4–5: Start Debugging; NOTE: Citrix users have different steps!

    3. To ensure that everything is working properly, click the Start Debugging button on the toolbar, or press the F5 key on the keyboard, or pull down the Debug menu and select Start Debugging.

    Save and run by Right-Click-> Run from Browser.

    Press Yes.

    Click the Start Debugging button on the toolbar, or press the F5 key on the keyboard, or pull down the Debug menu and select "Start Debugging."

    Notice that this time the project build and website validation started.
    If the Debugging Not Enabled dialog box appears, select the option to add or modify the Web.config file to enable debugging and click OK. You should only have to do this the first time you debug the site.
    You will get a clean run just as you did previously. Your output screen looks like the screen below.

    NOTE: To execute the application, you have these options:
    • If you are using Citrix, press CTRL + F5 to Start Without Debugging. You will not be deducted points for this part.
    • If you are using a standalone version, press F5 to Start with Debugging, or you can press CTRL + F5 to Start Without Debugging.
    Create the Salary Calculator Form
    1. Right click on the Project name. Choose Add, then Select Web Form to get the screen below.

    And you get the Add New Item screen, shown below.

    2. Select the name of the form you will add frmSalaryCalculator.aspx. Make sure "Place code in separate file" is checked and "Select master page" is unchecked.
    You will create a Web-based salary calculator on this new page.
    Click the Design view.
    Add the Tools Window using View-> Toolbox.

    3. You can choose to adjust the ToolBox to tab with Solution Explorer to look like the following screen.

    You will create a Web-based salary calculator on this new page.
    To do this, open the aspx page in Design view and, from the Toolbox, drag a label into the form, click after the label and add about 5 spaces, then drag a textbox control after the label.
    Press Enter after the textbox to put the cursor on the next line.
    Add another label and textbox below the first set and press Enter.
    Then add a button control. Finally, on the last line, add another label. Your form should look like the screen displayed below.

    4. If necessary, add the Property Window as shown in the screen below, using View->Properties Window.

    5. Now we will modify the page to add proper labels and give the textboxes names.
    • Change the text displayed in each label so that the first label displays Annual Hours; the second label should display Rate; and the third label should display $.
    • To change the text displayed, click on the label control. This causes the property window to show all properties of the label, then change the Text property of the control in the Properties window.
    • Set the ID property of the top textbox to txtAnnualHours.
    • Set the ID property of the second textbox to txtPayRate. Set the ID of the bottom label (the one we set the text property to "$") to lblAnnualSalary. (Note: We set these IDs as we will be accessing the control values from the C# code. You can set the button ID and the other two labels' ID properties as well, but we won't be accessing them from our code.)
    • Change the button text to display Calculate Salary. (Hint: To change the text displayed as the button label, change the Text property of the button.) The ID of the button should be btnCalculateSalary.Your form should now look like the screen displayed below.

    This code will be called each time the user presses the button. It is important to remember that code in the code behind page executes on the server, not on the user's browser. This means that when the button is pressed, the page is submitted back to the Web server and is processed by the ASP.Net application server on the Web server. It is this code (between the { and } in this method) that will execute on the server. Once it is done executing, the page will be sent back to the browser. Any changes we make to the page or controls on the page will be shown to the user in the updated page.
    • In this method, add code that will get the text in the txtAnnualHours text box, convert it to a Double, and store it in a double variable.
    • Add code that will get the text from the txtPayRate text box, convert it to a Double, and store it in another variable.
    • Create a third variable of type Double and set its value to the annual hours variable value multiplied by the rate double variable value.
    • Take this resulting value and convert it to a string (text), and update the lblAnnualSalary Text property with this new string.
    Let's look at a similar example. After reviewing this example, write the code needed to calculate the annual salary.
    CostOfRoom Calculator is the alternate example, which demonstrates the skills you need to complete this assignment. See video at the top of this lab document and screenshots below.
    What follows is an example of code-behind the Calculate button for the CostOfRoom Calculator:
    Code-behind the calculate button
    A control's property can be accessed by simply using the control ID followed by a . followed by the name of the property. For example, the value stored in the Text property of the txtAnnualHours control can be accessed by using this: txtAnnualHours.Text. Text properties on controls are of type string.
    The output of the CostOfRoom calculator is shown in the screen below with Length, Width, Cost Per Square Unit labels and input boxes, and the Calculations button.

    Use small values for length and width.
    Use large values for length and width and see the formatting of the output.

    To convert a string to a Double you can use the Convert class. If we had a string variable called str1 and a double variable called myNumber, the C# code to convert this would be as follows:

    When converting from one type to another, we are assuming that the value stored in the type being converted is compatible with the type with which we are converting. In the example above, if the value stored in str1 was not a type compatible with a Double (for example, tiger), an error would be raised.
    All of the base types in C# (double, int etc) have a ToString() method that you can call. If you had a double variable that you wanted to convert to a string and set that string to my label's text, you would do the following:
    This would take whatever value was stored in the myNumber Double and convert it to a string.
    Set your new form as the start page by clicking once on the form name in the Solution Explorer and then right-clicking on the form name and selecting Set as Start Page. You can now test your application and make sure it works correctly as you did with the Hello World form above. You can switch back and forth between which form runs when you run your application by setting the different forms as the start page. The final result should look something like the screen below with the Annual Hours, Pay Rate, Calculate Salary button, and result.

    Once you have verified that your project works, save your project, zip all files, and submit it.
    NOTE: Please download and review the Files section files Web Lab and Citrix.zip, which contain information on how to FTP to the DeVry University website and how to use Citrix for the assignments.

    Learn More
  6. Warren High School Visual Basic Application

    Warren High School Visual Basic Application

    Regular Price: $15.00

    Special Price $12.00

    Warren High School Visual Basic Application

    This year, three students are running for senior class president Mark Stone, Sheima Patel, and Sam Parez. Create an application that keeps track of the voting - for each click on the "Record Vote" button, a corresponding vote is recorded for the candidate selected in the list. Save the voting information in the sequential access file. The application also should display the number of votes per candidate. A design suggestion for the form is shown below.

    Learn More
  7. Advanced Visual Basic 2010 Chapter 7 Programming Challenge 5 Students and Course Lists

    Advanced Visual Basic 2010 Chapter 7 Programming Challenge 5 Students and Course Lists

    Regular Price: $20.00

    Special Price $15.00

    Advanced Visual Basic 2010 Chapter 7 Programming Challenge 5 Students and Course Lists

    In this programming challenge, you will use LINQ statements to display college courses taken by selected students. You will use a CourseRegistration database, which contains tables named Students and Courses.
    • The Students table contains the following columns: Id (smallint, primary key), LastName (varchar(30)), Status (smallint), and Major (varchar(5)).
    • The Courses table contains the following columns: Id (varchar(10)), Student_Id(smallint), Credits (smallint), and Grade (float). The primary key of the Courses table consists of two combined columns: Id and Student_Id.
    Figure 7-21 shows a one-to-many relationship between the Students and Courses tables. You can find the CourseRegistration.mdf database file in the chapter examples folder.

    Use a LINQ query to fill a DataGridView with a list of Student objects. When the user selects a student in the grid, display all courses taken by the student in a separate grid. Use another LINQ query to fill the second grid. A sample is shown in Figure 7-22, in which Student 1001 (Charles) was selected by clicking the left side of his row. The grid on the right fills with the list of courses taken by the selected student. Notice that the rightmost column in the Student grid displays a count of the number of courses the student has taken. This column was not in the database, but it is calculated by the LINQ query. We showed how to do such a calculation in Section 7.1.

    The two DataGridView controls should be inserted into panels belonging to a Split-Container control. At runtime, the user will drag the divider between the two panels to adjust their size. To format the Grade column in the right-hand grid, set its Default-CellStyle.Format property like this:
    dgvCourses.Columns(2).DefaultCellStyle.Format = "n"

    Learn More
  8. Visual Basic 2010 How to Program Deitel Exercise 7.15 Telephone-Number Word Generator

    Visual Basic 2010 How to Program Deitel Exercise 7.15 Telephone-Number Word Generator

    Regular Price: $20.00

    Special Price $15.00

    Visual Basic 2010 How to Program Deitel Exercise 7.15 Telephone-Number Word Generator

    (Telephone-Number Word Generator) Standard telephone keypads contain the digits zero through nine. The numbers two through nine each have three letters associated with them(Fig 7.29). Many people find it difficult to memorize phone numbers, so they use the correspondence between digits and letters to develop seven-letter words that correspond to their phone numbers. For example, a person whose telephone number is 686-2377 might use the correspondence indicated in Fig. 7.29 to develop the seven-letter word "NUMBERS." Every seven-letter word corresponds to exactly one seven-digit telephone number. A restaurant wishing to increase its takeout business could surely do so with the numbers 825-3688 (that is, "TAKEOUT"). Every seven-letter phone number corresponds to many different seven-letter combinations. Unfortunately, most of these represent unrecognizable juxtapositions of letter. It's possible, however, that the owner of a barbershop would be pleased to know that the shop's telephone number, 424-7288, corresponds to "HAIRCUT." A veterinarian with the phone number 738-2273 would be pleased to know that the number corresponds to the letters "PETCARE." An automotive dealership would be pleased to know that the dealership number, 639-2277, corresponds to "NEW CARS."

    Write an application that allows the user to enter a seven-digit number in a TextBox, and displays every possible seven-letter word combination corresponding to that number in a multiple line scrollable TextBox when the user clicks the Generate Words button. There are 2,187 (3 To the seventh power) such combinations. Avoid phone numbers with the digits 0 and 1.

    Learn More
  9. BMIS 209 Programming Assignment 6 Polymorphic Banking Application

    CSIS 209 Programming Assignment 6 Polymorphic Banking Application

    Regular Price: $15.00

    Special Price $12.00

    CSIS 209 Programming Assignment 6 Polymorphic Banking Application

    Adapted from: Deitel & Deitel (2017). Visual C# 2015 How to Program (6th ed.). Pearson Education, Inc.

    Develop a polymorphic banking application using the Account hierarchy you created in Assignment #5. Create the following two SavingsAccount objects and two CheckingAccount objects and store them in an array called "arrays" of Account references to the objects:
    Account Name Account Number Initial Balance Fee Charged Interest Rate
    [your name]-Savings-1 1 1,000 4%
    [your name]-Savings-2 2 2,000 5%
    [your name]-Checking-1 3 3,000 3.00
    [your name]-Checking-2 4 4,000 4.00

    Using a foreach loop, iterate over each account in the array. For each Account in the array, first print the account. Next, allow the user to specify an amount of money to withdraw from the Account using method Debit and an amount of money to deposit into the Account using method Credit. Specifically, for each account, prompt the user to enter an amount to deposit in the account and call the Credit method. Print the object.

    Next, prompt the user to enter an amount to withdraw and call the Debit method. Print the object. After the user has made a deposit and a withdrawal from an account, calculate interest if the account is a SavingsAccount and print the object.

    To perform this step, you must first determine the object’s type. If the Account is a SavingsAccount, calculate the amount of interest owed to the Account using method CalculateInterest and print the account a final time. If the account is a CheckingAccount, you do not need to CalculateInterest nor print the account a final time.

    Hint: To determine if an account is a savings or checking account, use the .getType method which returns a string representing the Name or FullName property. Then use the ".Equals" method to determine if the returned string is equal to the name of the class. For example, acct.getType().Name returns the string "SavingsAccount" or "CheckingAccount". Once you have determined that an account is a SavingsAccount object, you must "cast" the account object into a SavingsAccount object in order to access its CalculateInterest method. I like to perform this in two steps: declare a different variable to hold the reference to the object that has been cast from an Account object into a SavingsAccount object. Then, using this new variable, invoke its CalculateInterest method. For example, at the beginning of the Main() method, I declare a variable of type SavingsAccount as follows:
    SavingsAccount temp_account;

    In my foreach loop, I have a variable called "acct" that is defined as an Account object. To downcast this Account object into a SavingsAccount object, I use the syntax:
    temp_account = (SavingsAccount) acct;

    At this point, because temp_account is a SavingsAccount object, I can invoke its CalculateInterest method:
    temp_account.CalculateInterest();

    Learn More
  10. BMIS 209 Programming Assignment 5 Account Inheritance Program

    CSIS 209 Programming Assignment 5 Account Inheritance Program

    Regular Price: $15.00

    Special Price $12.00

    CSIS 209 Programming Assignment 5 Account Inheritance Program

    Adapted from: Deitel & Deitel (2017). Visual C# 2015 How to Program (6th ed.). Pearson Education, Inc.

    Create an inheritance hierarchy that a bank might use to represent customer's bank accounts. All customers at this back can deposit (i.e. credit) money into their accounts and withdraw (i.e. debit) money from their accounts. More specific types of accounts also exist. Savings accounts, for instance, earn interest on the money they hold. Checking accounts, on the other hand, charge a fee per transaction.

    Create base class Account and derived classes SavingsAccount and CheckingAccount that inherit from class Account. Base class Account should include the following private instance variables: Balance, which is of type decimal to represent the account balance; AccountName, which is of type string and represents the account holder's last name; and AccountNumber, which is an integer type that represents the account’s number. The class should provide a constructor that receives an account’s name, account number, and an initial balance. It should use initialize these instance variables using the appropriate mutator methods (i.e. setAccountName, setAccountNumber, and setBalance). The setBalance method should validate the initial balance to ensure that it's greater than or equal to 0.0; if not, set the balance to 0. You should also include the appropriate accessor (i.e. "get") methods. Also, the class should provide two other public methods: Method Credit should add an amount to the current balance. Method Debit should withdraw money from the Account and ensure that the debit amount does not exceed the Account’s balance. If it does, the balance should be left unchanged, and the method should print the message "Insufficient Funds." Base class Account should also have a method called PrintAccount that prints the account’s name, number, and balance.

    Derived class SavingsAccount should inherit the functionality of an Account, but also include a decimal instance variable indicating the interest rate (double) assigned to the Account. Call this variable InterestRate. SavingsAccount's constructor should receive the account's name, account number, initial balance, and an initial value for the interest rate. The constructor should call the base class constructor to initialize the account's name, number, and balance. It should also call a method in its own class, setInterestRate, which should set the InterestRate variable and validate that the rate is a positive number. If the interest rate passed in is negative, set the interest rate to zero. SavingsAccount should provide public method CalculateInterest that takes no arguments and returns a decimal indicating the amount of interest earned by an account. Method CalculateInterest should determine this amount by multiplying the interest rate by the account balance. [Note: SavingsAccount should inherit methods Credit and Debit without modifying them.] Finally, create a method in this derived class that overrides the PrintAccount method in the base class. In it, call the base class method to print out the account's name, number, and balance, and include code in the derived class’s method to print out the information specific to the derived class (i.e. InterestRate).

    Derived class CheckingAccount should inherit from base class Account and include a decimal instance variable that represents the fee charged per transaction. Call this variable FeeCharged. CheckingAccount's constructor should receive the account's name, account number, initial balance, as well as a parameter indicating a fee amount. Create a mutator method, setFeeAmount, and call it from the constructor. If the fee amount is negative, the setFeeAmount should set it to zero. Class CheckingAccount should redefine methods Credit and Debit so that they subtract the fee from the account balance whenever either transaction is performed successfully. CheckingAccount's versions of these methods should invoke the base-class Account to perform the updates to an account balance. CheckingAccount's Debit method should charge a fee only if money is actually withdrawn (i.e. the debit amount does not exceed the account balance.) [Hint: Define Account's Debit method so that it returns a bool indicating whether money was withdrawn. Then use the return value to determine whether a fee should be charged.] Finally, create a method in this derived class that overrides the PrintAccount method in the base class. In it, call the base class method to print out the account's name, number, and balance, and include code in the derived class’s method to print out the information specific to the derived class (i.e. FeeCharged).

    After defining the classes in this hierarchy, write an application that creates one object of each derived class and tests their methods. Add interest to the SavingsAccount object by first invoking its CalculateInterest method, then passing the returned interest amount to the object's Credit method. The order of events should be performed as follows:
    1. Create a new checking account object. Assign it an initial balance of $1,000. The account name should be your last name concatenated with the word "Checking", and the account number should be 1. The fee charged should be 3.00. Print a description of this transaction (i.e. "Created checking account with $1,000 balance.")
    2. Create a new savings account object. Assign it an initial balance of $2,000. The account name should be your last name concatenated with the work "Savings", and the account number should be 2. The interest rate should be 5%. Print a description of this transaction (i.e. "Created savings account with $2,000 balance.")
    3. Print the checking account object's information.
    4. Print the savings account object's information
    5. Deposit $100 in the checking account and print a description of this transaction (i.e. "Deposit $100 into checking.") (this should generate a fee charged as well)
    6. Print the checking account object's information
    7. Withdraw $50 from the checking account and print a description of this transaction (i.e. "Withdraw $50 from checking.") (this should generate a fee charged as well)
    8. Print the checking account object's information
    9. Try to withdraw $6,000 from the checking account and print a description of this transaction (i.e. "Withdraw $6,000 from checking.") (This should not generate a fee but instead produce an error message that the user has Insufficient Funds. The balance should remain unchanged.)
    10. Print the savings account object's information
    11. Deposit $3,000 in the savings account and print a description of this transaction (i.e. "Deposit $3,000 into savings.")
    12. Print the savings account object's information
    13. Withdraw $200 from the savings account and print a description of this transaction (i.e. "Withdraw $200 from savings.")
    14. Print the savings account object's information
    15. Calculate the interest on the savings account and print a description of this transaction (i.e. "Calculate Interest on savings.")
    16. Print the savings account object's information
    17. Try to withdraw $10,000 from the savings account (This should produce the Insufficient Funds error message and leave the balance unchanged.) Print a description of this transaction (i.e. "Withdraw $10,000 from savings.")
    18. Print the savings account object's information

    Learn More

Items 1 to 10 of 32 total

per page
Page:
  1. 1
  2. 2
  3. 3
  4. 4

Grid  List 

Set Ascending Direction
[profiler]
Memory usage: real: 14942208, emalloc: 14571536
Code ProfilerTimeCntEmallocRealMem