(* * Author: Manuel Garcia * This file defines the objects and operations for the gradescale. * "How do you represent lists in fmsl form?" *) object GradeScale is components: IndGrade, NumOfRows; description: (* IndGrade is a list of individual grades in a gradeScale object. NumOfRows is an int that tells me how many IndGrade objects I have. *); end GradeScale; object IndGrade is components: Mark, Hrange, Lrange, Color; description: (* A Mark is a string that holds the symbol. Hrange is an int for the highest range for the mark. Lrange is an int for the lowest range for the mark. Colorlist is an array of colors represented by a number. *); end IndGrade; object ColorList is components: Color, ColorName; description: (* ColorList is an array of colors that are represented as ints. Dark Red is 1, Red is 2, Light Red is 3, Yellow is 4, Light Orange is 5, Orange is 6, Dark Orange is 7, Light Green is 8, Green is 9, Dark Green is 10, Light Blue is 11, Blue is 12, Dark Blue is 13, Indigo is 14. ColorName is a string that holds the color name. *); end ColorList; object NumOfRows is integer; object Mark is string; object Hrange is integer; object Lrange is integer; object Color is integer; object ColorName is string; operation modifyGradeScale is description: (* Allows you to modify one row in the gradescale. *); inputs: grd: GradeScale; outputs: grd': GradeScale; precondition: (* * The Hrange must be larger than the Lrange. *); --(grd.IndGrade.Hrange > grd.IndGrade.Lrange); postcondition: (* * A GradeScale row is modified *); --(grd'); end modifyGradeScale; operation addGradeScaleRow is description: (* Adds another row to the gradescale. *); inputs: grd: GradeScale; outputs: grd': GradeScale; precondition: (* * NONE *); postcondition: (* * Another row is added by incrementing NumOfRows. *); --(grd'.NumOfRows = grd.NumOfRows+1); end addGradeScaleRow;