Question

This is a program and my solution. How many times should I test, if I need...

This is a program and my solution. How many times should I test, if I need full coverage of all possible program flows?  Why?

Write a program that prompts the user for a grade (0-100) and, whether the student is a graduate student (Y/N).

  • If the student is a graduate student, their grade is reduced by 10%, because we have a higher expectation for a graduate students in an undergraduate class.
  • The program then computes and prints the letter grade is based on the scale below.
    • 90-100 A
    • 80-89 B
    • 70-79 C
    • 60-69 D
    • 0-60 F
  • The program also provides feedback based on the letter grade the student receive.
    • If the letter grade is an A, it will print “Excellent”
    • If the letter grade is a B, it will print “Good Job”
    • If the letter grade is a C, it will print “Good Try”
    • If the letter grade is a D, it will print “ Just Passed”
    • If the letter grade is an F, it will print “Seek Help”
    • Solution:
    • yourgrade = int(input("Enter your grade:"))
    • you=input("graduate student:")

      if you=="Y":
      yourgrade=yourgrade*0.9

      if yourgrade>89:
      print("You got a A")
      print("Excellent")

      elif yourgrade>79:
      print("You got a B")
      print("Good job")

      elif yourgrade>69:
      print("You got a C" )
      print("Good try")

      elif yourgrade>59:
      print("You got a D")
      print("Just passed")

      else:
      print("You got a F")
      print("Seek help")

Homework Answers

Answer #1

Coverage: Coverage is the term used to determine which are the paths in the program that are checked in the test.

" To get the full coverage, we need to run at least 6 times for this program"

Reason:

There are 6 paths in your program. That is:

  1. if you == 'Y':
  2. yourgrade>89
  3. yourgrade>79
  4. yourgrade>69
  5. yourgrade>59
  6. else case

Hence, you need at least 6 tests, each for every path.

Example:

  1. Graduate Student = 'Y' => checks path1
  2. Yourgrade= 86 => checks path2
  3. Yourgrade= 73 => checks path3
  4. Yourgrade= 68 => checks path4
  5. Yourgrade= 52 => checks path5
  6. Yourgrade= 40 => checks path6

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program that keeps reading a test score until a -1 is entered. The program...
Write a program that keeps reading a test score until a -1 is entered. The program will output the letter grade according to the table below: Score Grade 90-100.   A 80-89.   B 70-79.   C 60-69.   D < 60.   F For example: Enter a Score (-1 to Exit): 92 The Letter grade for that score is A. Enter a Score (-1 to Exit): -1
Write a Java program to display a letter grade based on an actual grade. A =...
Write a Java program to display a letter grade based on an actual grade. A = 90-100 B = 80-89 C = 70-79 D = 60-69 F = less than 60 The program needs to do the following: 1. Create a short integer to store a grade. (See Week 3 - Things to Know - Java Data Types ) 2. Prompt for a grade ( 0-100). 3. Based on the grade given, use IF statements to display the letter grade...
C++ Write a program which accepts a numeric test score from the user. It will output...
C++ Write a program which accepts a numeric test score from the user. It will output the letter grade to the user corresponding to the score. Assume no “minus grades” (an A ranges from 90-100, B ranges from 80-89, C ranges from 70-79, D ranges from 60-69 and F is everything else.) Ensure that the score remains in the range of 0 to 100. As an example of the output: Enter your numeric grade and I will tell you your...
Write a Java program to display a letter grade based on an actual grade. USING ECLIPSE...
Write a Java program to display a letter grade based on an actual grade. USING ECLIPSE IDE A = 90-100 B = 80-89 C = 70-79 D = 60-69 F = less than 60 The program needs to do the following: 1. Create a short integer to store a grade. (See Week 3 - Things to Know - Java Data Types ) 2. Prompt for a grade ( 0-100). 3. Based on the grade given, use IF statements to display...
You are to write a program that will process students and their grades. For each student...
You are to write a program that will process students and their grades. For each student the program will read in a student’s name. It should also read in 10 test scores for the student and calculate his or her average. You must read the scores using a loop. The program should output the student’s name, average and letter grade. The average should be displayed accurate to 1 decimal digit. Letter grades are assigned based on the scale: 90-100    A...
Create a Grade application that prompts the user for the percentage earned on a test or...
Create a Grade application that prompts the user for the percentage earned on a test or other graded work and then displays the corresponding letter grade. The application should use the grading scale at your school or the following grading scale: 90 – 100 A 80 – 89 B 70 – 79 C 60 – 69 D below 60 F The application output should look similar to: Enter your marks: 90 Grade: A Notes: coded in java. Please don't make...
Java: A teacher has five students who have taken four tests. The teacher uses the following...
Java: A teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores: Test Score Letter Grade 90–100 A 80–89 B 70–79 C 60–69 D 0–59 F Write a class that uses a String array (or an ArrayList object) to hold the five students’ names, an array of five characters to hold the five students’ letter...
PART B- Javascript Using a text editor (VS Code or Notepad) and a web browser, you...
PART B- Javascript Using a text editor (VS Code or Notepad) and a web browser, you will demonstrate how to create an HTML file, externally link a JavaScript file, and write some source code in the JavaScript file. a..Create two blank files to be an HTML file and a JavaScript file. The file names should be partA.html and partA.js. b.. Create a basic HTML webpage structure. c..Link the JavaScript file to the HTML file using the <script> tag. d.. Prompt...
IN PSUEDOCODE PSUEDOCODE PSUEDOCODE PSUEDOCODE Write a program to calculate 10 students’ average test scores and...
IN PSUEDOCODE PSUEDOCODE PSUEDOCODE PSUEDOCODE Write a program to calculate 10 students’ average test scores and the grade. (You will ask the user to input all students and their grades). You may assume the following input data: Jack Johnson 85 83 77 91 76 Lisa Aniston 80 90 95 93 48 Andy Cooper 78 81 11 90 73 Ravi Gupta 92 83 30 69 87 Bonny Blair 23 45 96 38 59 Danny Clark 60 85 45 39 67 Samantha...
The Data A central tenet to being a good instructor, I believe, is to be a...
The Data A central tenet to being a good instructor, I believe, is to be a reflective practitioner of your craft. From time to time I find it to be necessary to review and reflect on my work as an instructor from a grade perspective. On our moodle page you will find a link to a second word document titled “300 Grades”. This data sheet contains both the alphanumeric grade (page 1) and the numerical equivalent (page 2) for every...