Question

Name your c++ file cpp. BScore_LastNameFirstName.cpp Write a program that contains a function call Input. The...

Name your c++ file cpp. BScore_LastNameFirstName.cpp Write a program that contains a function call Input. The Input function should accept 2 decimal test scores that was entered from the user and stores them in an array. Don’t store any number less than 0. Return the array to main. Inside main, the program should pass the array and the total number of scores to countBGrade function. The countBGrade function should count how many B scores (80 to 89) were entered by the user and return the total to main.

void Input(figure this out);

int countBGrade(double array[], int size);

Once back inside main, the program should display how many scores were entered and how many B scores were entered (i.e., scores between 80 and 89).

OUTPUT:
Enter a score 0 - 100 : 87

Enter a score 0 - 100 : -80.5

User entered a number less than 0!!!

Enter a score 0 - 100 : 100
There were 2 scores entered include 1 B score(s). (Printed inside main)

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

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
_________________

#include <iostream>
#include <iomanip>

using namespace std;

// Function Declarations
void Input(double arr[],int size);
int countBGrade(double array[], int size);
int main() {
   const int SIZE=2;
   //Declaring variables
double arr[SIZE];
Input(arr,SIZE);
cout<<"There were "<<SIZE<<" scores entered include "<<countBGrade(arr,SIZE)<<" B score(s)."<<endl;

return 0;
}
void Input(double arr[],int size)
{
   double score;
   for(int i=0;i<size;)
   {
       cout<<"Enter a score 0 - 100 : ";
       cin>>score;
       if(score<0)
       {
           cout<<"User entered a number less than 0!!!"<<endl;
       }
       else if(score>100)
       {
           cout<<"User entered a number greater than 100!!!"<<endl;
       }
       else
       {
           arr[i]=score;
           i++;
       }
   }
  
}
int countBGrade(double array[], int size)
{
   int bscoreCnt=0;
   for(int i=0;i<size;i++)
   {
       if(array[i]>=80 && array[i]<=89)
       bscoreCnt++;
   }
   return bscoreCnt;
}

_______________________________

Output:

_______________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
Name your c++ file cpp. BScore_LastNameFirstName.cpp Write a program that contains a function call Input. The...
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
  • For C++ program Your program should first prompt the user for the number of students they...

    For C++ program Your program should first prompt the user for the number of students they wish to enter. For each student, the user will be prompted to enter the student’s name, how many tests the student has taken, and the grade for each test. Each test’s grade will be inputted as a number representing the grade for that test. Once each student’s information has been entered, the program will display the number of students. Additionally, each student will have...

  • Write a program named ClassifyScores that classifies a series of scores entered by the user into...

    Write a program named ClassifyScores that classifies a series of scores entered by the user into ranges (0-9, 10-19, and so forth). The scores will be numbers between 0 and 100. Design and implement a program to prompt the user to enter each score separately. If the score is within the correct range, then increment the appropriate range If the score entered is greater than 100, display an error message, ignore the incorrect score, and prompt for the user to...

  • Using basic c++ write 2 separate codes for this assignment. Program #1 Write a program that...

    Using basic c++ write 2 separate codes for this assignment. Program #1 Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions. • void getScore() should ask the user for a test score, store it in the reference parameter variable, and validate it. This function should be called by the main once for each of the five scores to be entered. •...

  • C++ programming language Write a program that asks the user for a file name. The file...

    C++ programming language Write a program that asks the user for a file name. The file contains a series of scores(integers), each written on a separate line. The program should read the contents of the file into an array and then display the following content: 1) The scores in rows of 10 scores and in sorted in descending order. 2) The lowest score in the array 3) The highest score in the array 4) The total number of scores in...

  • Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate...

    Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate the number of test scores the user enters; have scores fall into a normal distribution for grades -Display all of the generated scores - no more than 10 per line -Calculate and display the average of all scores -Find and display the number of scores above the overall average (previous output) -Find and display the letter grade that corresponds to the average above (overall...

  • In Java Main method Your main program will prompt the user for a test name and...

    In Java Main method Your main program will prompt the user for a test name and the number of scores the user will enter. After creating an arraylist to hold the scores, prompt the user for all the scores to hold in the arraylist. After all the scores are entered, then repeat back the score & letter grade. GradeBook Object Create an instance of a GradeBook object and pass the test name and arraylist to set the instance variables. At...

  • This is subject of C++ Your program should read the file answers.dat. This file contains the...

    This is subject of C++ Your program should read the file answers.dat. This file contains the name of the student who took the quiz, and his answers for each question. The answers file has the following format: The student name is always the first line. A student name may or may not have last names. For example, both Elvis Presley and Cher took this class. A quiz always has 11 questions. There is one answer per line. Each answer is...

  • Write a program that dynamically allocates an array in the freestore large enough to hold a...

    Write a program that dynamically allocates an array in the freestore large enough to hold a user defined number of test scores as doubles. Once all the scores are entered, the array should be passed to a function that finds the highest score. Another function the array should be passed to a function that finds the lowest score. Another function should be called that calculates the average score. The program should show the highest, lowest and average scores. Must use...

  • Write a program that dynamically allocates an array in the freestore large enough to hold a...

    Write a program that dynamically allocates an array in the freestore large enough to hold a user defined number of test scores as doubles. Once all the scores are entered, the array should be passed to a function that finds the highest score. Another function the array should be passed to a function that finds the lowest score. Another function should be called that calculates the average score. The program should show the highest, lowest and average scores. Must use...

  • Implement a Java program using simple console input & output and logical control structures such that...

    Implement a Java program using simple console input & output and logical control structures such that the program prompts the user to enter 5 integer scores between 0 to 100 as inputs and does the following tasks For each input score, the program determines whether the corresponding score maps to a pass or a fail. If the input score is greater than or equal to 60, then it should print “Pass”, otherwise, it should print “Fail”. After the 5 integer...

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