Question

In: Computer Science

The program should be written in C++ with comments Write a program that takes graduation rates...

The program should be written in C++ with comments

Write a program that takes graduation rates (per 1000 of the population) for North, South, East, West and Central United States. Input the number from each of the regions in a function returning an int with the graduation rate to the main program. Also figure out which region has the highest graduation rate in another function and display the result from inside that particular function.

So your function prototypes should be something like:
int gradrate( );
void highestgrad(double n, double south, double east, double west, double central);

So you are using gradrate to read in the value of 0 to 1000 to give it to the north, south, east, west or central variables like: north = gradrate() / 1000.0;

Solutions

Expert Solution

Answer:

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

#include <iostream>
using namespace std;

int graduate()
{
int num;
cin>>num;
if(num<0||num>1000)
{
cout<<"Invalid! please enter between 0 and 1000: ";
return graduate();
}
return num;
}
void highestgrad(double north,double south,double east,double west,double central)
{
if(north>=south&&north>=east&&north>=west&&north>=central)
{

cout<<"North has highest grad with value "<<north<<endl;
}
else if(south>=north&&south>=east&&south>=west&&south>=central)
{

cout<<"south has highest grad with value "<<south<<endl;
}
else if(east>=south&&east>=north&&east>=west&&east>=central)
{

cout<<"east has highest grad with value "<<east<<endl;
}
else if(west>=south&&west>=east&&west>=north&&west>=central)
{

cout<<"west has highest grad with value "<<west<<endl;
}
else if(central>=south&&central>=east&&central>=west&&central>=north)
{

cout<<"central has highest grad with value "<<central<<endl;
}

}
int main()

{
cout<<"Enter for north from 0 to 1000: ";
double north,south,east,west,central;
north=(double)graduate()/1000.0;

cout<<"Enter for south from 0 to 1000: ";
south=(double)graduate()/1000.0;

cout<<"Enter for east from 0 to 1000: ";
east=(double)graduate()/1000.0;

cout<<"Enter for west from 0 to 1000: ";
west=(double)graduate()/1000.0;

cout<<"Enter for central from 0 to 1000: ";
central=(double)graduate()/1000.0;
highestgrad(north,south,east,west,central);
return 0;

}

output:


Related Solutions

All Code should be written in C: 1. Write a C program which prompts the user...
All Code should be written in C: 1. Write a C program which prompts the user to enter two integer values. Your program should then print out all numbers between 1 and 1000 that are divisible by both of those numbers. 2. Modify your program from question 1 such that the first 1000 numbers that are divisible by both numbers are printed out, instead of numbers up to 1000. 3. Using dynamic memory, allocate memory for an array of 100...
Program should be written in Java a) Write a program that asks the user to enter...
Program should be written in Java a) Write a program that asks the user to enter the approximate current population of India. You should have the computer output a prompt and then YOU (as the user should enter the population.)  For testing purposes you may use the value of 1,382,000,000 from August 2020. Assume that the growth rate is 1.1% per year. Predict and print the predicted population for 2021 and 2022. The printout should include the year and the estimated...
i need C++ program with possible comments what is going on,(a) Write a program that reads...
i need C++ program with possible comments what is going on,(a) Write a program that reads a char as input, and determines if it is a lowercase letter, uppercase letter, a digit or something else (call the last one a special character).
Please write a complete C coding program (NOT C++) that has the following: (including comments) -...
Please write a complete C coding program (NOT C++) that has the following: (including comments) - declares two local integers x and y - defines a global structure containing two pointers (xptr, yptr) and an integer (z) - declares a variable (mst) by the type of previous structure - requests the values of x and y from the user using only one scanf statement - sets the first pointer in the struct to point to x - sets the second...
Write a program in C that takes the length and the integers to be stored in...
Write a program in C that takes the length and the integers to be stored in an array and shifts array by N positions. Example: Input the number of elements to store in the array (max 10) : 5 Input 5 integers to be stored : Index - 0 : 12 Index - 1 : 29 Index - 2 : 68 Index - 3 : 32 Index - 4 : 97 Input number of shifts : 2 Expected Output :...
Must be written in JAVA Code Write a program that takes a whole number input from...
Must be written in JAVA Code Write a program that takes a whole number input from a user and determines whether it’s prime. If the number is not prime, display its unique prime factors. Remember that a prime number’s factors are only 1 and the prime number itself. Every number that’s not prime has a unique prime factorization. For example, consider the number 54. The prime factors of 54 are 2, 3, 3 and 3. When the values are multiplied...
1. Write a program in C++ that takes as inputs a positiveinteger n and a...
1. Write a program in C++ that takes as inputs a positive integer n and a positive double a. The function should compute the geometric sum with base a up to the powern and stores the result as a protected variable. That is, the sum is: 1 + ? + ? ^2 + ? ^3 + ? ^4 + ⋯ + ? ^?2.  Write a program in C++ that takes as input a positive integer n and computes the following productsum...
3. Write a C++ program that takes in the name of a store, and the following...
3. Write a C++ program that takes in the name of a store, and the following details for 4 employees working at the store; their first name, last name, number of hours they worked that week and how much they are paid per hour. Your program should output the name of the store, along with each employee's full name and how much they earned that week in the manner below. Monetary values should be format to 2 decimal places. Also...
Program in C Write a function that takes a string as an argument and removes the...
Program in C Write a function that takes a string as an argument and removes the spaces from the string.
PART A Write a C program that takes the names and surnames of the students and...
PART A Write a C program that takes the names and surnames of the students and then displays the initial and last name of the name on the screen. For instance, if Onur Uslu is entered as input, the output of our program must be O. Uslu. PART B Write a C program that asks the user to enter a string and then sends it to a function that does the following job and shows the response from the function...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT