Programming and Problem Solving I - Project 2 Problem | CECS 174, Lab Reports of Computer Science

Material Type: Lab; Class: Programming & Problem Solving I; Subject: Computer Engr & Computer Sci; University: California State University - Long Beach; Term: Fall 2003;

Typology: Lab Reports

Pre 2010

Uploaded on 08/19/2009

koofers-user-9fh
koofers-user-9fh 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CECS 174 Project 2 - Due in lab on Tuesday, 9/30/03
An instructor wants you to write a C++ program that will report “Passed” or “Failed” for each
student based on the student’s test score and the number of programs he/she completed. If the
test score is greater than or equal to 60 and the number of programs completed is greater than or
equal to 10, then output the word Passed. Otherwise, output the word Failed.
Specifically, she wants the program to do the following:
Prompt and input the number of students n.
For each of the n students, input a test score and the number of programs completed and
output the word “Passed” or “Failed” according to the decision rule described above.
When your program executes, it should produce output as in the following sample dialogue:
This program determines if a student has passed or failed
a class based on the student’s test score and the number
of programs he/she has completed .
Enter the number of students in the class: 6
On each line below, enter a student’s test score and the
number of programs he/she has completed, and press [ENTER].
Student 1: 66 12
[TAB]Passed
Student 2: 87 18
[TAB}Passed
Student 3: 98 9
[TAB]Failed
Student 4: 59 15
[TAB]Failed
Student 5: 32 5
[TAB]Failed
Student 6: 60 10
[TAB]Passed
______________________________________________________________________________
C++ Statements Needed:
Declaration for int type variables (int declarations).
Input integer values (cin >> ).
Output integers and character strings (cout << ).
while loop.
if-else statements.
______________________________________________________________________________
…/Continued on the other side.
pf2

Partial preview of the text

Download Programming and Problem Solving I - Project 2 Problem | CECS 174 and more Lab Reports Computer Science in PDF only on Docsity!

CECS 174 Project 2 - Due in lab on Tuesday, 9/30/

An instructor wants you to write a C++ program that will report “Passed” or “Failed” for each student based on the student’s test score and the number of programs he/she completed. If the test score is greater than or equal to 60 and the number of programs completed is greater than or equal to 10, then output the word Passed. Otherwise, output the word Failed. Specifically, she wants the program to do the following:  Prompt and input the number of students n.  For each of the n students, input a test score and the number of programs completed and output the word “Passed” or “Failed” according to the decision rule described above. When your program executes, it should produce output as in the following sample dialogue: This program determines if a student has passed or failed a class based on the student’s test score and the number of programs he/she has completed. Enter the number of students in the class: 6 On each line below, enter a student’s test score and the number of programs he/she has completed, and press [ENTER]. Student 1: 66 12 [TAB]Passed Student 2: 87 18 [TAB}Passed Student 3: 98 9 [TAB]Failed Student 4: 59 15 [TAB]Failed Student 5: 32 5 [TAB]Failed Student 6: 60 10 [TAB]Passed


C++ Statements Needed :  Declaration for int type variables (int declarations).  Input integer values (cin >> ).  Output integers and character strings (cout << ).  while loop.  if-else statements.


…/Continued on the other side.

Do the following:  Name your program file lab2.cpp and place it in your 174 subdirectory.  Document your program following the Program Documentation Guide which may be accessed through http://www.cecs.csulb.edu/~lam/cecs174/course-notes.html  Make sure your program’s output matches the sample dialogue given above. [TAB] on the sample dialogue represents the TAB character.  Use script to get a typescript file that captures: a) cat lab2.cpp b) g++ lab2.cpp c) a.out.  Print and hand in a hardcopy of the typescript file.  Demo your program on the due date.