Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume the declarations a) student. course. callNum = \" CSC230\"; b) cin >> stu

ID: 643642 • Letter: A

Question

Assume the declarations

a) student. course. callNum = " CSC230";
b) cin >> student. name;
c) classList[0] = name;
d) classList[1]. gpa = 3.45;
e) name = classList[15]. name;
f) student. name = name;
g) cout << classList[ 10] << endl;
h) for ( int j = 0; j < 100; j++)
classList[ j]. name = name;
i) classList. course. credits = 3;
j) course = studentType. course;

Write a c++ program that does the following

a) Store the following information in a course:

name: Programming I
callNum: 13452
credits: 3
grade: 'A'

b) In the array classList, initialize each gpa to 0.0.

c) Copy the information of the thirty-first component of the array classList into student.

d) Update the gpa of the tenth student in the array classList by adding 0.75 to its previous value

Explanation / Answer

a) wrong. (type of callNum is int. so, we can't assignm string to it)

b) wrong. (type of student.name is nameType. so, we can't use cin or cout on it)

c) wrong. (type of classList[0] is studentType and os name is nameType. since they are of two different structs, we can't use assignment operator)

d) correct

e) correct

f) correct

g) wrong. (type of classList[0] is studentType. so, we can't use cin or cout on it)

h) correct

i) wrong. (classList is an array. to access an element of the array. correct representation must be classList[0].course.credits = 3

j) wrong. (first you must create an object of type studentType

correct representation would be

studentType s;

course = s.course;

)

________________________________________________________________________________

#include <iostream>
#include <string>

using namespace std;

struct nameType{    
   string first;
   string last;
};

struct courseType{
   string name;
   int callNum;
   int credits;
   char grade;
};

struct studentType{
   nameType name;
   double gpa;
   courseType course;
};

int main(){
   studentType classList[100];
   courseType course;
   studentType student;
   nameType name;
   course.name = "Programming I";
   course.callNum = 13452;
   course.credits = 3;
   course.grade = 'A';
   for(int i = 0; i < 100; ++i){
       classList[i].gpa = 0.0;
   }
   student = classList[30];
   classList[9].gpa += 0.75;
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote