CS-575

COMPUTER SCIENCE‐INFORMATION TECHNOLOGY 575—PROGRAMMING FUNDAMENTALS FOR COMPUTER SCIENCE

Section: 3130
Instructor: Brad Gilbert
Links
Syllabus (pdf)
Using Command Prompt (pdf)
Binary
Programming basics
Labs
Lab 1: page 241, exercise 2 - output 3 numbers in ascending order, due Feb 29
Lab 2: page 314, exercise 6 - read a set of (5) integers, due Mar 14
Lab 3: page 356, exercise 3 - output the number of vowels, due Mar 28
Lab 4: page 424, exercise 1 b, c, d, & g - compute salary, due Apr 11
Lab 5: page 558, exercises 2 & 3 - Arrays, due May 2
Lab 6: Midterm question 2 - RPS, due May 9
Lab 7: Midterm question 3 - Functions, due May 9
     See the bottom of this page for lab 6 & 7 instructions.
Lab 8: page 645, exercise 2 - structures, due May 16
Click here for extra credit - 2D arrays, functions, & file input, due May 23
Midterm 1
A: 47%   B: 22%
3 perfect scores!
Midterm 2
A: 18%   B: 7%   C: 15%
2 almost perfect scores!
Student Scores

Sign in



Lab 6
Rules for rock, paper, scissors: rock beats scissors, paper beats rock, scissors beats paper.
Write a while loop. Each time it runs, it asks player 1 to enter R, P, or S (for rock, paper or scissors), then asks player 2 the same thing. Declare a winner for the game and ask player 1 if she wants to play again. If input is Y, then run the loop again, else, exit the loop. After the loop, display how many games each player won and declare which player won the most games, or if it was a tie. Note: do not ask players for their names; simply refer to “player 1”, and “player 2”.
Lab 7
Write a complete program with the following:
1. A function named getID that asks the user to enter a student ID and returns that ID as an integer
2. A function named getScores that accepts an integer named ID and asks the user to enter 4 scores for the
student with that ID, and returns the total scores as an integer.
3. A void function named getGrade, that accepts total (an int) and grade (a char) that sets grade to A, B, C,
or D, respectively if total is 90 or higher, 80 or higher, 70 or higher, or 60 or higher, otherwise, grade is set to F.
4. A void function named printGrade that accepts ID, total, and grade, and displays the student ID,
total, and grade. 5. The main function calls each of the above functions.
6. Five extra credit points for placing the function calls into a loop that asks the user if he wants to input another student.