Evaluating the Style of your programs

Similar documents
Chapter 4: Conditionals and Recursion

Chapter 1 Lab Algorithms, Errors, and Testing

Chapter 5 Lab Methods

ACS-1903 Basic program structure Feb 16, 2017

Lesson 7 Part 2 Flags

Over and Over Again GEEN163

Chapter 2: Input, Processing, and Output

CS 152: Data Structures with Java Hello World with the IntelliJ IDE

Chapter 5 Lab Methods

Chapter 5 Lab Methods

Lecture 8 " INPUT " Instructor: Craig Duckett

Anatomy of a Java Program: Comments

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

CSIS 10A Assignment 3 Due: 2/21 at midnight

BlueJ Demo. Topic 1: Basic Java. 1. Sequencing. Features of Structured Programming Languages

Arrays and the TOPICS CHAPTER 8. CONCEPT: An array can hold multiple values of the same data type simultaneously.

Chapter 6. Repetition. Asserting Java. Rick Mercer

1 Short Answer (10 Points Each)

Please answer the following questions. Do not re-code the enclosed codes if you have already completed them.

Flow of Control: Loops. Chapter 4

Introduction to Computer Programming

New York University Introduction to Computer Science Exam Sample Problems 2013 Andrew I. Case. Instructions:

New York University Introduction to Computer Science Exam Sample Problems 2013 Andrew I. Case. Instructions:

Conditional Programming

Loops. GEEN163 Introduction to Computer Programming

St. Edmund Preparatory High School Brooklyn, NY

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal

Input. Scanner keyboard = new Scanner(System.in); String name;

Exam 2. Programming I (CPCS 202) Instructor: M. G. Abbas Malik. Total Marks: 40 Obtained Marks:

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal

Oct Decision Structures cont d

Instructions PLEASE READ (notice bold and underlined phrases)

FAU. How do I. Post course content? Folders

Course Outline. Introduction to java

Example Program. public class ComputeArea {

Java Assignment 3: Loop Practice Ver 3.0 Last Updated: 12/1/2015 8:57 AM

First Visual Basic Lab Paycheck-V1.0

Claremont McKenna College Computer Science

Basic Computation. Chapter 2

Lecture 9. Assignment. Logical Operations. Logical Operations - Motivation 2/8/18

Introduction to Flowcharting

Activity 3: Data Types

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

Chapter 9 Lab Text Processing and Wrapper Classes

Basic Computation. Chapter 2

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015

Programming Assignment 2 (PA2) - DraggingEmoji & ShortLongWords

Final Exam Practice. Partial credit will be awarded.

Programming Standards: You must conform to good programming/documentation standards. Some specifics:

Welcome to CompSci 201

Student Guide to elearn

Full file at

CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1. Name SOLUTION

CS 231 Data Structures and Algorithms Fall Event Based Programming Lecture 06 - September 17, Prof. Zadia Codabux

JAVA PROGRAMMING (340)

CSE142 Sample Midterm Spring Name UW NetId (e.g. whitab) Section (e.g., AA) TA

Chapter 6 Lab Classes and Objects

Tutorials. Tutorial every Friday at 11:30 AM in Toldo 204 * discuss the next lab assignment

CS 455 Midterm Exam 2 Fall 2015 [Bono] Nov. 10, 2015

CSC142, Computer Science II, Project 5 (2 nd submission)

1 Short Answer (10 Points Each)

Chapter 6 Lab Classes and Objects

Lesson 10: Quiz #1 and Getting User Input (W03D2)

Lecture 17. Instructor: Craig Duckett. Passing & Returning Arrays

Java and Software Design

New York University Introduction to Computer Science Midterm2 Sample Problems 2013 Andrew I. Case. Instructions:

I. Variables and Data Type week 3

Object Oriented Programming. Java-Lecture 1

for Diane Christie University of Wisconsin Stout

Tips from the experts: How to waste a lot of time on this assignment

Full file at

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...

Chapter 6. Repetition. Asserting Java. Rick Mercer

Week 2: Data and Output

There are several files including the start of a unit test and the method stubs in MindNumber.java. Here is a preview of what you will do:

A+ Computer Science -

What two elements are usually present for calculating a total of a series of numbers?

4*4*4 2. What is the output of the following flowchart for the values given below: (25 p)

BASIC INPUT/OUTPUT. Fundamentals of Computer Science

! definite loop: A loop that executes a known number of times. " The for loops we have seen so far are definite loops. ! We often use language like

Darrell Bethea May 10, MTWRF 9:45-11:15 AM Sitterson 011

Full file at

2. What are the two main components to the CPU and what do each of them do? 3. What is the difference between a compiler and an interpreter?

Chapter 12: Arrays Think Java: How to Think Like a Computer Scientist by Allen B. Downey

Web Time Entry in Self Service Banner for Hourly Students

Darrell Bethea May 25, 2011

1 Short Answer (2 Points Each)

CT 229 Fundamentals of Java Syntax

Spring 2017 CMSC 140 Programming Project 7: Payroll

Robots. Byron Weber Becker. chapter 6

C Sc 227 Project 1: Three Main Methods

Object Oriented Programming. Java-Lecture 6 - Arrays

DOMjudge team manual. Summary. Reading and writing. Submitting solutions. Viewing scores, submissions, etc.

DOMjudge team manual. Summary. Reading and writing. Submitting solutions. Viewing scores, submissions, etc.

CS 170 Java Programming 1. Week 10: Loops and Arrays

IT 1033: Fundamentals of Programming Loops

Chapter 7: Arrays and the ArrayList Class

COMP-202: Foundations of Programming. Lecture 22: File I/O Jackie Cheung, Winter 2015

Chapter 5: Methods. by Tony Gaddis. Starting Out with Java: From Control Structures through Objects. Fourth Edition

What methods does the String class provide for ignoring case sensitive situations?

Transcription:

Evaluating the Style of your programs Objectives At the end of this exercise, students will: Roles Be able to evaluate a program for conformance to style guide for the class. Be able to evaluate arithmetic expressions in Java Coordinator will make sure the team stays on task Presenter will only be used if there is a question about your group s responses Recorder will write on the board the group answers to BOARD questions Reflector if present will fill out the exit pass, otherwise, team members will do so Getting ready 1. All team members - record your notes on your own response sheet. Part 1 Oh goody, another quiz 1. Each person should take the quiz individually, making sure that your name is on top of the paper and that you record your answers on the question sheet. DO NOT USE A CALCULATOR.. When everyone has finished, take the group quiz using the IF-AT form. You may grade your own form. 6 points for one scratch off, 3 points for, 1 point for 3 and of course 0 for 4. Sum the score and put it on the top of the form. DO NOT grade individual quizzes. 3. As a class, be prepared to ask for clarification of any of the responses. Part Why a Style Guide 4. Review the three StyleGuide.java solutions. Each was written by a different person and have different levels of quality. DO NOT WORRY about the Style Guide yet. 5. Which of the three do you consider to be the best solution? Why? Note that all passed submit tests, so are all considered correct solutions. 6. Which of the three do you consider to be the worst solution? Why? 7. In your own words, what are the qualities of a good program from a stylistic point of view? 1

Part 3 Evaluating a program 8. Using PayrollV3, apply the evaluation rubric to the program. Specifically, a. Items to look for are grouped into general areas, such as A. Identifier naming. Subitems indicate a particular feature that we require. So for example, if you see a name like Q for a variable name, it violates both A.1 and A. since variables must begin with a small letter and be meaningful. b. For each item in the list, look to see that the program conforms to that item. For each violation, indicate on the the problem in the program listing by writing the code (like A.1) beside the problem. c. Proceed through the program indicating all such violations. d. On the evaluation sheet, count the number of violations and indicate that number in the blank box to the right. So for example, if there were two identifiers that did not have meaningful names, the space beside A1 would be a. If you find more than violations, the maximum deduction is. For any major category, the maximum violations are 5. e. Compare your answers within the team and have the reporter ready to respond when / if your team is called. f. BOARD Given that 0 points will be devoted to Style Guide issues, how many of the 0 points would this program receive? STOP HERE 9. Give your SecondsToHours program listing to one other person on the team. 10. Using another Program Evaluation sheet, look for each violation in your teammate s work and indicate the score for each line. Do not write on the listing as you did for question 8. Write the final score (out of 0) for that program. 11. Switch back so that each person has his/her program back, but not the evaluation sheet. Score your own program, this time indicating violations on your own program listing and the score on the evaluation sheet. 1. Compare the paired evaluation sheets. Did you find anything in your own code that your teammate did not? Did you find something in your teammate s code that was a problem that they did not spot? (Don t answer on paper, discuss). Part 4 Homework 13. Now that you are more familiar with the conventions, rework your SecondsToHours program and resubmit it. Upload your pdf report to the Assignment that you will find in BB. This needs to be completed before class time on Wednesday.

011 09 14 16:6 Payroll.java Page 1 3 /** 4 This program calculates gross pay. 5 6 @author Tony Gaddis 7 @version V1 1/15/007 8 */ 9 10 public class Payroll 11 { 1 /** 13 main method entry point to the application 14 15 @param args command line arguments unused 16 */ 17 public static void main(string[] args) 18 { 19 final double BONUS = 500.00; // bonus amount 0 String name; // To hold a name 1 int hours; // Hours worked double payrate; // Hourly pay rate 3 double grosspay; // Gross pay 4 Scanner keyboard; // input 5 6 // Create a Scanner object to read input. 7 keyboard = new Scanner(System.in); 8 9 // Get the user s name. 30 System.out.print("What is your name? "); 31 name = keyboard.nextline(); 3 33 // Get the number of hours worked this week. 34 System.out.print("How many hours did you work this week? "); 35 hours = keyboard.nextint(); 36 37 // Get the user s hourly pay rate. 38 System.out.print("What is your hourly pay rate? "); 39 payrate = keyboard.nextdouble(); 40 41 // Calculate the gross pay. 4 grosspay = hours * payrate; 43 grosspay = grosspay + BONUS; 44 45 // Display the resulting information. 46 System.out.println("Hello " + name); 47 System.out.println("Your gross pay is $" + grosspay); 48 } 49 }

011 09 14 16:6 PayrollV.java Page 1 /** 3 @author Duke Dog 4 @version V 09/19/011 5 */ 6 public class PayrollV 7 { 8 public static void main(string[] args) 9 { 10 final double b = 500; 11 String n; 1 int h; 13 double p; 14 double g; 15 Scanner key; // input 16 key = new Scanner(System.in); 17 System.out.print("What is your name? "); 18 n = key.nextline(); 19 System.out. 0 print("how many hours did you work this week? "); 1 h = key.nextint(); System.out.print("What is your hourly pay rate? "); 3 p = key.nextdouble(); 4 g = h*p+b; 5 System.out.println("Hello "+n); 6 System.out.println("Your gross pay is $"+g); 7 }}

011 09 14 16:7 PayrollV3.java Page 1 3 /** 4 This program demonstrates the Scanner class. 5 6 @author Duke Dog 7 @version V1 1/15/007 8 */ 9 10 public class PayrollV3 11 { 1 /** 13 main method entry point to the application 14 15 @param args command line arguments unused 16 */ 17 public static void main(string[] args) 18 { 19 final double bonus = 500.00; // bonus amount 0 String Name; // To hold a name 1 int h; // Hours worked double payrate; // Hourly pay rate 3 double grosspay; // Gross pay 4 Scanner keyboard = new Scanner(System.in); 5 6 // Get the user s name. 7 System.out.print("What is your name? "); 8 Name = keyboard.nextline(); 9 30 // Get the number of hours worked this week. 31 System.out.print("How many hours did you work this week? "); 3 h = keyboard.nextint(); 33 34 // Get the user s hourly pay rate. 35 System.out.print("What is your hourly pay rate? "); 36 payrate = keyboard.nextdouble(); 37 38 // Calculate the gross pay. 39 grosspay=h*payrate; 40 grosspay=grosspay+bonus; 41 4 // Display the resulting information. 43 System.out.println("Hello " + Name); 44 System.out.println("Your gross pay is $" + grosspay); 45 System.out.println("Thank you and have a wonderfully beautiful day, " + Name + "."); 46 } 47 }