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 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.
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...
JAVA Project: Student Major and status Problem Description: Write a program that prompts the user to...
JAVA Project: Student Major and status Problem Description: Write a program that prompts the user to enter two characters and displays the major and status represented in the characters. The first character indicates the major and the second is a number character 1, 2, 3 or 4, which indicates whether a student is a freshman, a sophomore, junior or senior. Suppose the following characters are used to denote the majors: M: Mathematics C: Computer Science I: Information Technology Here is...
Write a program that generates a random number between 1 and 100 and asks the user...
Write a program that generates a random number between 1 and 100 and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “Too high, try again.” If the user’s guess is lower than the random number, the program should display “Too low, try again.” The program should use a loop that repeats until the user correctly guesses the random number. Your program should also keep a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT