
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
![**Title: JavaScript Function for Calculating GPA**
**Description:**
Learn how to create a JavaScript function named `addGPA` that processes an array of student objects to include a GPA property for each student.
**Instructions:**
1. **Function Requirements:**
- The `addGPA` function takes an array of student objects as input.
- It returns the modified list of students with an added `gpa` property.
2. **Assumptions:**
- Each student object will have valid `qualityPoints` and `creditHours` properties.
- GPA is calculated by dividing the quality points by credit hours.
3. **Examples:**
- `addGPA([])` should return an empty array: `[]`
- `addGPA([{name: 'Sam Jones', qualityPoints: 60, creditHours: 20}])` should produce:
- `[{name: 'Sam Jones', qualityPoints: 60, creditHours: 20, gpa: 3.0}]`
4. **Methods Allowed:**
- You are free to utilize any built-in JavaScript array methods.
Use these guidelines to effectively write a function that enhances student records with GPA calculations.](https://content.bartleby.com/qna-images/question/9123907a-8746-4d91-90b8-859e0a45c1f5/fa173168-d19f-48d4-a69f-2bea31455494/rht8l1_thumbnail.png)
Transcribed Image Text:**Title: JavaScript Function for Calculating GPA**
**Description:**
Learn how to create a JavaScript function named `addGPA` that processes an array of student objects to include a GPA property for each student.
**Instructions:**
1. **Function Requirements:**
- The `addGPA` function takes an array of student objects as input.
- It returns the modified list of students with an added `gpa` property.
2. **Assumptions:**
- Each student object will have valid `qualityPoints` and `creditHours` properties.
- GPA is calculated by dividing the quality points by credit hours.
3. **Examples:**
- `addGPA([])` should return an empty array: `[]`
- `addGPA([{name: 'Sam Jones', qualityPoints: 60, creditHours: 20}])` should produce:
- `[{name: 'Sam Jones', qualityPoints: 60, creditHours: 20, gpa: 3.0}]`
4. **Methods Allowed:**
- You are free to utilize any built-in JavaScript array methods.
Use these guidelines to effectively write a function that enhances student records with GPA calculations.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Please write a java code using the JOptionPane class for input/output. Function read list_of_bidsPass In: nothingInitialise count = 0,bid_amount=0 Initialise two dimensional array list_of_bids[number of bids][2]while (count < 10) Read budget_amount from the user if budget_amount is not a number then Print error message "Invalid Input" continue Add bid and rating to list_of_bids Increment the value of count by 1end whilePass Out: 2d array list_of_bids[number of bids][2]Endfunction Function calculating averagePass In: 2d array list_of_bids[number of bids][2]Initialise bids_array by extracting bids from the 2d arrayInitalise average = 0,sum=0,count_of_bids=length of bids arraywhile bid in bids_array sum=sum+bidsaverage=sum/count_of_bidsPass Out : averageEndfunction Function determine winning bidPass In: 2d array list_of_bids[number of bids][2], budgetInitialise bids_array by extracting bids from the 2d array passed,2d_budget_array to empty, rating to 5…arrow_forwardan int variable k, an int array currentMembers that has been declared and initialized, an int variable nMembers that contains the number of elements in the array, an int variable memberID that has been initialized, and a bool variable isAMember, Write code that assigns true to isAMember if the value of memberID can be found in currentMembers, and that assigns false to isAMemberotherwise. Use only k, currentMembers, nMembers, and isAMember.arrow_forwardPlease use C as the programing language.arrow_forward
- Inside this module, import random and blackout_utils, and define the following global variable, which you should use whenever appropriate: OPERATIONS = ['^', 'x', '/', '+', '-']For full marks, all the following functions must be part of this module: calculate(tokens): Takes one list of tokens as input corresponding to a mathematical equation. The function will evaluate both sides of the equality and return a list of three tokens: the result of the left-hand side (integer), the equals sign (string), and the result of the right-hand side (integer). The equation may contain any of the operations in the OPERATIONS list, as well as opening and closing parentheses. Your function should evaluate both sides of the equation while respecting order of operations (that is, parentheses, followed by exponentiation, then multiplication and division, and then addition and subtraction). Equations may have multiple sets of parentheses and nested parentheses. The contents of the inner-most nested…arrow_forwardWrite a program that stores dynamically allocated array of Movie (using calloc() function). Movie is the Structure with seven fields: name, genre (science fiction – action – drama/love), ticketPrices, list of actors/actresses, ratings(number of tickets sold), cost of production and profit. In program implementation user enters the following: Movie Name Movie1 Movie2 Movie3 Genre Science Fiction Action Drama-Love List of Actors /Actresses Ratings(number of tickets sold) 720 750 300 Ticket Prices $45.3 $50.2 $2.3 Cost of production $5000.5 $7000.1 $100 Net Profit - Print the Movie names, list of actors/actresses, ratings(number of tickets sold), ticket prices, cost of production and the total net profit of each movie(net_profit_of_movie) - Write a function that calculates the net_profit_of_movie; which is the multiplication of ticket prices and…arrow_forwardCreate a function using Java: Number of Rows = 3-6 Number of Columns = 3-6 Function Name: winInDiagonalFSParameters: board: 2D integer array, piece: integerReturn: booleanAssume board is valid 2D int array, piece is X==1/O==2.Look at all forward slash / diagonals in the board. If any forward slash / diagonals has at least 3consecutive entries with given type of piece (X/O) (3 in a row XXX, OOO), then return true,otherwise falsearrow_forward
- Create a function named "onlyOdd".The function should accept a parameter named "numberArray".Use the higher order function filter() to create a new array that only containsthe odd numbers. Return the new array.// Use this array to test your function:const testingArray = [1, 2, 4, 17, 19, 20, 21];arrow_forwardYou are working for a university to maintain a list of grades and some related statistics for a student. Class and Data members: Create a class called Student that stores a student’s grades (integers) in a vector (do not use an array). The class should have data members that store a student’s name and the course for which the grades are earned. Constructor(s): The class should have a 2-argument constructor that receives the student’s name and course as parameters and sets the appropriate data members to these values. Member Functions: The class should have functions as follows: Member functions to set and get the student’s name and course variables. A member function that adds a single grade to the vector. Only positive grades are allowed. Call this function AddGrade. A member function to sort the vector in ascending order. A member function to compute the average (x̄) of the grades in the vector. The formula for calculating an average is x̄ = ∑xi / n where xi is the value of each…arrow_forwardSee attached images. Please help - C++arrow_forward
- 1. Write a program that defines a struct named Info. That Info struct should define two strings, a double and array of strings. In your main program, define a variable v using that Info struct and then initialize it to hold your first name, your last name, your lucky non-whole number (e.g. 26.5), your major, and a listing (an array) of your six most favorite college courses you have ever taken or plan to take. Then your program should access and print all the stored data held in the variable v. 2. print the data twice, once using the structure variable and do-while loop, and next using a pointer variable and a while-do loop.) Using the embed icon shown above show screenshots demoing the execution of your program.arrow_forwardDefine a function named “getExamListInfo” that accepts an array of Exam objects and its size. It will return the following information to the caller: - The number of exams with perfect score - The number of exams with “Pass” status - The index of the Exam object in the array that has the largest score. For example, if you get the exam info for this array of Exam object Exam examList[] = { {"Midterm1 Exam", 90}, {"Midterm2 Exam", 80}, {"Final Exam", 50}, {"Extra Credit", 100}, {"Initial Test", 0}, {"Homework1", 69} } ; You will get Perfect Count: 1 Pass Count: 3 Index of the largest: 3 C++arrow_forwardUSING java: Create a simple Tic Tac Toe game designed for one player (against computer). you will need to create arrays and functions to complete this program. The first screen should ask the user for his name, print a welcome message, and display an empty 3x3 Tic Tac Toe board. Then, the program should ask the user to put the coordinates of his move. once the user enters the coordinates, the program should respond accordingly with a print of the user's move and the computer's move. this should go on until a winning pattern is found. Key steps: Game board is designed, user inputs taken and marked on the board, validate the inputs that no two inputs at the same place and out of range, check the winner/loser and complete the game.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education