04-12-2015 07:44 PM
Hi everoyne, I need to make a simple program calculating the GPA in 5 classes. Where A,B,C,D,F are the inputs for each one..
Here's what I did so far.
But it seems that it's not recognizing when I assign numeric values for each letter. So I'd appreciate any help. I tested for the output of "GP" and input CT=A (4). The answer for GP should be 4x3=12. But I get a number way off that.
I'm fairly new to Labview so sorry if it's a dumb question.
-Daniel
Solved! Go to Solution.
04-12-2015 07:50 PM
Attach an actual VI with values saved in the controls by default.
I don't see how you are taking a string character and mulitplying it by a number to get a grade point value. It doesn't make sense.
04-12-2015 07:55 PM
Here's the whole problem:
Create a program that calculates the GPA of a semester with 5 classes.
Control theory (3 credits)
Digital Signal Processing (3 credits)
Linear Systems (3 creits)
Directed Independent Study (2 credits)
Control System Lab (1 credit)
The input is either A,B,C,D, or F and the GPA is a number from 0 to 4.
I attached the program that I made.
04-12-2015 08:17 PM
You've got numerous problems.
1. Why are you using the Mathscript node? I thought you were supposed to be doing this in LabVIEW. A Mathscript node is not real LabVIEW programming.
2. Why is your result output an array? Result is computed as a scalar within the program.
3. How do you expect to go from a letter grade such as A into a numerical grade? Your A=4 certainly doesn't do it which just assigns the value 4 to a variable called A.
4. Your actual code takes a string which might have the character "A" within it. When you multiply that by 3, you certainly are going to get any kind of value.
If you were trying to write this code in a text language such as BASIC, it would fail just as badly.
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
04-13-2015 09:10 AM - edited 04-13-2015 09:11 AM
I would make an array of clusters. Each item in the array corresponds to a single course. Inside of the cluster, I would have a string for the course name, an enum for the grade, and a numeric for the number of credit hours. Use an enum for the grade so you can make sure the user only puts in the values you want to allow plus the enum is actually a number. No real conversion needed. Then you just use a FOR loop (autoindexing) with some shift registers to keep your totals and then divide the grade totals by the credit hours.
04-13-2015 06:57 PM
Thank, I didn't know that about "Enum" function, now it's working. Again thanks a lot.
-Daniel