Concept explainers
21.6 LAB*: Program: Grade calculator
Program Specifications Write a program to calculate a course grade given points for homework, quizzes, midterm exam, and final exam. Grades are calculated differently for undergrads, grads and distance learners.
Note: this program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress.
Step 1 (2 pts). Read from input student status (str). If input is not one of "UG" (undergrad), "G" (grad), or "DL" (distance learner), print an error message and exit the program. Otherwise read from input floats for homework points, quiz points, midterm exam score, and final exam score. Calculate each category's average using maximum points for homework (800), quizzes (400), midterm exam (150), and final exam (200). Output category averages as a percentage using print(f"Homework: {homework:2.1f}%"). Submit for grading to confirm two tests pass.
Ex: If the input is:
The output is:
Homework: 75.0% Quizzes: 75.0% Midterm: 80.0% Final Exam: 92.5%Ex: If the input is:
TL 600 300 120 180The output is:
Error: student status must be UG, G or DL
Step 2 (2 pts). Set any average to 100% if average is above 100%. Submit for grading to confirm three tests pass.
Ex: If the input is:
The output is:
Homework: 87.5% Quizzes: 75.0% Midterm: 100.0% Final Exam: 100.0%
Step 3 (2 pts). Calculate the course average based on student status using the table below. Output the course average. Submit for grading to confirm five tests pass.
Category | UG | G | DL |
---|---|---|---|
Homework | 20% | 15% | 5% |
Quizzes | 20% | 5% | 5% |
Midterm | 30% | 35% | 40% |
Final Exam | 30% | 45% | 50% |
Ex: If the input is:
The output is:
Homework: 100.0% Quizzes: 100.0% Midterm: 66.7% Final Exam: 50.0% G average: 65.8%
Step 4 (4 pts). Identify the course letter grade based on the course average using the table below. Output the course letter grade. Submit for grading to confirm all tests pass.
Average | Grade |
---|---|
at least 90.0 | A |
at least 80.0 and less than 90.0 | B |
at least 70.0 and less than 80.0 | C |
at least 60.0 and less than 70.0 | D |
less than 60.0 | F |
Ex: If the input is:
The output is:
Homework: 75.0% Quizzes: 75.0% Midterm: 80.0% Final Exam: 75.0% DL average: 77.0% Course grade: CTrending nowThis is a popular solution!
Step by stepSolved in 2 steps with 3 images
- ****Microsoft Visual Studios (C++)**** Write a program that will do the following: Run continuously until the user gives a command to quit Ask the user if they want to calculate the area of a circle, square, or triangle. Based on response will ask the user for the appropriate quantities then display the area to the user.arrow_forward13) What's a Map? Homework • Unanswered Select all true statements from the below. Multiple answers: Multiple answers are accepted for this question Select one or more answers and submit. For keyboard navigation. SHOW MORE v a The idea of a map is to be able to look up one value with another. Often the lookup value is called the key and the looked-up value is called simply the value. As such, we see that any data structure essentially performs the actions required of a map.arrow_forwardCollapse Problem #2 Complete the class Problem2, the program does the following: • The program prompts the user to enter an integer. • The program continues to prompt the user for more integers as long as the sum of all values entered is between 1 and 50. • If the sum of all values entered is NOT between 1 and 50, Java the program stops taking integers, then display the value of sum. Here are two sample outputs, your output should look exactly the same as follows: Enter an integer: 23 Enter an integer: 1 I Enter an integer: -2 Enter an integer: 19 Enter an integer: -25 Enter an integer: 4 Enter an integer: 9 Enter an integer: -20 Enter an integer: -5 Enter an integer: -12 AK -8 lacBook Airarrow_forward
- # dates and times with lubridateinstall.packages("nycflights13") library(tidyverse)library(lubridate)library(nycflights13) Qustion: Create a function called date_quarter that accepts any vector of dates as its input and then returns the corresponding quarter for each date Examples: “2019-01-01” should return “Q1” “2011-05-23” should return “Q2” “1978-09-30” should return “Q3” Etc. Use the flight's data set from the nycflights13 package to test your function by creating a new column called quarter using mutate()arrow_forwardCode so far is this. // @brief Program 1 - ASCII Building// REPLACE ME AND THE LINES AROUND ME!// Adapted from prior programs developed by Professor Reed. /* Running the program looks like:Choose from among the following options:1. Exit the program2. Display buildingYour choice -> 1*/ #include <iostream> // for cin and cout#include <iomanip> // for setw() and setfill()using namespace std; // so that we don't need to preface every cin and cout with std:: void printFirstTwoBuildingSection(int n, int startSpacing){int start = n / 2, end = 0;if (n <= 2){start = 0;}for (int i = 0; i < n; i++){for (int j = 0; j < startSpacing; j++){cout << " ";}cout << "|";if (i < (n / 2)){for (int k = 0; k < i; k++){cout << " ";}cout << "\\";for (int k = 0; k < start; k++){cout << " ";}cout << "/";start -= (n / 2);for (int k = 0; k < i; k++){cout << " ";}cout << "|" << endl;}else{for (int k = n - i - 1; k > 0;…arrow_forwardmputer Science Principles (A&B) 3 g Code with Ons Active Use the following code block to complete the statement below. def practice(numA, numB): return numA*numB answer practice(5, 3) print(answer) Activity In the code shown above, numA is a(n) Mark this and return 2 3 # C W e 44 parameter return value argument np Save and Exit Next % ^ & * 5 6 7 8 9 0 tarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education