Need help: Grade program - Constants and Functions
Hey there,
So I have this problem. I've been working tirelessly with VisualBasic 2010 on an assignment for my CS 105 class. The assignment seemed pretty straightforward: Make a program with checkboxes that calculates our grades on certain assignments. I thought I had it down, but here's the catch:
We MUST use global constants to store the weighted grade value of assignments. And -
We MUST use a function to calculate and display the total grade using the user's entered score on their assignment (out of 100 points).
I worked forever on this trying different things, and eventually one warning I received locked me out of design view. I deleted all possible signs of the error, but it persisted. It's looking as if I may need to start from scratch, and I'm running out of time quickly.
So more to the point: Could anyone help me develop a function that takes these global constants:
'Declare Global variables
Const lab2Grade As Decimal = 0.05
Const lab3Grade As Decimal = 0.1
Const lab4Grade As Decimal = 0.1
Const lab5Grade As Decimal = 0.1
Const exam1Grade As Decimal = 0.2
Const exam2Grade As Decimal = 0.3
Const finalProjGrade As Decimal = 0.15
And using the user input through text boxes on each assignment where scores are entered out of 100, convert it into an average score that I can convert to a percent and display (Done through a button-click event)? I had it working without functions, but as functions are part of the assignment I'm forced to use them to get a decent grade, and I'm very new to them. If anyone could help, that would be fantastic. :)
Thanks for reading!
Re: Need help: Grade program - Constants and Functions
Are you sure that's what you're supposed to do because it's extremely poor practice. A function should be self contained. All values necessary for the completion of the function should either be contained within the function or passed in the function call. A Sub can use global constants. A function never should.
Re: Need help: Grade program - Constants and Functions
"Edit: Might have misread what she put, granted instructions aren't clear".
I'm certainly no expert on coding, but I've seen some completely weird things from this professor, such as giving us an example program that doesn't even work correctly.
I might be able to declare these constants within the function, granted I'm unclear exactly on how to do it, but hopefully I can figure it out. I might lose points on her grading scale for not declaring them as global like she insisted, but if this is considered poor practice I suppose I'd only be in the right for doing so.
Re: Need help: Grade program - Constants and Functions
Same exact project im working on right now. You must be in my class? lol
Head over to the post that says "Working with Percentages" to get some help im woking on it right now
http://www.vbforums.com/showthread.p...th-percentages
Re: Need help: Grade program - Constants and Functions
Wow, it appears we definitely are in the same class. Thanks so much for letting me know, I'll look over it and see if it helps me. I'm kinda in a crisis with my entire program breaking on the night before the due date, LOL.
Re: Need help: Grade program - Constants and Functions
same thing happened to me last week, I thought for sure I knew exactly what I was doing and NOPE so i had to get help. No worries
Re: Need help: Grade program - Constants and Functions
Has the post helped? Im currently on the write to file and read to file part and having a little trouble there now lol