Write a user-defined function that calculates the GPA. For the function name and arguments, use the following: The input argument 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

Answers

Answer 1

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.


Related Questions

how do i create a business process flow chart?

Answers

Answer:

Determine the main components of the process. ...

Order the activities. ...

Choose the correct symbols for each activity. ...

Make the connection between the activities. ...

Indicate the beginning and end of the process. ...

Review your business process diagram.

Explanation:

You are designing an internet router that will need to save it's settings between reboots. Which type of memory should be used to save these settings?
a. Disk
b. Does not matter
c. SRAM
d. Flash
e. DRAM

Answers

Answer:

d. Flash

Explanation:

A flash memory can be defined as an electronic non-volatile memory chip (storage medium) that is typically used on computer systems and other digital devices such as routers, USB flash drives, switches, digital cameras, mp3 players etc. A flash memory is an electronically erasable programmable read only memory (EEPROM) and as such data saved (written) on it can be erased electronically. Also, a flash memory do not require a source of power (electricity) to save or retain data through the use of a floating gate MOSFET (FGMOS) or floating gate transistor.

In this scenario, you are designing an internet router that will need to save it's settings between reboots. The type of memory that should be used to save these settings is a flash memory because it does not require power to write or save data.

assembly language uses _____ coder for programming.

Answers

Answer:

Assembly language uses alphabetic codes in place of binary numbers used in machine language. assembly language code is converted into executable machine code by a utility program referred as assembler.

Question # 6
Dropdown
Choose the line of code that completes this program.

Output:

dog named Tiger

class pet:
def __init__(self,strSpecies,strName):
self.species = strSpecies
self.petName = strName

def __str__(self):
return self.species + " named " + self.petName

def changeName(self, newName):
self.petName = newName

# main program
myPetA = pet('dog', 'Spot')


print(myPetA)

Answers

Answer:

myPetA.changeName('Tiger') should be it

Explanation:

Answer:

myPetA.changeName('Tiger')

Explanation:

Correct answer edge 2020

select the correct answer​

Answers

Could you possibly get a clearer picture, and also the options for the answer?

PLZ PLZ PLZ PLZ HELP I ONLY HAVE 5 MINUTES IT SAYS THE SUBJECT IS COMPUTERS AND TECHNOLOGY BUT ITS ACTUALLY MEDIA LIT

Answers

Answer:

B

Explanation:

I think that is the right answer

What character, when used at the beginning of the constructor name in a class, makes the class variables have a scope limited to the function?

* (an asterisk)

# (a pound sign)

$ (a dollar sign)

_ (an underscore)

Answers

Answer:

_ (an underscore)

Explanation:

The underscore character.

__init_ and __str__ have double underscore characters at the beginning and end of the function name.

Correct answer edge 2020

Answer:

The answer to your question is _ (an underscore).

I hope this helps you out and I hope that you have a wonderful day.<3<3<3

Explanation:

Whose guidelines should you follow for the destruction of storage media such as thumb drives, Zip drives, and computers?

Answers

Answer:

Depends how bad you want to hide something. If the drive has previously been encrypted and the password hashed (like AES-256 with SHA-512 hashing), then deleting the content is enough since it will be slightly overridden and thus unusable. If it is not encrypted already, delete it, and override all your disk space with something. If you want it to die as a secrete 100%, burn it and pulverize it. Otherwise, if you want a quick method, use some real delete software.

Which steps can you take to remove all the data you've just typed from a cell?
Click the cell, then press Delete.
Click Undo on the Quick Access Toolbar.
Click Cut on the Clipboard group.
Press Ctrl+Z.
Press Ctrl+Shift.

Answers

Explanation:

Ctrl+Z

Click and press Delete

Click Undo

What is included in a linked list node?

I a reference to the next node
II an array reference
III a data element

Answers

Answer: I a reference to the next node

III a data element

Explanation:

A linked list is simply referred to as a linear data structure, whereby the elements would not be stored at memory locations that are together in the sequence.

In simple words, we can simply say that a linked list is made up of nodes in which, every node has a data element and also a link or reference to the next node that is in the list.

Therefore, based on the explanation above, the correct option will be:

I. a reference to the next node

III a data element

list down four ways to start word 2010​

Answers

1Locate the Word icon on the Start button's All Programs menu. Don't click to start Word now!
2Right-click the Microsoft Word 2010 menu item. A pop-up menu appears.
3Choose Send To→Desktop (Create Shortcut).
4Press the Esc key to hide the Start button menu and view the desktop.

Hoda wants to create a new presentation in PowerPoint with existing graphics and designs. What is the easiest and fastest way for her to do this? Use an existing template. Design a new theme for the presentation. Create a custom template for the presentation. Search for a design template online.

Answers

Answer:

The answer is A

Explanation:

Edge 2020

A graph shows the relationship between two or more variables that?
a. can be represented by any of these
b. are represented by circles
c. are represented by dots
d. are represented by bars
Please Answer I really would like to know!!!

Answers

Answer:

A. can be represented by any of these

Explanation:

Which of these is an example of collective voice?
A. He hopes to make the world better for his children.
B. I have always dreamed of a kinder and better world.
C. We are here to make a better world for our children.
D. Your purpose is to make the world a better place.

Answers

Answer:

option C

hope it helps! please mark me brainliest..

Merry Christmas good day

Answer:

c

Explanation:

Database are pranized in
consist of a series of
which consist of a senes of​

Answers

Answer:

fields and records I guess is the answer

Cyberbullying can negatively impact a victim’s
well-being.

Answers

Answer:

whats the questions

Explanation:

Answer:

Physical

Explanation:

took the test

The User Datagram Protocol (UDP) is called the connectionless protocol because: It does not attempt to fix bad packets but resends lost packets. It attempts to fix bad packets but does not resend lost packets. It does not attempt to fix bad packets or resend lost packets. It fixes bad packets and resends lost packets.

Answers

Answer:

The User Datagram Protocol (UDP) is called the connectionless protocol because:

It does not attempt to fix bad packets or resend lost packets.

Explanation:

Ports are openings or entrance doors through which data packages have access to a PC or server.  TCP and UDP are transport protocols with port numbers.  TCP means Transmission Control Protocol.  They are used to connect two devices over the internet and other networks.  UDP means User Datagram Protocol.  They are used to connect applications and to speed the transfer of data.  Comparatively, UDP is faster, simpler, and more efficient than TCP.  TCP enables retransmission of lost data packets, which UDP cannot do.

Which sentence indicates that Jeff is mentioning the visual synopsis in his proposal while planning a media project?

In the proposal, Jeff states the reason to create the project. He also explains how his project will conclude with a perfect takeaway point. Jeff describes how he is going to tell the story through photography. He then mentions various strategies to engage his audience and describes plans to make sure that the project reaches his intended audience.

Answers

Answer:

I believe its the last question

Explanation:

Answer:

I would say describes plans to make sure that the project reaches his intended audience

Explanation:

none needed

Design an algorithm that takes in a stream z1, . . . , zM of M integers in [n] and at any time t can output a uniformly random element in z1, . . . , zt . Your algorithm may use at most polynomial in log n and log M space. Prove the correctness and analyze the space complexity of your algorithm. Y

Answers

Answer:

import random

def rand_select(*args):

   selected = random.choice(args)

   print( selected)

rand_select(12,32,43,54,2,34,65,2,64,74,97)

The space complexity of this program is O(1)

Explanation:

The list of arguments to the function is assigned to the variable "args" and the random's choice method randomly picks an item and assigns it to the variable "selected", then the variable is printed out on the screen. The memory used is 1 + 1 = 2, which is a constant, therefore making the space complexity to be O(1).

Write a Java program that launches 1000 threads. Each thread adds 1 to a variable sum that initially is 0. You need to pass sum by reference to each thread. In order to pass it by reference, define an Integer wrapper object to hold sum. Run the program with and without synchronization to see its effect.

Answers

Java is a 3D mental breakdown in the sim game and he has to play the game and play it with the same thing he has been doing wrong and he is a queen and he is

While gaming online, Julian receives several insulting comments from another player. This is an example of
O denigration
O cyberstalking
harassment
O outing

Answers

Answer:

cyberstalking harassment

Explanation:

since Julian is being harrased or bullied online by someone

A document template is a___

preformatted structure for a document
read-only document
type of reference for a document
passcode assigned to access a hidden document

Answers

The remember good thing about you you know that I don’t know but I love the internet to you see you I don’t know how you are to document your

8.3.9 Text to Binary Python

Answers

Using the knowledge in computational language in python it is possible to write a code that write the binary code

Writting the code:

#function that will convert the text to binary

def text_to_binary(text):

   #variable to store the converted binary value

   binary_text = ""

   #iterate for each character in the text

   for i in text:

       #get the ASCII value of that character

       ascii = ord(i)

       #call the function to get the value of the

       #current ascii number and append it to the

       #binary_text

       binary_text += decimal_to_binary(ascii)

   #return the final converted binary value

   return binary_text

def decimal_to_binary(decimal_value):

   binary_base = 2

   num_bits_desired = 8

   binary_value = str(bin(decimal_value))[2:]

   while len(binary_value) < num_bits_desired:

       binary_value = "0" + binary_value

   return binary_value

text = input("Input the string you would like to encode: ")

binary = text_to_binary(text)

print(binary)

See more about python at brainly.com/question/18502436

#SPJ1

the acronym PC stands of​

Answers

Answer:

personal computer

Explanation:

It stands for personal computer

The Internet began when a large company wanted to sell products online.

True
or
False

Answers

Answer:

True

Explanation:

Answer:

It would be true

Explanation:

africans are unique people they are rich culture and a glorious history​

Answers

Explanation:

In Africa art including crafts and culture, mythology and faith, clothes, lifestyle, music and tongues, African pixel is influenced. In Africa, social identities are plentiful, with vast quantities of multiculturalism being discovered not only through various continents, as well as within individual nations.

To specify your preferred colors, fonts, and effects for a document, which of the following should be done?

1.Create custom theme fonts

2.Create custom theme

3.Create a custom paragraph style

4.Create a custom character style

Answers

Answer: crest custom theme

Explanation:

Answer:

crest custom theme

Explanation:

A Boolean expression is one that is either: Group of answer choices x or y None of the answers are correct Positive or negative True or False

Answers

Answer:

True or False

Explanation:

Boolean logic refers to a theory of mathematics developed by the prominent British mathematician, called George Boole. In Boolean logic, all variables are either true or false and are denoted by the number "1" or "0" respectively; True = 1 or False = 0.

Additionally, Boolean logic allow users to combine keywords with Boolean operators (quotes, AND, OR, near/n) to give a more personalized and relevant search results.

Hence, a Boolean expression is one that is either True or False and it is also known as logical expression.

How is opera diffrerent from blues,gospel,and country music?

Answers

Answer: Opera has its roots in Europe; the other styles are American

Explanation:

a clearly stated objective that how program should work and how it respond to a error is called??

Answers

Answer:

A Problem statement

Explanation:

I hope this is right

Other Questions
which one is correct ? ques this songOver ice, I'm freezingBeautiful eyes, deceivingWe may die this eveningCoughing, wheezing, bleedingHigh, I'm an anxious soulBlood moons are my eyes, stay low PLEASE HELPP A cells chromosome contains: A. Genes B. chlorophyll C. sperm D. Eggs What was Lowell's solution to a shortage ofworkers? Shannons rectangular countertop is 3 feet wide. It is 3 times as long as it is wide. Find the length and area of Shannons countertop. The length of Shannons countertop is ? feet.The area of Shannons countertop is ? square feet. I am struggling with transformations,rotation on a cartesian plane,how do we do it? I need help with this question please Plz help me !!!!!!!!!!!!!!!!!!!! 1.Explain energy flow from producer to consumer.2.Explain energy flow from consumer to consumer.((Your explanation should include the role of decomposers.)) which of the following is an example of absolute chronology What is the measure of angle A? HELP QUICK I WILL GIVE BRAINLIEST ANSWER! Each day, the cafeteria staff at Brookview Middle School orders 80 pints of white milk and 30 pints of chocolate milk. Which ratio is equivalent to the ratio of white milk to chocolate milk? Which of the following provides the BEST analysis of the article's two concluding paragraphs?AThe concluding paragraphs emphasize the power of the connotations carried by the Statue of Liberty and their relationship to national opinion and policy.BThe concluding paragraphs reiterate the problems with federal policies and the solution of viewing the Statue of Liberty as a myth about immigration.CThe concluding paragraphs refine the concept of the Statue of Liberty as being associated with French Enlightenment and provide the chronology.DThe concluding paragraphs elaborate on the effects of immigration on the myth of the Statue of Liberty and how the federal census shaped immigration. Why do humans , bees , and flowers need glucose and not rocks ? what is the mass of a vehicle that has 50,000 N and 25M/S/S parallel processing in speech perception with local and global representations of linguistic context therapeutic services pays less than most other careerstruefalseneed this awnsered ASAP i really need help with this please!! i need it by 12:00 tonight WILL GIVE BRAINLYST. Find the median, quartiles, and interquartile range of the data:3, 2, 2, 4, 4, 3, 6, 3, 5, 3, 4, 1 I can round to the nearest hundred 37,420 rounds to