Question

You should make up a transaction file with at least 3 records of students. Write a...

You should make up a transaction file with at least 3 records of students.

Write a main program that creates a collection of students. Your transaction file contains a set of information about students. Your program should contain four classes: StudentProfile, Person, Student, and Course.

StudentCollection has the following attributes:

            vector<StudentProfile>           StCollection;

StudentProfile class has the following attributes:

Person                         PersonalInfo
Student            StdInfo

Person class has the following attributes:

long                 SSN
string               Fname
string               Lname
int                    Age
char                 Gender (‘M’ for Male and ‘F’ for Female)

Student class has the following attributes:

long                 StNo
Course             Course1
Course             Course2
Course             Course3

Course             Course4

Course             Course5

Course class has the following attributes:

long                 CourseNum
string               CourseName

Place the following in your transaction file:

123456789

Mary

Anderson

20

F

9800300699

32451

CS211

23145

CS231

87690

Phy301

25677

Chem210

22213

Math210

633322789

Mike

Smith

22

M

9080022299

32251

CS111

11122

Math110

87969

Phy200

25627

Chem110

33313

Bio211

631322111

Michelle

Brown

25

F

611354321

11111

CS911

22222

Math912

33333

Phy913

44444

Chem914

55555

Bio915

Homework Answers

Answer #1

class studentProfile{
Person PersonalInfo;
Student StdInfo;
StudentProfile(Person PersonalInfo,Student StdInfo){
PersonalInfo.this=PersonalInfo;
StdInfo.this=StdInfo;

}
}
class Person{
long SSN;
string Fname;
string Lname;
int Age;
char Gender ;
person(long SSN,string Fname,string Lname,int Age,char Gender){
SSN.this=SSN;
Fname.this=Fname;
Lname.this=Lname;
Age.this=Age;
Gender.this=Gender;
}
}
class Student{
long StNo;
Course Course1;
Course Course2;
Course Course3;
Course Course4;
Course Course5;
Student(long StNo,Course Course1,Course Course2,Course Course3,Course Course4,Course Course5){
StNo.this=StNo;
Course1.this=Course1;
Course2.this=Course2;
Course3.this=Course3;
Course4.this=Course4;
Course5.this=Course5;
}
}
class Course{
long CourseNum;
string CourseName;
Course(long CourseNum,string CourseName){
CourseNum.this=CourseNum;
CourseName.this=CourseName;
}
}
class transaction{
public static void main(String args[]){

vector<StudentProfile> StCollection= new Vector<StudentProfile>();
Person p1= new Person(123456789,"Mary","Anderson",20,"F");
Person p2= new Person(633322789,"Mike","Smith",22,"M");
Person p3= new Person(631322111,"Michelle","Brown",25,"F");
Course c1= new Course(32251,"CS111");
Course c2= new Course(11122,"Math110");
Course c3= new Course(87969,"Phy200");
Course c4= new Course(25627
,"Chem110");
Course c5= new Course(33313
,"Bio211");
Course c6= new Course(11111
,"CS911");
Course c7= new Course(22222
,"Math912");
Course c8= new Course(33333
,"Phy913");
Course c9= new Course(44444
,"Chem914");
Course c10= new Course(55555
,"Bio915");
Course c11= new Course(32251
,"CS111");
Course c12= new Course(11122
,"Math110");
Course c13= new Course(87969
,"Phy200");
Course c14= new Course(25627
,"Chem110");
Course c15= new Course(33313
,"Bio211");
Student student1= new Student(9800300699,c1,c2,c3,c4,c5);
Student student2= new Student(9080022299,c6,c7,c8,c9,c10);
Student student3= new Student(611354321,c11,c12,c13,c14,c15);

StudentProfile sp1= new StudentProfile(p1,student1);
StudentProfile sp2= new StudentProfile(p2,student2);
StudentProfile sp3= new StudentProfile(p3,student3);
stCollection.add(sp1);
stCollection.add(sp2);
stCollection.add(sp3);
System.out.println("code working for itteration do");

}
}

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
Objective: Write a Java program that will use a JComboBox from which the user will select...
Objective: Write a Java program that will use a JComboBox from which the user will select to convert a temperature from either Celsius to Fahrenheit, or Fahrenheit to Celsius. The user will enter a temperature in a text field from which the conversion calculation will be made. The converted temperature will be displayed in an uneditable text field with an appropriate label. Specifications Structure your file name and class name on the following pattern: The first three letters of your...
0. Introduction. In this laboratory assignment, you will write a Python class called Zillion. The class...
0. Introduction. In this laboratory assignment, you will write a Python class called Zillion. The class Zillion implements a decimal counter that allows numbers with an effectively infinite number of digits. Of course the number of digits isn’t really infinite, since it is bounded by the amount of memory in your computer, but it can be very large. 1. Examples. Here are some examples of how your class Zillion must work. I’ll first create an instance of Zillion. The string...
Problem Definition: Problem: Given an array of integers find all pairs of integers, a and b,...
Problem Definition: Problem: Given an array of integers find all pairs of integers, a and b, where a – b is equal to a given number. For example, consider the following array and suppose we want to find all pairs of integers a and b where a – b = 3 A = [10, 4, 6, 16, 1, 6, 12, 13] Then your method should return the following pairs: 4, 1 15, 12 13, 10 A poor solution: There are...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT