Question

You are creating a new data type for tracking student’s grades. Create a C++ project in...

You are creating a new data type for tracking student’s grades. Create a C++ project in your development tool. Add the header comment and the header files from your C++template.cpp file. Your program should do the following:

• Declare an Enum named Grade. The Enum should have the grades A-F and have each grade correspond with A = 90, B = 80, C = 70, D = 60, F = 50.

Declare a variable of Grade type in your main function. Call the variable student. Declare a char type variable to hold the user’s input.

• Prompt the user for the student’s grade (A-F) and store it in the char variable you declared. Use an if or switch statement to assign the Enum student variable the corresponding Enum value. If the user enters anything other than A-F set the student’s grade to F.

• Output the student variable to show the corresponding percentage. Here is a sample output:

What is the student’s grade? (A-F)
B
The student’s percentage is 80

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Thanks for the question.


Below is the code you will be needing Let me know if you have any doubts or if you need anything to change.


Thank You !!


===========================================================================

#include<iostream>
#include<string>

using namespace std;

enum Grade{
  
   A=90,
   B=80,
   C=70,
   D=60,
   F=50
};


int main(){
  
   Grade student;
   char user_input;
   cout<<"What is the student\'s grade? (A-F)\n";
   cin>>user_input;
  
   switch(user_input){
       case 'A':student = A;break;
       case 'B':student = B;break;
       case 'C':student = C;break;
       case 'D':student = D;break;
       case 'F':student = F;break;
       default: student = F;
  
   }
   cout<<"The student\'s percentage is "<<student;

}

1 2 #include<iostream> #include<string> 4 6 using namespace std; enum Grade { C:\Users\User Documents\html.exe What is the st

===========================================================================

let me know if you have any doubts or if you need anything to change.

If you are satisfied with the solution, please rate the answer.

Thanks !
===========================================================================

Add a comment
Know the answer?
Add Answer to:
You are creating a new data type for tracking student’s grades. Create a C++ project in...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java Description You are given the task of reading a student’s name, semester letter grades, and...

    Java Description You are given the task of reading a student’s name, semester letter grades, and semester hours attempted from one file; calculating the semester GPA; and writing the student’s name and semester GPA to another file. GPA Calculation GPA = Total Quality Points / Hours Attempted Quality Points for each class = Grade Conversion Points * Hours Attempted The letter grades with corresponding point conversions is based upon the following table: Letter Grade Conversion Points A 4 points B...

  • Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student...

    Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student gradebook using a two-dimensional array. It should allow the user to enter the number of students and the number of assignments they wish to enter grades for. This input should be used in defining the two-dimensional array for your program. For example, if I say I want to enter grades for 4 students and 5 assignments, your program should define a 4 X 5...

  • Write a C++ program that will provide a user with a grade range if they enter...

    Write a C++ program that will provide a user with a grade range if they enter a letter grade. Your program should contain one function. Your function will accept one argument of type char and will not return anything (the return type will be void), but rather print statements to the console. Your main function will contain code to prompt the user to enter a letter grade. It will pass the letter grade entered by the user to your function....

  • Create a C++ program to calculate grades as well as descriptive statistics for a set of...

    Create a C++ program to calculate grades as well as descriptive statistics for a set of test scores. The test scores can be entered via a user prompt or through an external file. For each student, you need to provide a student name (string) and a test score (float). The program will do the followings: Assign a grade (A, B, C, D, or F) based on a student’s test score. Display the grade roster as shown below: Name      Test Score    ...

  • Java Program: In this project, you will write a program called GradeCalculator that will calculate the...

    Java Program: In this project, you will write a program called GradeCalculator that will calculate the grading statistics of a desired number of students. Your program should start out by prompting the user to enter the number of students in the classroom and the number of exam scores. Your program then prompts for each student’s name and the scores for each exam. The exam scores should be entered as a sequence of numbers separated by blank space. Your program will...

  • PROGRAM DESCRIPTION: In this assignment, you will be creating a memory matching game in C++. In t...

    c++ PROGRAM DESCRIPTION: In this assignment, you will be creating a memory matching game in C++. In this game, the user will need to match up the pairs symbols A,B,C,D,E on a 4x4 array. For example, the array could be initialized like the following: In this case, X represents an empty slot. The goal is for the user to match the A to the A, the B to the B, etc, until all pairs are matched up to win the...

  • C Programming Complete the following function by writing C statements that correspond to the description in...

    C Programming Complete the following function by writing C statements that correspond to the description in each comment in the code.             #include <stdio.h> intmain() { // Declare a floating point variable to store a rectangle’s width // Declare a floating point variable to store a rectangle’s length // Declare a third floating point variable that will store the area of the rectangle. // Prompt the user to enter a width for the rectangle. // Get the user’s input, and store...

  • C++ Write a program that reads students’ names followed by their test scores from the given...

    C++ Write a program that reads students’ names followed by their test scores from the given input file. The program should output to a file, output.txt, each student’s name followed by the test scores and the relevant grade. Student data should be stored in a struct variable of type StudentType, which has four components: studentFName and studentLName of type string, testScore of type int and grade of type char. Suppose that the class has 20 students. Use an array of...

  • Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment...

    Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by...

  • Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...

    Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT