Programming Exam 1
CMPE 126 Lab Section 02
Date: 09/25/2018 2:30-5:30pm
General guidelines
? This exam will be for 3 hours only.
? Please submit your best work by 5:30pm
? You may use external sources with citation
Academic Dishonesty
The following will be considered actions of academic dishonesty and will be reported without further
discussion.
? Copying code:
o You are NOT permitted to share code or reuse someone else's work.
? Discussing with others:
o You are NOT permitted to discuss in class or online with your classmates or anyone else
about the lab.
Expected exam etiquette
If you are found disregarding the following guidelines, you will be penalized in this exam:
? Using your cellphone – Using cellphones is strictly not allowed during exam time. Your cellphone
must be turned off (as stated in the syllabus) during your exams.
? Leaving the exam hall/lab without informing the instructor/TA.
Expected outcome from this exam
The exam will test your skills and understanding of the following concepts:
? C++ programming skills
? Problem-solving skills
? Object-oriented programming concepts - mainly encapsulation, abstraction, and polymorphism.
? Operator overloading (mainly arithmetic, logical, relational, << and >> )
? File I/O
Exam in the next page…
The problem
1. Create a class called myDate with month, date, and year fields
2. Overload the >> operator for the class to read a date in the format mm/dd/yyyy
a. E.g., 09/25/2017 should read 9 in the field month, 25 in the field date and 2017 in the
field year
3. Create a class called Student with fields name and birthday. Name should be of type string
and birthday should be of type myDate.
4. Overload >, <, <=, >= to compare two objects of type myDate
5. From a file called birthdays.txt, read a list of student birthdays in the format:
mm/dd/yyyy Alice
mm/dd/yyyy Bob
? ?
6. Print the oldest and youngest students’ name and birthdays
7. BONUS – Throw an error if the format of the date is wrong
8. BONUS 2 – Validate the date based on the calendar, e.g., 02/30/2017 should throw an error
because February has only 28 days in 2017.
Rubric
1. myDate class – 10 points
2. Operator >> overload – 25 points
3. Student class – 10 points
4. Operator >, <, >=, <= overload – 20 points
5. File read – 20 points
6. Find oldest and youngest – 15 points
7. Bonus 1 – 10 points
8. Bonus 2 – 10 points
Submission instructions
Submit the following files in a zip file:
? myDate.h
? myDate.cpp
? Student.h
? Student.cpp
? progExam1.cpp
? birthdays.txt
Name your zip file ProgrammingExam1_XXXYYYXXX.zip, where XXXYYYXXX is your SJSU ID. E.g., if your
SJSU ID is 111000111, your submission will be called ProgrammingExam1_111000111.zip.
版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。