Question

In: Computer Science

Suppose you are writing a program to compute the semester GPA for a person based on...

Suppose you are writing a program to compute the semester GPA for a person based on knowing the grades earned and the number of credit hours for each course taken.

What type of tests would you need to create to check that your program was working correctly? Be specific, and remember to keep in mind tests that might contain unexpected input. How would your program react to those?

After you have made your post, you need to provide thoughtful comments on at least two other posts (or replies).

Your original post is due Sep 8; your replies are due Sep 11.

Solutions

Expert Solution

In order to test a program, we must know how to calculate GPA from grades and credit hours.

Following is the common grades according to Grade point achieved.

Grade Point

Grade

4.00

A+

3.67

A-

3.33

B+

3.00

B

2.67

B-

2.33

C+

2.00

C

1.00

D

0.00

F

From the grades of subjects, grade points are taken using above table

Subject

Grades

Credit Hours

GradePoint

English

A+

2

4.00

EVS

B

3

3.00

Maths

C+

4

2.33

to calculate GPA from credit hours, Credit hours is multiplied with GradePoint to get GP

Subject

Grades

Credit Hours

GradePoint

GP

English

A+

2

4.00

8.00

EVS

B

3

3.00

9.00

Maths

C+

4

2.33

9.32

Sum

9

26.32

GPA = Sum of GP/sum of credit Hours

                = 26.32/9

                =2.92

Algorithm to calulate GPA

  1. Display “Enter English Grade “
  2. Accept Enggrade
  3. Display “Enter English Credit Hours “
  4. Accept EngCR
  5. Display “Enter EVS Grade “
  6. Accept EVSgrade
  7. Display “Enter EVS Credit Hours “
  8. Accept EVSCR
  9. Display “Enter Mathematics Grade “
  10. Accept Mgrade
  11. Display “Enter Maths Credit Hours “
  12. Accept MathsCR
  13. EngGP=checkgrade(Enggrade)
  14. If EngGP == -1

Display “Invalid Input

Exit program

                End if

  1. EVSGP=checkgrade(EVSgrade)
  2. If EVSGP == -1

Display “Invalid Input

Exit program

                End if

  1. MathsGP=checkgrade(Mgrade)
  2. If MathsGP == -1

Display “Invalid Input

Exit program

                End if

  1. Eng=EngGP * EngCR
  2. EVS=EVSGP * EVSCR
  3. Maths=MathsGP *MathsCR
  4. SumCR=EngCR + EVSCr + MathsCR
  5. SumGP= Eng + EVS + Maths
  6. GPA = SumGP / SumCR
  7. End

Funtion checkgrade(grade)

If grade==”A+”

return 4.00

else if grade==”A-“

                return 3.67

else if grade==”B+”

                return 3.33

else if grade==”B”

                return 3.00

else if grade==”B-“

                return 2.67

else if grade==”C+”

                return 2.33

else if grade== “C”

                return 2.00

else if grade==”D”

                return 1.00

else if grade== “F”

                return 0.00

else

                return -1

End If

End Function

Types of testing

For GPA program

  1. Cheking of if-else structure of function checkgrade for correctness according to table.

Example : A simple value change such as 2.34 instead of 2.33 for “C+” will give wrong results

  1. Check for formulas used according to method from point 19 to 24
  2. Correctness of datatype used. In this case float should be used and not int for calculations and storing numeric values.
  3. Checking input correctness.

Some examples of unexpected inputs:

  1. Inputing grade not used in if –else.

This can be dealt using extra else and returning some exit value which is checked and program exits as shown in algorithm.

  1. Input character in credit hours- algorithm must check input entered is numeric or not and keeps on asking input till number entered
  2. Input incorrect : This is human error where credit hours or grades are wrongly entered


Related Solutions

Help with a c Program to compute the car insurance premium for a person based on...
Help with a c Program to compute the car insurance premium for a person based on their age and the number of tickets they have received. The following table explains how to perform the ticket computation: If Person's Age Is Then Insurance Cost Is Less than 21 $1500 + $250 x number of tickets From 21 through 24 $1200 + $250 x number of tickets 25 or older $1000 + $200 x number of tickets Print the person’s age, number...
Related samples t-test: Test whether semester GPA significantly changes during a semester abroad program. Use a...
Related samples t-test: Test whether semester GPA significantly changes during a semester abroad program. Use a related (dependent) samples t-test and alpha = .05 with a nondirectional test. The data are presented below. Answer the following questions. You can use SPSS, but if you do this problem “by hand” be sure to show your work.       What are the null & alternative hypotheses?       What are the degrees of freedom?       What is the critical value of t?       What...
The second assignment involves writing a Python program to compute the price of a theater ticket....
The second assignment involves writing a Python program to compute the price of a theater ticket. Your program should prompt the user for the patron's age and whether the movie is 3D. Children and seniors should receive a discounted price. There should be a surcharge for movies that are 3D. You should decide on the age cutoffs for children and seniors and the prices for the three different age groups. You should also decide on the amount of the surcharge...
Java Program Suppose a student was taking 5 different courses last semester. Write a program that...
Java Program Suppose a student was taking 5 different courses last semester. Write a program that (a) asks the student to input his/her name, student ID, marks for these 5 courses, (b) calculate the average, (c) determine the letter grade of each course. (d) record the number of courses whose final letter grade is A+, A, A-, .... , F+, F, F-. (e) Output the following information in a nice format: student name, student ID, listing of marks, the average,...
Java Program Suppose a student was taking 5 different courses last semester. Write a program that...
Java Program Suppose a student was taking 5 different courses last semester. Write a program that (a) asks the student to input his/her name, student ID, marks for these 5 courses, (b) calculate the average, (c) determine the letter grade of each course. (d) record the number of courses whose final letter grade is A+, A, A-, .... , F+, F, F-. (e) Output the following information in a nice format: student name, student ID, listing of marks, the average,...
Program a function to compute the forward kinematic matrix based on the robot’s DH parameters. You...
Program a function to compute the forward kinematic matrix based on the robot’s DH parameters. You should have the following function: A=FK(DH) DH contains all the DH parameters
The table below gives the number of parking tickets received in one semester and the GPA...
The table below gives the number of parking tickets received in one semester and the GPA for five randomly selected college students who drive to campus. Using this data, consider the equation of the regression line, yˆ=b0+b1x, for predicting the GPA of a college student who drives to campus based on the number of parking tickets they receive in one semester. Keep in mind, the correlation coefficient may or may not be statistically significant for the data given. Remember, in...
Suppose we are writing a C++ program for the sales department of a small company. The...
Suppose we are writing a C++ program for the sales department of a small company. The department has 4 sales person and is selling 5 products. The program will allow the input of each sale made (sales person, product, sales amount). The program will also allow a user to see the sales made by a particular sales person or the sales on a particular product. Requirement of the Program: 1. Using a 2-D array as a data structure for storing...
Write a Java program to compute the income after tax of an employee based on the...
Write a Java program to compute the income after tax of an employee based on the following rule of tax rate. Assuming the salary is $22000, display the tax and the income after tax. 12% if salary ≥ 25,000 5% if salary < 10,000 Otherwise 8% will be applied Write a Java program to compute and display the sum of the numbers that can be both divisible by 6 and 8 from 1 to 500. Suppose there is a list...
A. To compute a student's Grade Point Average (GPA) for a term, the student's grades for...
A. To compute a student's Grade Point Average (GPA) for a term, the student's grades for each course are weighted by the number of credits for the course. Suppose a student had these grades: 3.6 in a 5 credit Math course 2.2 in a 2 credit Music course 2.6 in a 5 credit Chemistry course 3.1 in a 4 credit Journalism course What is the student's GPA for that term? Round to two decimal places. B) For a 4-unit class...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT