COSC1306 Spring 2017 Assignment 3: Conditional Statements [1] Objective: The primary purpose of this assignment is to make sure everyone is familiar with the ifstatement in various forms. In addition to that, we are also practicing some of the simple statements that we introduced in class such as print(), len(), input(), eval(), assignment statement, expression, string, etc. You don't need loop structures or functions. [2] Description: You are going to print a sample diploma of the University. A sample template is given in Display 1 below. Students with high enough GPAs will also earn an honor designation. Ignore the credit hours requirement. Upon the recommendation of the faculty, the Board of trustees and the President of the University of Houston confer upon <<student name>> the degree Bachelor of Science <<optional honors designation>> with all the rights and privileges pertaining thereunto. Display 1 You program should do the following. 1. 2. 3. 4. Input a student’s name (first name followed by last name). Ask for the student’s GPA by name. Convert the GPA into a number (float). Construct a string containing the honors designation (cum laude, etc.) of the student, the honor should be an empty string if there is no honor designation. You should use an if-elif-else statement here to separate various cases. 5. Set up all the lines of the diploma. 6. Print the diploma in a proper format. When you print the diploma, do not print an empty line when there is no honor designation for the student. See Display 2 and 3 for the difference of the two cases. Color and bold face are used to highlight the "customization" of the diploma. It takes some efforts to figure out how to center the text. You are allowed to use any reasonable method to do that. I will explain some possible ways in class. For this purpose, you may assume the output uses a fixed-width font, i. e., all characters are of equal with (Courier) and the total width of the paper is 60 characters wide. This program may be longer than you expected. I used about 35 lines of code (NOT counting comments and blank lines). The main reason is to deal with each of the output lines (up to 8 lines). You will appreciate the ability to write functions and use loops to simplify the task later. [3] Input: User input. You may hard code most of the diploma, except the name and the honor designation, in your program. [4] Output: Equivalent length in centimeters. Sample output is as follows: Upon the recommendation of the faculty, the Board of trustees and the President of the University of Houston confer upon Stephen Huang the degree Bachelor of Science summa cum laude with all the rights and privileges pertaining thereunto. Display 2 Upon the recommendation of the faculty, the Board of trustees and the President of the University of Houston confer upon Stephen Huang the degree Bachelor of Science with all the rights and privileges pertaining thereunto. Display 3 [5] Deadline: Feb. 20, 2017
© Copyright 2026 Paperzz