Sei sulla pagina 1di 2

_____________________________________________________________________________________ CSC134 C++ PROGRAMMING _____________________________________________________________________________________ LAB 01 WRITING FIRST C++ PROGRAM AND CREATING CLASSES AND OBJECTS

Objectives In this lab assignment, students will learn: - How to write a simple C++ program - How to document program using comments - How to identify input, processing and output items - How to fundamental data types - How to use arithmetic operators - How to write simple decision making statements - How to define a class and create an object - How do declare and define member functions of a class - How to declare and use data members of a class - How to use a constructor to initialize data members of a class - How to separate a classs interface from its implementation Goals In this lab assignment, students will demonstrate the abilities to: - Learn how to create a basic procedural program in C++ - Learn how to create a basic object oriented program in C++ using Classes - Learn how to engineer a class to separate its interface from its implementation Grading Each problem in this assignment is worth 50 points. Grading rubric for each question: - Insert comments to document your program [5 pts] - Program must be implemented and run as instructed [40 pts] - Source files (xxx.cpp/xxx.h) and executables (xxx.exe) are submitted to Blackboard in a compressed file (i.e. .zip file). [5 pts] Write programs to solve the follow problems.

Chapter 2 : Introduction to C++ Programming


Write a program which calculates a students end of semester grade based on the following grade information : Midterm Exam Grade (20%) Final Exam Grade (20%)

______________________________________________________________________________________________________________________________________________________________________________________________________________________

______________________________________________________________________________________________________________________________________________________________________________________________________________________

CSC134

Lab 01

Page 2

Lab Grade (50%) Assume 4 Lab Assignments Quiz Grade (10%) Assume 3 quizzes and drop the lowest quiz grade. Sample Output : (user input in red)

Enter Midterm Exam Grade: 80 Enter Final Exam Grade: 90 Enter three Quiz Grades: 70 60 100 Enter four lab Grades: 90 50 75 45 Your End of Semester Grade is 75 Press any key to continue . . .

Chapter 3 Exercise:
Exercise 3.14 (Employee Class) (Assume that the objects are initialized during declaration) For example: int main() { // Declare two Employee objects Employee employee1( "Lisa", "Roberts", 4500 ); Employee employee2( "Mark", "Stein", 4000 ); .etc. system(pause); return 0; } Sample Output :

Employees' yearly salaries: Lisa Roberts: $54000 Mark Stein: $48000 Employees' yearly salaries after 10% raise: Lisa Roberts: $59400 Mark Stein: $52800 Press any key to continue . . .

Potrebbero piacerti anche