03-11-2023 03:22 PM
Can anyone help me with this problem? I am very close but I cannot figure out what I need to make my VI function correctly. I am sure it is something simple that I am not seeing. Attached is my current VI.
Design a VI that produces an array of clusters containing the course average, letter grade, and class rank for each student in a class, given three arrays with the examination scores as input. There is one array of scores for each examination. The course average is determined as follows: 30% from the first exam, 30% from the second exam, and 40% from the final exam. The letter grade is determined from the course average by the criteria listed in Table D6.2.
TABLE D6.2 Course Average Criteria
Course Average |
Letter Grade |
0% - 59% |
F |
60% - 69% |
D |
70% - 79% |
C |
80% - 89% |
B |
90% - 100% |
A |
Rank the students so that the student with the highest grade has a rank of 1 and the student with the lowest grade in the class has a rank equal to the number of students in the class. You may wish to use the Sort ID Array and Search ID Array functions within a loop to establish the student ranks.
Bundle all of the information (course average, letter grade, and class rank) into an array of clusters where each cluster contains all the data for one individual student. Display this array of clusters on the front panel.
Test the VI with different inputs to verify its functionality. Since the array of clusters will become very large for a class with more than a few students, space can be conserved on the front panel by showing only one element of the output array at a time and then using the index display to scroll through the different elements of the cluster array.
Solved! Go to Solution.
03-11-2023 05:39 PM - edited 03-11-2023 06:23 PM
First of all, your averages are floating point numbers, so you have gaps (e.g. if the score is 69.5, you have no case. Do you round down? To nearest? Case structures expect integers (notice the red coercion dot?). Typically is is easier to threshold into an array of levels and then index into an array of letter grades.
If attaching a VI, you should make sure that the controls have reasonable default values, so we don't need to guess. Empty arrays are not reasonable.
You probably want to autoindex at the output tunnel of the seconds FOR loop. Currently, you only get the last cluster and turning it into an array of one element seems pointless right?.
You should NOT wire N of the first FOR loop. It should run for the size of the array and will known when to stop. If you wire N, it will not process more than five elements.
You also need to deal with the possibility that two students have the exact same average. They would need to get the same rank, skipping some ranks later. (e.g. [alpha, Rank 1, 89%], [beta, Rank 1 98%], [gamma, Rank 3, 88%])
03-13-2023 06:16 AM
@altenbach wrote:
First of all, your averages are floating point numbers, so you have gaps (e.g. if the score is 69.5, you have no case. Do you round down? To nearest? Case structures expect integers (notice the red coercion dot?). Typically is is easier to threshold into an array of levels and then index into an array of letter grades.
This sounds very familiar...
Didn't we go over this (exactly) a year ago? And two years ago... And 3...
Solved: Array into a case statement - NI Community
Solved: Beginner help with arrays. - NI Community
Solved: Cluster - NI Community
Solved: case structures and arrays - NI Community
convert number to letter for grade - NI Community
Basic covert grade percent to letter grade? - NI Community
03-13-2023 09:47 AM
I guess that course does not update the curriculum for years. 😄 It's a pretty good learning example though.
03-13-2023 11:16 AM
Makes me wonder what the course average grade is by now?
-AK2DM
03-13-2023 11:33 AM
You'd like to think it had gone up with how many solved examples there are.
03-13-2023 07:05 PM
@LVIEWPQ wrote:
You'd like to think it had gone up with how many solved examples there are.
I am sure the teacher knows all these examples and will recognize if students just plagiarize the examples without creative input. 😄
03-14-2023 03:49 AM
@altenbach wrote:
@LVIEWPQ wrote:
You'd like to think it had gone up with how many solved examples there are.
I am sure the teacher knows all these examples and will recognize if students just plagiarize the examples without creative input. 😄
Or they teach how to search the forum in the last lesson.
07-04-2023 11:08 AM
Hello,
Can some point out where the issue is for the student to finish up where they left off. With this design, the student needs straight solution, so it will great point out what is needed to be add and where. I guess it will help other who are trying to solve similar problem from the LabVIEW textbook.
Thank you all for your great work.
07-06-2023 02:00 AM
@niibi wrote:
Hello,
Can some point out where the issue is for the student to finish up where they left off. With this design, the student needs straight solution, so it will great point out what is needed to be add and where. I guess it will help other who are trying to solve similar problem from the LabVIEW textbook.
Thank you all for your great work.
If you scroll back up a couple of posts, there are 6 solutions linked.