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
yKpoI14uk [10]
3 years ago
13

Create a class, using separate files, named DynamicGrades. (2 points) This class has three data members: an int that represents

the student id, an int that stores the number of grades, and a pointer to int that represents a dynamic array the size specified by the previous data member. (2 points) Create at least one constructor that allocates the appropriate dynamic array. Also create a destructor to free the dynamic array. (2 points) Create at a mutator function that takes three parameters: an int that represents the id of the student, an int that represents the index location for the grade, an int that represents the grade for the location specified. (2 points) Create an accessor function that takes two parameters: an int that represents the id of the student, and int that represents th index location for the grade. The function returns the grade for the location specified. (1 point) In main() , create a regular object and a dynamic object. Exercise all constructors and functions. Provide all source code, each file containing a comment with your name, course code and date. Also provide a screenshot with a sample run (1 point). Submit source code and screenshot together in a zip file.
Computers and Technology
1 answer:
Alex3 years ago
3 0

Answer:

See explaination

Explanation:

#include <iostream>

using namespace std;

//DynamicGrades.h

class DynamicGrades

{

public:

DynamicGrades(int size);

~DynamicGrades();

void mutate(int studentId, int index, int grade);

int getGrade(int studentId, int index);

private:

int m_studentId;

int m_noofGrades;

int* m_dynamicArr;

};

//DynamicGrades.cpp

#include "DynamicGrades.h"

DynamicGrades::DynamicGrades(int size)

{

m_noofGrades = size;

m_dynamicArr = new int[m_noofGrades] {0};

}

DynamicGrades::~DynamicGrades()

{

if(nullptr != m_dynamicArr)

delete[] m_dynamicArr;

}

void DynamicGrades::mutate(int studentId, int index, int grade)

{

m_studentId = studentId;

if (index < m_noofGrades)

m_dynamicArr[index] = grade;

}

int DynamicGrades::getGrade(int studentId, int index)

{

if (index >= m_noofGrades)

return -1;

return m_dynamicArr[index];

}

//Main.cpp

#include "DynamicGrades.h"

int main()

{

DynamicGrades* grade = new DynamicGrades(5);

DynamicGrades grade2(10);

for (int i = 0;i < 5;++i)

{

grade->mutate(2, i, i + 1);

}

for (int i = 0; i < 10; i++)

{

grade2.mutate(3, i, i + 1);

}

cout << "Grades are " << endl;

for (int i = 0;i < 5;++i)

{

cout << grade->getGrade(2, i) <<" ";

}

cout << endl;

for (int i = 0; i < 10; i++)

{

cout << grade2.getGrade(3, i) << " ";

}

}

You might be interested in
Instead of sending an entire file in one big chunk across the​ Internet, __________ is used which dices the file up into little
azamat

Answer:

TCP/IP

Explanation:

TCP/IP which stands for Transmission Control Protocol and Internet Protocol are network protocols which divide your message into smaller chunks or fragments known as network packets and sends them out onto the Internet. When the chunks arrive at the intended destination, TCP/IP on the receiving end reassembles the network packets into the original message.

TCP/IP are the main protocols used for sending data over the internet.

7 0
3 years ago
Which person would be the best fit for a career in the Information Technology field?
zaharov [31]
The best possible fit would be a person with a creative mind and flexible mind. 
The technical stuff can be taught and learnt. But to evolve and keep up with the pace of how technology improves day to day, you'd need some with flexibility to cope up with this and creativeness to make innovations.
6 0
3 years ago
Read 2 more answers
g Write a function called price_of_rocks. It has no parameters. In a while loop, get a rock type and a weight from the user. Kee
Scilla [17]

Answer:

<u>The pseudocode:</u>

FUNCTION price_of_rocks():

  SET total = 0

  while True:

      INPUT rock_type

      INPUT weight

      if rock_type is "Quartz crystals":

         SET total += weight * 23

      elif rock_type is "Garnets":

         SET total += weight * 160

      elif rock_type is "Meteorite":

         SET total += weight * 15.50

       

       INPUT choice

       if choice is "n":

           break

 

   RETURN total

END FUNCTION

<u>The code:</u>

def price_of_rocks():

   total = 0

   while True:

       rock_type = input("Enter rock type: ")

       weight = float(input("Enter weight: "))

       

       if rock_type == "Quartz crystals":

           total += weight * 23

       elif rock_type == "Garnets":

           total += weight * 160

       elif rock_type == "Meteorite":

           total += weight * 15.50

           

       choice = input("Continue? (y/n) ")

       if choice == "n":

           break

   

   return total

print(price_of_rocks())

Explanation:

Create a function named price_of_rocks that does not take any parameters

Initialize the total as 0

Create an indefinite while loop. Inside the loop:

Ask the user to enter the rock_type and weight

Check the rock_type. If it is "Quartz crystals", multiply weight by 23 and add it to the total (cumulative sum). If it is "Garnets", multiply weight by 160 and add it to the total (cumulative sum). If it is "Meteorite", multiply weight by 15.50 and add it to the total (cumulative sum).

Then, ask the user to continue or not. If s/he enters "n", stop the loop.

At the end of function return the total

In the main, call the price_of_rocks and print

4 0
3 years ago
What is aperture priority mode? When might you use this mode on a camera? What is depth of field? How can you adjust the depth o
raketka [301]

Answer:

Please check explanation

Explanation:

We abbreviate aperture priority by A or Av( which is used for aperture value) on the camera mode call up, which is an adjustment on some of the cameras which leverage the user to adjust the certain value of the aperture or the f-number as meanwhile the camera adjust the speed of the shutter ensuring it matches it, and which results in a good exposure depending on the condition of the light  as being measured via the light meter. And this is not the same as the manual mode, in which the user is compelled to make the decision for both the values, the priority of the shutter, the location the user selects the shutter speed while the camera picks up the correct aperture, as well as the program state, where camera picks each of them.

So the first two questions are answered. Let's see the third, the depth of the field.  It is the distance from the nearest to the furthest objects which provides an image being selected for being at the focus in a camera.

Hence the depth of the field means the range of the sharp focus in a certain photograph. And while you shoot with the help of the larger camera like the DSLR, you will be able to adjust the depth through the adjustment of the aperture of the lens. The aperture is nothing else but the opening within the lens which manages the amount of the light that is permitted via the lens.

Now come to the fifth question. The shutter speed and the aperture are being related directly. It improves the aperture (by a stop). And each of them comes up with the very best exposure through the permitted weight of light.

And both of them are related to each other in an inverse proportion. And both of them must be balanced for ensuring that the image is not being exposed or less exposed to the permitted light. And when the aperture is increased the shutter speed increased for balancing it as well as vice versa.

Landscape mode:

It is the kind of page orientation that prints out the picture in a horizontal manner rather than in a vertical manner. And it is being commonly used for printing the charts or various other types of pictures as well as the text which might not adjust properly with the page that is aligned vertically.

Consider the High Nikon DSLR. You need to hold down the "MODE" as meanwhile the rear control (dial)  is turned unless you view "A" over the LCD top. And your FCD then sets the aperture. And in almost all Canon SLRs as an example: You need to turn to "Av" your mode dial.

The results of these adjustments are certainly good.

And the shutter speed is being measured by the unit of time and ranges in less than fractions of one second. And as we say that the shutter speed is "5000", it means its 1/30000 th of a  minute. And the shutter speed which is of one second or more in length is being marked as a'. One example is 16'.

How we measure aperture. And what it means:

It is being measured with the help of the f-stop scale. And on the digital camera, you will find 'f/' which is being followed by an integer. And this f-number indicates the wideness of the aperture. As well as the size does affect the exposure as well as the field depth of the resultant image.

Now come to why we should learn to control the shutter speed and the aperture.

You should know that by selecting the shutter speed you permit yourself to freeze or otherwise blur motion, and sometimes you would like to do the first one or the second one. And the aperture permits you to select the field depth to either blur the background or make it sharper.

Thus, now you have an idea of each of the modes, and their merits. And if you will ask the best one, he will be up with the aperture priority or with auto ISO and full manual. If you are up with some specific requirements, then you should have a full manual mode in automatic mode, and that will be quite handy. You certainly need to learn by heart how to make use of the full manual, as it will improve your understanding of the photography, however, the semi-automatic mode is certainly your best friend.

And yes, as well as its a very great feeling. Its certainly quite hard to take the photographs of still objects while you are riding.

Some of the things that make it hard to take the action photographs are like the object, or the animal can move as well as you need to set the shutter speed as well as the aperture speed quite swiftly. Also, you need to focus your camera for ensuring a very good picture and ensure its not blurry or like the picture is out of the focus.

In night photography, the camera might shake because of the very low ambient brightness, the camera might move for very slow shutter speed. Various other challenges are the improper focus, white balances, less exposure, etc,

That solves all the questions asked.

3 0
3 years ago
Give three facts about the history of the train shongololo
monitta
<span>began operating in 1995
shongololo means </span><span> “to roll up”
non- profit organization </span>
3 0
3 years ago
Other questions:
  • Which of the following is not an algorithm?
    8·1 answer
  • Technician A says that the last step in the diagnostic process is to verify the problem. Technician B says that the second step
    12·1 answer
  • âwhat two log files are used by older versions of unix and newer version of linux to store log information
    10·2 answers
  • Potatocat2UwU da best
    12·1 answer
  • Write the definition of a function named quadratic that receives three double parameters a, b, c. If the value of a is 0 then th
    12·1 answer
  • Describe the relative benefits of routing over a broadcast style of communication. Is routed traffic more secure than broadcasti
    14·1 answer
  • Write a function to reverse a given string. The parameter to the function is a string. Function should store the reverse of the
    12·1 answer
  • Explain what an IM is, and what is the technology shown in the accompanying figure
    7·2 answers
  • Messages that have been accessed or viewed in the Reading pane are automatically marked in Outlook and the message subject is no
    10·2 answers
  • When using the red / yellow I green method to present status of a project, green can mean which of the following?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!