Question

I have an object struct named Course. I also have an array Course array[CAPACITY], where capacity...

I have an object struct named Course. I also have an array Course array[CAPACITY], where capacity = 100 and the size is 0. I do not know how to place the four attributes of object Course into an array and I was hoping to get an answer. I am using a for loop that takes in the class name, year, grade, and units, so how can I put that all into a Course object and then into an array of Course objects?

Homework Answers

Answer #1

so once your read all the data than create and object for
the structure and plcae it

for(int i=0;i<100;i++){
   cin>>name;
   cin>>year;
   cin>>grade;
   cin>>units;
   //creating structure object
   Course c;
   //assigning data to the structure object
   c.name=name;
   c.year=year;
   c.grade=grade;
   c.units=units;
   //putting that object into array
   array[i]=c;
}

NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.

I AM HERE TO HELP YOUIF YOU LIKE MY ANSWER PLEASE RATE AND HELP ME IT IS VERY IMP FOR ME

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
Phone number lookup Design a program that has two parallel arrays: a string array named people...
Phone number lookup Design a program that has two parallel arrays: a string array named people that is initialized with the names of seven of your friends, and a string array named phoneNumbers that is initialized with your friends phone numbers. The program should allow the user to enter a persons name (or part of a persons name). it should then search for that person in the people array. If the person is found, it should get that persons phjone...
IN JAVA PLEASE write code to MERGESORT an array of user inputted OBJECTS you have two...
IN JAVA PLEASE write code to MERGESORT an array of user inputted OBJECTS you have two different classes in the program being made as objects in the main (Bunny class and Dog Class). ask the user "what kind of animal would you like to sort?" user chooses the type of animal (bunny or dog), then you ask the user how big would you like the array of animals to be (maximum array size = 20)? and then you ask what...
Microsoft Visual Studio in C#: I have this code and need to loop through each element...
Microsoft Visual Studio in C#: I have this code and need to loop through each element of the patient's array and add to a listbox (lbAccountDisplay) each property of the patient's object. This is the 2nd time to ask this question; it should have all the detail you need to help me. It is a piece of a project and I am trying not to give you the whole project. How do I use a foreach loop to loop through...
I have a lab, where we have been examining the time it takes for an object...
I have a lab, where we have been examining the time it takes for an object to fall to the ground from a distance of 1.0 m. After collecting my data, I was asked to graph a distance vs. time squared graph, as seen by the attached photo. The line of best fit is linear. Now I am being asked to calculate the slope of the best fit line and the acceleration of my object. I am confused as to...
Assignment 1 - ITSC 2214 I have to complete the array list for a shopping list...
Assignment 1 - ITSC 2214 I have to complete the array list for a shopping list code and can't figure out how to complete it: Below is the code Complete the three empty methods (remove(), find(), and contains()) in the ShoppingListArrayList.java file. These methods are already implemented in the ShoppingListArray class. /////////////////////////////////////////////////////////////////////////////////////////////////////////// Grocery Class (If this helps) package Shopping; public class Grocery implements Comparable<Grocery> { private String name; private String category; private int aisle; private float price; private int quantity;...
IN JAVA Iterative Linear Search, Recursive Binary Search, and Recursive Selection Sort: <-- (I need the...
IN JAVA Iterative Linear Search, Recursive Binary Search, and Recursive Selection Sort: <-- (I need the code to be written with these) I need Class river, Class CTRiver and Class Driver with comments so I can learn and better understand the code I also need a UML Diagram HELP Please! Class River describes river’s name and its length in miles. It provides accessor methods (getters) for both variables, toString() method that returns String representation of the river, and method isLong()...
Write a template-based class that implements a template-based implementation of Homework 3 that allows for any...
Write a template-based class that implements a template-based implementation of Homework 3 that allows for any type dynamic arrays (replace string by the template in all instances below). • The class should have: – A private member variable called dynamicArray that references a dynamic array of type string. – A private member variable called size that holds the number of entries in the array. – A default constructor that sets the dynamic array to NULL and sets size to 0....
I need this before the end of the day please :) In Java 10.13 Lab 10...
I need this before the end of the day please :) In Java 10.13 Lab 10 Lab 10 This program reads times of runners in a race from a file and puts them into an array. It then displays how many people ran the race, it lists all of the times, and if finds the average time and the fastest time. In BlueJ create a project called Lab10 Create a class called Main Delete what is in the class you...
Assignment Statement Use the skeleton file starter code (below) to create the following classes using inheritance:...
Assignment Statement Use the skeleton file starter code (below) to create the following classes using inheritance: ⦁   A base class called Pet ⦁   A mix-in class called Jumper ⦁   A Dog class and a Cat class that each inherit from Pet and jumper ⦁   Two classes that inherit from Dog: BigDog and SmallDog ⦁   One classes that inherit from Cat: HouseCat The general skeleton of the Pet, Dog, and BigDog classes will be given to you (see below, "Skeleton", but...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • Calculate the mass of methane that must be burned to provide enough heat to convert 140.0...
    asked 11 minutes ago
  • An engineering department at a university wants to increase the number of female engineering majors and...
    asked 13 minutes ago
  • Design deterministic finite automata for each of the following sets: 1) The set of strings x...
    asked 22 minutes ago
  • Discuss why a firm's stockholders may be more likely to want to pursue a risky but...
    asked 22 minutes ago
  • The blade in a food processor spins at 1700 rpm. After the machine is turned off,...
    asked 33 minutes ago
  • Partial-Year Depreciation Equipment acquired at a cost of $93,000 has an estimated residual value of $6,000...
    asked 35 minutes ago
  • Which of the following polypeptides is most likely to form an alpha helix? Explain? a) Cys-Arg-Ala-Gly-Asn-Arg-Lys-Ile-Leu-Glu-Thr-Tyr...
    asked 51 minutes ago
  • In the figure, a bullet with mass m1 moving directly upward with speed v1i strikes and...
    asked 1 hour ago
  • Falling light. According to general relativity and the equivalence principle, light is bent by gravity. Consider...
    asked 1 hour ago
  • Eleana Kim begins her article describing a wedding. She said the wedding was not legitimate but...
    asked 1 hour ago
  • Fogerty Company makes two products—titanium Hubs and Sprockets. Data regarding the two products follow: Direct Labor-Hours...
    asked 1 hour ago
  • 7. State the angular analogs of Newton’s laws of motion in words and using equations. Rearrange...
    asked 2 hours ago