VB project 2 ( Object-Oriented Paradigm) Introduction In this assignment, you wi
ID: 3680467 • Letter: V
Question
VB project 2 (Object-Oriented Paradigm)
Introduction
In this assignment, you will be writing a GradeCalculator class in Visual Basic attached to a GUI. The calculator will calculate the score needed on the final exam to obtain an A, B, C, or D in the course based on all grades earned before taking the final exam.
Assignment
This assignment will be completed in two phases. First, you must write a GradeCalculator class. After that, the GradeCalculator class will be wrapped in a graphical user interface (GUI) implemented through a Windows Form.
When writing the class, include private data members for all of the project scores, the midterm exam, and the attendance & participation portion of your grade. These data members should be accessed through appropriately named Properties that validate input and assign values appropriately. Assume that all project scores and the midterm exam must be between 0 and 150 inclusively. If a value outside of this range is given to the Property, assign a value of zero to the appropriate data member (assume extra credit is impossible). Assume the Property that handles attendance and participation accepts the number of classes missed when being “Set”, but return the number of points earned towards attendance and participation when used in a “Get”. You will need to design a series of “Getter” Properties (ReadOnly), that can be used to cause the class to return the number of points and percentage score needed on the final exam for each grade. Plan the basic design of the GUI beforehand (refer to the provided examples) and determine what kind of Properties will be required to make the class interact with the GUI. Plan your design accordingly. Additionally, include an internal ConsoleDisplay() method that displays a summary on the screen similar to the output produced in Project #1. This method should be used to test the GradeCalculator before GUI integration begins.
After you are happy with your class, design a GUI that provides the user an interface to the GradeCalculator class. If you are not sure where to start, use the provided examples as a model. You may deviate from the provided screen shots if you would like, but make sure at least all of the essential components of the example output are part of your GUI as well. Make appropriate use of labels, groups, text boxes, and buttons to make your interface as intuitive as possible. Your GUI should perform no data validation or handle any program logic. It should simply instantiate an instance of the GradeCalculator class and pass it information from the form elements. You may assume the user will appropriately formatted numeric values into the form (no exception handling needed), but you may not assume anything about the range of values that user may provide. Please use the appropriate format specifiers to make your output model the screen shots as closely as possible.
When completing this program, adhere to all established design tenets for object-oriented programming.
Hints
You will need to make use of String.Format() utility to cause you data to display on the Form with the appropriate numerical formatting.
screen shots:
Explanation / Answer
Hi below i have written a simple example code to work with it for your reference,
Property(Controls Used) :
Attaching Code to the Object :
Private Sub cmd_cal_Click()
Dim sum As Integer
Dim per As Single
Dim fail As Boolean
fail = False
For i = 0 To 3
sum = sum + Val(txt_test(i).Text)
If Val(txt_test(i).Text) < 35 Then fail = True
Next
txt_test(4) = sum
sum = 0
For i = 0 To 4
If Val(txt_prj(i).Text) < 35 Then fail = True
Next
txt_prj(5) = sum
sum = Val(txt_test(4)) + Val(txt_prj(5))
per = (sum) / 900 * 100
txt_total = sum
txt_per = per
If fail = True Then
txt_grade = "F"
Else
Select Case (per)
Case Is >= 70:
txt_grade = "A"
Case Is >= 60:
txt_grade = "B"
Case Is >= 50:
txt_grade = "C"
Case Else
txt_grade = "D"
End If
End Sub
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.