Question

In: Computer Science

Visual Basics In this exercise, you modify the History Grade application from this chapter’s Focus lesson....

Visual Basics

In this exercise, you modify the History Grade application from this chapter’s Focus lesson. Use Windows to make a copy of the History Solution folder. Rename the copy History Solution-Functions. Open the History Solution.sln file contained in the History Solution-Functions folder. Modify the btnDisplay_Click procedure so that it uses two functions named GetGrade101 and GetGrade201 to get the appropriate grade; the procedure should then display the grade in the lblGrade control. Change the two independent Sub procedures to functions that return the appropriate grade to the statements that invoke them in the btnDisplay_Click procedure. Each function should contain a parameter that accepts the total points passed to it. Save the solution and then start and test the application.

Option Explicit On
Option Strict On
Option Infer Off

Public Class frmMain
    ' Independent Sub procedures.


    Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click
        ' Calls independent Sub procedures to display a grade.


    End Sub

    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Private Sub txtPoints_Enter(sender As Object, e As EventArgs) Handles txtPoints.Enter
        txtPoints.SelectAll()
    End Sub

    Private Sub ClearGrade(sender As Object, e As EventArgs) Handles txtPoints.TextChanged, radHis101.CheckedChanged, radHis201.CheckedChanged
        lblGrade.Text = String.Empty
    End Sub

    Private Sub txtPoints_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPoints.KeyPress
        ' Accept only numbers and the Backspace key

        If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar <> ControlChars.Back Then
            e.Handled = True
        End If
    End Sub

Solutions

Expert Solution

Hi,

Please follow the below code snippest which you need to add in your project and need to call the respected new functions based on the condition:


Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click
        ' Calls independent Sub procedures to display a grade.


        ''Here I assumed that you will call the newly created function based on the radio button below
        '' you need to use appropriate condition here which will decide when to call the below functions
        If radHis101.Checked Then

            lblGrade.Text = GetGrade101(intPoints)

        Else
            lblGrade.Text = GetGrade201(intPoints)

        End If

    End Sub

 ' Independent Sub procedures.
    Private Function GetGrade101(ByVal intPoints As Integer) As String

        Select Case intPoints
            Case Is >= "90"
                Grade = "A"
            Case Is >= "80"
                Grade = "B"
            Case Else
                Grade = "F"

        End Select
        Return Grade
    End Function
    Private Function GetGrade201(ByVal intPoints As Integer) As String
        Select Case intPoints
            Case Is >= "75"
                Grade = "P"
            Case Else
                Grade = "F"

        End Select
        Return intPoints
    End Function

Thanks.


Related Solutions

In this exercise, you will complete the Restaurant Tip application from Chapter 2’s Focus on the...
In this exercise, you will complete the Restaurant Tip application from Chapter 2’s Focus on the Concepts lesson. The application’s Planning Chart is shown in Figure 3-34. Use either a flowchart or pseudocode to plan the btnCalc_Click procedure, which should calculate and display a server’s tip. Open the Tip Solution.sln file contained in the VB2017\Chap03\Tip Solution folder. Enter the three Option statements in the Code Editor window. Use the comments as a guide when coding the btnCalc_Click procedure. Be sure...
Must be written in C++ in Visual studios community In this lab, you will modify the...
Must be written in C++ in Visual studios community In this lab, you will modify the Student class you created in a previous lab. You will modify one new data member which will be a static integer data member. Call that data member count. You also add a static method to the Student class that will display the value of count with a message indicating what the value represents, meaning I do not want to just see a value printed...
You are teaching sixth grade​ students, and you are preparing a lesson about reading informational text....
You are teaching sixth grade​ students, and you are preparing a lesson about reading informational text. Personalize the guidelines for helping students understand and remember. Tell what you will do beginning with your plan for gaining their attention. Continue with your plan for maintaining their​ attention, helping them connect new and previously​ learning, and focus on meaning
Visual Basics 2015 The local smoothie store, Smoothie Queen has hired you to develop a program...
Visual Basics 2015 The local smoothie store, Smoothie Queen has hired you to develop a program that will make it easier for their sales associates to compute a customer's bill. You are to write a program that will allow the cashier to enter in customer information, smoothie information and display the total amount due. Here are the pertinent details: CALCULATIONS: 1. COST OF A SMOOTHIE: The actual cost of the smoothie is based on the smoothie size and the smoothie...
Hello, Modify the grade book program from Assessment 3 to use a custom struct to hold...
Hello, Modify the grade book program from Assessment 3 to use a custom struct to hold the student's ID number and the percentage score for each item in the grade book. The program should accept the entry of ID numbers and percentage grades (0–100) until the user signals that he or she is done entering grades. The program should then print out the ID numbers and grades entered by the user, sorted by ID number. Again, be sure to format...
Make a Console application Language should be Visual Basic In this assignment, you will be calculating...
Make a Console application Language should be Visual Basic In this assignment, you will be calculating the two parts for each month. you calculate the interest to pay each month and principal you pay every month. The interest you pay every month = loan * monthlyInterest The principal you pay every month = monthlyMortgage -  interest you pay every month ' what is my remaining loan loan = loan - principal you pay every month Problem 1 : Using While Loop,...
Im just having some trouble using functions in visual basics. Could you please explain what Im...
Im just having some trouble using functions in visual basics. Could you please explain what Im doing wrong? I think it has to do with the calling of the function. Public Class Form1     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click         Me.Close()     End Sub     Private Function Rsumation(ByVal intx As Integer) As Double         intx = CInt(Txtinput.Text)         If intx = 1 Then             Return 1         Else Return (intx + Rsumation(intx - 1))        ...
Make a Console application Language should be Visual Basic You will be simulating an ATM machine...
Make a Console application Language should be Visual Basic You will be simulating an ATM machine as much as possible Pretend you have an initial deposit of 1000.00. You will Prompt the user with a Main menu: Enter 1 to deposit Enter 2 to Withdraw Enter 3 to Print Balance Enter 4 to quit When the user enters 1 in the main menu, your program will prompt the user to enter the deposit amount. If the user enter more than...
Instructions Modify the Product class from the Practice Exercise 7 by adding a quantity member. Include...
Instructions Modify the Product class from the Practice Exercise 7 by adding a quantity member. Include a getter and setter, using decorators, and modify the appropriate constructor to also accept a quantity parameter. Then modify the inventory.py file from the practice exercise to include quantity values in the constructor calls with a quantity of 100 for product1 (hammers) and 3000 for product2 (nails). Add print statements to display the quantity values as shown in the Expected Output included below. Submission...
C# Programming language!!! Using visual studios if possible!! PrimeHealth Suite You will create an application that...
C# Programming language!!! Using visual studios if possible!! PrimeHealth Suite You will create an application that serves as a healthcare billing management system. This application is a multiform project (Chapter 9) with three buttons. The "All Accounts" button allows the user to see all the account information for each patient which is stored in an array of class type objects (Chapter 9, section 9.4).The "Charge Service" button calls the Debit method which charges the selected service to the patient's account...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT