1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vladimir2022 [97]
3 years ago
14

Write a user-defined function that calculates the GPA. For the function name and arguments, use the following: The input argumen

t g is a vector whose elements are the numerical values of the grades. The input argument h is a vector with the corresponding credit hours. The output argument GPA is the calculated GPA. Use the function to calculate the GPA for a student with the following record
Computers and Technology
1 answer:
QveST [7]3 years ago
7 0

Answer:

#include <iostream>

#include <vector>

using namespace std;

void calGPA();

vector<int> g;

vector<int> h;

int main(){

   char pushMore = 'y';

   int fg, fh;

   for (;;){

       if (pushMore == 'n'){

           break;

       } else{

           cout<< "Enter integer for grade: ";

           cin>> fg;

           cout<< "Enter integer for credit hours: ";

           cin>> fh;

           g.push_back(fg);

           h.push_back(fh);

           cout<< "Do you want to add more grade and credit hours? y/n: ";

           cin>> pushMore;

       }

   }

   calGPA();

}

void calGPA(){

   double total = 0, GPA;

   for (int i = 0; i < g.size(); ++i) {

        total +=  g.at(i) * h.at(i) ;

   }

   cout<< "The GPA is : "<< total/g.size();

}

Explanation:

The C++ source code above defines two vectors 'g' and 'h'. The latter holds the grades of a student while the former holds the credit hours for the subject taken. The void 'calGPA' function calculates and prints the student's GPA.

You might be interested in
Why when I put a question in the search bar it says something went wrong?
xz_007 [3.2K]
It’s says the same thing to me too!
8 0
3 years ago
APCS A: I'm reviewing an old ap test and can't get past this problem:
yaroslaw [1]

Answer:

The answer is "Option A"

Explanation:

Following are the complete code to these question:

public class Arr//defining a class-Arr

{

public static void main(String[] args)//main method  

{

        int [][] numbers={{1, 2, 3},{4,5,6}}; //defining 2D array numbers

for(int[] row : numbers) //use for loop that holds all array value into 1D  array

{

for (int n: row)//defining n variable that holds row array values  

{

System.out.print (n); //print n variable value

}

}

}

}

The code comment explains its functioning.

7 0
3 years ago
Mark for review (Will be highlighted on the review page)
SpyIntel [72]
As of the presented problem, the most probable answer and the most likely one, out of the options presented together with the problem, would be C. Save As.

Of the menu commands that are there, Save As would serve to be the command that you click when you want to make a copy of a currently open file and rename it. The difference between Save As and Save would be that Save would automatically just replace the old file with the new one, considering that there were changes that took over the file. Save As, on the other hand, would make the old file still available but would prompt the user to choose another file name for it and even presents the possibility of the file being saved in another file extension.
3 0
3 years ago
Can you list the answers in order
viva [34]

whats the question?????????????????????

5 0
3 years ago
Telecommunications, outsourcing, flextime, teamwork, and diversity are workplace trends adopted to
Burka [1]

Answer:

False

Explanation:

Outsourcing and telecommuting are the trends related to presence of growing technology within the economy allowing various services to be outsourced to people who are more of an expert when it comes to handling those procedures.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Cover photos have a prominent location in your social media profiles, so you should use this space strategically – for example,
    14·1 answer
  • How should you decide what to wear to an interview? What kind of things should be considered?
    5·1 answer
  • A network engineer is configuring a network to be able to relay IPv6 packets. The network only supports IPv4 and does not have d
    11·1 answer
  • You are angry at a friend who forgot to meet you for lunch, and you decide to write an e-mail about how it made you feel. What s
    11·2 answers
  • *blank* is the unauthorized copying and selling or distributing of licensed video games.
    10·1 answer
  • What does it mean when something is the tip of this ice burg​
    5·1 answer
  • You work for a retail clothing chain whose primary outlets are in shopping malls and are conducting an analysis of your customer
    13·1 answer
  • Marissa is designing a web page that features lessons on how to build cabinets. how can she make the page most engaging for the
    7·1 answer
  • How to implement switch statement in Python?
    11·2 answers
  • How to share excel file for multiple users office 365?.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!