首页 > > 详细

辅导CMPSC121 Lion Path解析C/C++语言、C/C++辅导

C++,。

Objectives

After this homework assignment, students should be able to:

  • Implement user-defined structs using given specifications
  • Use file input to populate structs

Background

While working to improve the LionPath website, you discovered a way to generate formatted text files that contains information about students’ schedules for the upcoming semester. Consider the example below:

FNAME: Andrew MINIT: S LNAME: Yu ID:    912345678 USER:  auy77  CMPSC121-002-003L - M 9 05 AM 50 Lecture - T 10 05 AM 110 Lab - W 9 05 AM 50 Lecture MATH140-001 - M 12 25 PM 50 Lecture - T 12 25 PM 50 Lecture - W 12 25 PM 50 Lecture - R 12 25 PM 50 Lecture PSU007-001 - W 06 00 PM 50 Lecture ENGL101-004 - M 11 15 AM 50 Lecture - W 11 15 AM 50 Lecture - F 11 15 AM 50 Lecture PHYS211-003-006L - T 3 35 PM 90 Lecture - R 3 35 PM 90 Lecture - F 12 00 PM 110 Lab 

Each line that begins with “-“ refers to one of the meeting times of the course above. For example:

- M 9 05 AM 50 Lecture Monday, 9:05AM, 50 minute lecture 

Because LionPath can generate many of these files, you have decided to write a C++ program that can automatically process them. You will use object-oriented programming to keep track of the students and courses.

Instructions

Write a C++ program named lionpath.cpp that implements the structs described below:

Student

The Student struct contains basic identifying information about one student and a vector of courses that the student is scheduled to take:

Attribute Data Type
First name string
Middle initial char
Last name string
9-digit PSU ID Number string
PSU Username string
Enrolled Courses vector

Course

The Course struct contains the following information:

Attribute Data Type
Course name string
Number of lectures per week int

Write a main function that:

  • Reads a text file (like shown in the background)
  • Automatically populates a Student struct with relevant information
  • Displays a simplified version of it to the console window

Note that only the number of lectures per course needs to be counted, which means the content of the lines containing information about each lecture can be ignored.

Optional Bonus

Write a C++ program named schoolday.cpp that extends the functionality lionpath.cpp by:

  • Accepting user input for a character representing a weekday:
    • M, T, W, R, or F
  • Printing information about all lectures scheduled on that day

Sample Output

FNAME: Andrew MINIT: S LNAME: Yu ID:    912345678 USER:  auy77  CMPSC121-002-003L 3 lectures MATH140-001 4 lectures PSU007-001 1 lecture ENGL101-004 3 lectures PHYS211-003-006L 3 lectures 

Optional Bonus Sample Output

FNAME: Andrew MINIT: S LNAME: Yu ID:    912345678 USER:  auy77  Select a weekday (M, T, W, R, F): S Invalid input, try again! Select a weekday (M, T, W, R, F): T  CMPSC121-002-003L - T 10 05 AM 110 Lab MATH140-001 - T 12 25 PM 50 Lecture PSU007-001 ENGL101-004 PHYS211-003-006L - T 3 35 PM 90 Lecture 

Submission

Please submit all .cpp files prior to the deadline listed above.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!