Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This assignment is in C++. 4. Part 2 Structs and Arrays (65 points) In this assignment, we will be making a program that reads in
This assignment is in C++.
4. Part 2 Structs and Arrays (65 points) In this assignment, we will be making a program that reads in students' information and create a classroom seating arrangement with a number of rows and columns specified by a user. Then it will attempt to assign each student to a seat in a classroom. Use the file main_part2.cpp (attached at the end of this document) Include all the following requested code in new *.cpp and *h files, as needed. Step 1 First, you need to create a class Student. Create student.cpp and student.h files. It should contain two variables, lastName (char [30] and firstName (char [30]). Both should be private. In addition, the following functions should be defined. All of them are public Method Student ( Description of the Method Constructs a Student object by assigning the default string" ???" to both instance variables, lastName and firstName. Student Constructs a Student object using the string containing student's info. (char* studentlnfo Use the strtok function to extract first name and last name, then assign them to each instance variable of the Student class. An example of the input string is: David/Johnson char getLastName char* getFirstName( ) It should return the instance variable lastName It should return the instance variable firstName. char*toString ( ) It should constructor a string containing the initial character of the first name, a period, the initial character of the last name, and a period, then it returns it. An example of such string for the student David Johnson Is. D-J Step 2 You will be creating a class called Classroom. Create classroom.cpp and classroom.h files. The class ClassroomSeating will contain a 2-dimensional array called "seating" of Student objects at its instance variable. The class Classroom must include the following constructor and methods. (If your class does not contain any of the following methods, points will be deducted.) 4. Part 2 Structs and Arrays (65 points) In this assignment, we will be making a program that reads in students' information and create a classroom seating arrangement with a number of rows and columns specified by a user. Then it will attempt to assign each student to a seat in a classroom. Use the file main_part2.cpp (attached at the end of this document) Include all the following requested code in new *.cpp and *h files, as needed. Step 1 First, you need to create a class Student. Create student.cpp and student.h files. It should contain two variables, lastName (char [30] and firstName (char [30]). Both should be private. In addition, the following functions should be defined. All of them are public Method Student ( Description of the Method Constructs a Student object by assigning the default string" ???" to both instance variables, lastName and firstName. Student Constructs a Student object using the string containing student's info. (char* studentlnfo Use the strtok function to extract first name and last name, then assign them to each instance variable of the Student class. An example of the input string is: David/Johnson char getLastName char* getFirstName( ) It should return the instance variable lastName It should return the instance variable firstName. char*toString ( ) It should constructor a string containing the initial character of the first name, a period, the initial character of the last name, and a period, then it returns it. An example of such string for the student David Johnson Is. D-J Step 2 You will be creating a class called Classroom. Create classroom.cpp and classroom.h files. The class ClassroomSeating will contain a 2-dimensional array called "seating" of Student objects at its instance variable. The class Classroom must include the following constructor and methods. (If your class does not contain any of the following methods, points will be deducted.)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started