Question

In: Computer Science

Write a program that prompts the user for a grade (0-100), and asks if the student...

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

  • If the student is a graduate student, the grade is reduced by 10%, because we have a higher expectation for graduate students, in an undergraduate class.
  • The program then computes, and prints the letter grade 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 receives.
    • If letter grade A or B, it will print “Excellent.”
    • If the student gets a C or D, it will print “Could improve.”
    • If letter grade is F, it prints “Need work.”

Solutions

Expert Solution

#----------------------main.py------------------------------#

grade = input("Enter the grades(0-100): ");
grade = int(grade);
while grade < 0 or grade > 100 :
grade = input("Enter valid grade: ");
grade = int(grade);
gradOption = input("The student is a graduate student or not. (Y/N):");
gradOption = gradOption.upper();
if (gradOption == "Y"):
grade = (int) (grade - grade * 0.1);
#set letter grade
letterGrade = "";
if (grade < 100 and grade >= 90) :
letterGrade = "A";
elif (grade < 90 and grade >= 80):
letterGrade = "B";
elif (grade < 80 and grade >= 70):
letterGrade = "C";
elif (grade < 70 and grade >= 60):
letterGrade = "D";
else:
letterGrade = "F";
print("Your letter grade is: ",letterGrade);
#print feedback
if letterGrade == "A" or letterGrade == "B" :
print("Excellent.");
elif letterGrade == "C" or letterGrade == "D":
print("Could Improve.");
else :
print("Need Work.");
  

   

/**********************output*******************/

Enter the grades(0-100): -45                                                                                                                                                       

Enter valid grade: 101                                                                                                                                                             

Enter valid grade: 98                                                                                                                                                              

The student is a graduate student or not. (Y/N):Y                                                                                                                                  

Excellent.

Please let me know if you have any doubt or modify the answer, Thanks :)


Related Solutions

Write a program which asks the user for grade, in integer form, from 0 to 100....
Write a program which asks the user for grade, in integer form, from 0 to 100. If the user's response is negative or greater than 100, insult them. Otherwise, use if / else statements to print out the letter grade corresponding to the user's input. 90 - 100 : A 80 - 89 : B 70 - 79 : C 60 - 69 : D 0 - 59 : F Then, write a second version of the program which uses...
Write a program which asks the user for grade, in integer form, from 0 to 100....
Write a program which asks the user for grade, in integer form, from 0 to 100. If the user's response is negative or greater than 100, insult them. Otherwise, use if / else statements to print out the letter grade corresponding to the user's input. 90 - 100 : A 80 - 89 : B 70 - 79 : C 60 - 69 : D 0 - 59 : F Then, write a second version of the program which uses...
Write a C# program using Repl.it that asks the user for a numeric grade between 0...
Write a C# program using Repl.it that asks the user for a numeric grade between 0 and 100, and displays a letter grade using the following conversion table: Numeric grade   Letter grade 90 < grade <= 100 A 80 < grade <= 90 B 70 < grade <= 80 C 60< grade <= 70 D grade <= 0.0 F Don’t forget the comments in your code. The output should be similar to: Enter the test score: 87 The letter grade...
Write a program which: Prompts the user for a positive integer >= 0 Validates the user...
Write a program which: Prompts the user for a positive integer >= 0 Validates the user input to ensure it is a positive integer >= 0 Allocate (dynamically) an array big enough for the data. Load the array with random numbers ranging in value from1 to 100 Display the elements of the array (unsorted) Display the elements of the array (sorted) Display the average Display the median Display the mode, if none, display appropriate message RESTRICTIONS No global variables No...
C++ Code Writing prompt: Grade Calculation: Write a program that asks the user to enter in...
C++ Code Writing prompt: Grade Calculation: Write a program that asks the user to enter in a number greater than or equal to zero and less than or equal to 100. If they do not you should alert them and end the program. Next, determine the letter grade associated with the number. For example, A is any grade between 90 and 100. Report the letter grade to the user.
C programming. Write a program that prompts the user to enter a 6x6 array with 0...
C programming. Write a program that prompts the user to enter a 6x6 array with 0 and 1, displays the matrix, and checks if every row and every column have the even number of 1’s.
python programming. Write a program that prompts the user to enter an integer from 0 to...
python programming. Write a program that prompts the user to enter an integer from 0 to 9. The program will check if the input is a positive integer. It displays the correct answer and shows the guess is correct or not. The demos are shown as following.(Hint:1. Use a random math function 2. Use str.isdigit() to check the input)
Java Program 1. Write a program that asks the user: “Please enter a number (0 to...
Java Program 1. Write a program that asks the user: “Please enter a number (0 to exit)”. Your program shall accept integers from the user (positive or negative), however, if the user enters 0 then your program shall terminate immediately. After the loop is terminated, return the total sum of all the previous numbers the user entered. a. What is considered to be the body of the loop? b. What is considered the control variable? c. What is considered to...
Write a program that prompts the user for an even number from 2 to 100 until...
Write a program that prompts the user for an even number from 2 to 100 until the number 90 is encountered. Not including the 90, calculate the minimum value. In case you know what this means: DO NOT USE LISTS! We will look into the use of lists later. This has to be done in the python program. Here's what I have so far: inp = 0 min = 0 while inp != 90:     inp = int(input("Please enter an even...
using c++. ALWAYS GRADE MY ANSWERS nstructions Write a program that prompts the user to input...
using c++. ALWAYS GRADE MY ANSWERS nstructions Write a program that prompts the user to input an integer and then outputs both the individual digits of the number and the sum of the digits. For example, it should output the individual digits of: 3456 as 3 4 5 6 8030 as 8 0 3 0 2345526 as 2 3 4 5 5 2 6 4000 as 4 0 0 0 -2345 as 2 3 4 5 #2 Instructions Write a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT