CS 1027b Foundations of Computer Science II Assignment 1: File Compression Due Date: February 5, 11:55 pm Weight: 10%
|
|
- Camron Sullivan
- 6 years ago
- Views:
Transcription
1 CS 1027b Foundations of Computer Science II Assignment 1: File Compression Due Date: February 5, 11:55 pm Weight: 10% 1 Purpose To gain experience with Java Fixed length arrays 2 Overview For this assignment you are required to write a Java program that reads a text file and compresses it using the algorithm described below. The compression ratio of a compression algorithm is defined as the size of the original file divided by the size of the compressed one. The compression ratio achieved by your program will depend on the input file. You are also required to write a Java program to decompress a file compressed by the above algorithm to recover the original file. 3 The Compression Algorithm Your compression program will receive as input a text file to compress and a second file containing a set of compression codes for the characters that might appear in the input file. The content of the second file will be read by your program and stored in a list of codes. Each entry of this list will store two things: a character and a compression code. The compression algorithm is very simple. It reads the characters of the text input file one at a time, looks up the next character in the list of codes, and writes into the compressed file the corresponding compression code. If a character of the input file is not in the list of codes, the algorithm prints an appropriate message and terminates. For example, suppose that the list of codes is the following Character Compression code e 001 t 1010 a 1000 W and that the input text file contains the following line: eteaaw Then the compression algorithm will write to the compressed file the following
2 Each character in a text file is stored in the file as a sequence of 8 bits (or 16 bits depending on encoding), while each compression code is a sequence with a variable number of bits. Compression is achieved when characters appearing often in the input file are assigned compression codes that are shorter than 8 bits. For the above example, the line eteaaw is stored in the text file with 48 bits, while the compressed version uses only 28 bits. If the input file, for example, contained the line fea Then the compression algorithm will print a message indicating that there is no compression code for character f and then it would terminate. 4 Decompression Algorithm The decompression algorithm is a bit more complicated than the compression one because the compression codes do not have the same length. The algorithm reads the compression file one bit at a time until the sequence of bits read from it appears in the list of codes; then the associated character is written to the decompressed file. For the same example above, the algorithm reads first bit 0 from the compressed file and it looks it up in the list of codes. As 0 is not the compression code of any character, then the algorithm reads the next bit from the compressed file, obtaining the sequence 00. This is not a compression code, so the algorithm reads the third bit and discovers that 001 is the compression code for e, so e is written to the decompressed file. The algorithm continues reading bits and looking up the sequence of bits in the list of compression codes until it discovers that 1010 is the compression code for t, so this character is written to the decompressed file, and so on. 5 Classed Provided You can download from the course s website all the classes described in this section. 5.1 Class TextFile This class provides methods for reading characters from a text file and for writing characters to a text file. This class provides the following public methods: TextFile (String filename, String filemode). Constructor for the class. The first parameter is the name of a text file. The second parameter can have two values "read" or "write". If filemode is "read" the text file will be opened in read mode; your compression algorithm will open the file in this mode to read the characters that will be compressed. If filemode is "write" a new file will be created and information can be written into it; your decompression algorithm will open the file in this mode so the decompressed text can be stored in it. char readchar(). This method reads and returns the next character from the text file. It returns (char)0 if the end of the file has been reached before invoking the method. String readline(). This method reads characters starting from the current position of the text file until the end of the line is reached. The string of characters read is returned as a result of invoking this method. It returns null if the end of the file has been reached before invoking this method. 2
3 String writechar(char c). This method writes the character c into the text file. close(). This method closes the text file. Important note. If you do not close the text file the information that you have written into it will not be stored in disk, so make it sure that you close the file once you have finished decompressing a file. Suppose, for example, that you wish to compress file "text.txt". To open the file you will use something like this: TextFile input = new TextFile("text.txt","read"); A character can then be read from the file by using code like this: nextchar = input.readchar(); where nextchar is a variable of type char. Let file "text.txt" consists of one line: Sample text Then nextchar = input.readchar(); will store S into nextchar. If now you perform line = input.readline(); where line is a variable of type String, then line will store the string "ample text". 5.2 Class CompressedFile This class provides methods for reading bits from a compressed file and for writing bits to a compressed file. This class provides the following public methods. CompressedFile(String filename, String filemode). Constructor for the class. The first parameter is the name of the compressed file. The second parameter is as in the constructor for class TextFile. char readbit(). Reads the next bit from the compressed file. Since bits are difficult to manipulate in Java, to make this assignment easier for you, bits read from the compressed file are converted to values of type char. Thie method returns (char)0 if the end of the file has been reached before invoking the method. writebit(char bit). As mentioned above, to make it easier for you in this assignment you will handlebits as if they werechars. Whenever you wishto writethebit 0 into thecompressed file, you will invoke this method as writechar( 0 ) and whenever you wish to write the bit 1 into the compressed file you will invoke the method as writebit( 1 );. Note that this class will convert 0 and 1 into bits 0 and 1 before they are written into the compressed file. close(). This method closes the compressed file. As mentioned above, if the compressed file is not closed, the information that was written in it will not be stored in disk. 6 List of Compression Codes As mentioned above your compression and decompression Java programs will receive as parameter the name of a file storing the compression codes for text characters. You can download this file from the course s website. This is a text file where each line is of the form ccompression code 3
4 where c is a single character and compression code is a String consisting of characters 0 and 1. Notice that there is no space between c and the compression code. For example, the following are three actual lines from this file a1000 t1010 e001 So character a is assigned code 1000, t has code 1010, and e has code 001. You will use class TextFile to read the contents of this file and store the list of compression codes in your program, as described below. 7 Classes to Implement You are to implement at least 4 Java classes: CodePair.java, ArrayCode.java, Compress.java, and Decompress.java. You can implement more classes if you need to. You must write all the code yourself. You cannot use code from the textbook, the Internet, or any other sources. 7.1 Class CodePair This class represents an entry in the list of codes, associating a character with a compression code. For this class, you must implement all and only the following public methods: public CodePair(Char c, String code). A constructor which returns a new CodePair object storing the specified character and compression code. This class will have two instance variables, one to store a character and the other to store a compression code. As mentioned above compression codes will be stored as Strings of 0 s and 1 s. public String getcode(). Returns the compression code stored in this CodePair object. public char getcharacter(). Returns the character in this CodePair object. public void setcharacter(char c). Stores the given character in this CodePair object. public void setcode(string code). Stores the given compression code in this CodePair object. public boolean equals (CodePair anotherpair). Returns true if this CodePair object has the same character as the character stored in anotherpair. You can implement any other methods that you want to in this class, but they must be declared as private methods (i.e. not accessible to other classes). 7.2 Class ArrayCode This class stores a list of characters and their compression codes. Each pair (character,compression code) will be stored in an object of class CodePair. The list, then, will be stored in an array of CodePair objects. This class will have an instance variable referencing this array. You might also want to use instance variables to store the size of the array and the number of CodePair objects that have been stored in it. For this class, you must implement all and only the following public methods: public ArrayCode (int size). This is the constructor for the class. When an object of this class is created an array of CodePair objects of the size specified in the parameter will be created. All instance variables in this class must be initialized here. 4
5 public void add (CodePair pair). Adds the given pair to the array of CodePairs. If the array is full before the new pair is added to it, then the capacity of the array needs to be expanded as follows: If the length or size of the array is at most 100, then the size of the array will be doubled. Look at the lecture notes to see how to expand the capacity of an array. If the size of the array is larger than 100, then the size of the array will increase by 20. public void remove (CodePair pairtoremove). Removes pairtoremove from the array. Note that someentries ofthearray needtobeshiftedforpairtoremovetobecorrectly removed from the array. Read the lecture notes to see how to remove information from an array. If pairtoremove is not in the array, then nothing needs to be removed. If after removing the specified object from the array the number of CodePair objects in the array is less than one fourth of the size of the array, then the size of the array must bedecreased by half. Note that this requires copying all values stored in the array into a new array of half of its size. public int findcode(string code). This method looks for the given code in the array. If the array contains a CodePair object with the given compression code, the position of this object in the array is returned. If no entry of the array stores the given compression code, this method must return the value -1. public int findcharacter(char c). This method looks for the given character in the array. If the array contains a CodePair object storing the given character, the position of this object in the array is returned. If no entry of the array stores the given character, this method must return the value -1. public String getcode(int i). This method returns the compression code in the CodePair object stored in the i-th position of the array. If there is no CodePair object stored in position i if the array (for example if i is negative or is larger than the number of items stored in the array) this method must return null. public char getcharacter(int i). This method returns the character in the CodePair object stored in the i-th position of the array. If there is no CodePair object stored in position i if the array this method must return the value 0 (null character). public int getsize(). This method returns the size or length of the array. public int getnumpairs(). This method returns the number of CodePair objects stored in the array. You can implement any other methods that you want to in this class, but they must be declared as private methods. 7.3 Class Compress This class contains a main method, declared with the usual method header: public static void main(string[] args) You can implement any other methods that you want to in this class, but they must be declared as private methods. The input to the program will consist of two files: a file to compress and a file containing the compression codes. The output will be the compressed file. In this class you must implement the algorithm described in Section 3. To execute your program from the command line you must type java Compress filename compressioncodesname 5
6 where filename is the name of the file to compress and compressioncodesname is the name of the file storing the compression codes. The compressed file must be stored in a file with the same name as the original one, but with extension.zzz. For example if the name of the input file is test.txt then the name of the compressed file must be test.zzz. If you are using Eclipse, you need to specify the names of the two input files in the list of program arguments of Eclipse. Please read the tutorials posted in the course s website ( to see how to do this. Note that you need to store the input files in the same folder where Eclipse has the src folder, otherwise Eclipse will not be able to find them. Note that within method main you can access the names of the two input files through the parameter args: args[0] stores the name of the first file and args[1] stores the name of the second file. For example, if the program is executed like this: java Compress text7.txt codes.txt Then we can, for example, print the names of the files from within method main as: public static void main(string[] args) { System.out.println("Name of file to compress: "+args[0]); System.out.println("Name of file storing compression codes: "+args[1]); To get the name of the output file you can use, for example, the following code: String outputname = args[0].substring(0, args[0].length() - 3) + "zzz"; Method substring will return the name of the input file (args[0]) minus its last 3 characters (that should contain the extension "txt). 7.4 Class Decompress This class also contains a main method. The input to this program will also consist of two files: a compressed file and a file containing the compression codes. The output will be the decompressed file. In this class you must implement the algorithm described in Section 4. To execute your program from the command line you must type java Decompress compressedfilename compressioncodesname where compressedfilename is the name of the file to decompress and compressioncodesname is as above. The decompressed file must be stored in a file with the same name as the original one, but with extension.dec. You can implement any other methods that you want to in this class, but they must be declared as private methods. 8 Testing your Program We will perform two kinds of tests on your program: (1) tests for your implementation of the classes ArrayCode and CodePair, and (2) tests for your file compressor and decompressor. For the first part we will run a test program called TestArray which checks whether your first two classes work as specified. We will supplyyou withacopy oftestarraysoyou can useit totest your implementation. For testing your file compressor we will give your program some input files, check the sizes of the compressed files, and then we will decompress them and verify that the original files are restored. You can use, for example, the cmp Linux utility to compare the original file with the decompressed one. By typing cmp file1 file2 6
7 the utility will report the first character where the two files differ, if any. If the files are identical, the utility terminates without producing any output. In Windows you can use the program fc to compare two files. 9 Non-Functional Specifications Assignments are to be done individually and must be your own work. Software will be used to detect cheating. Include comments in your code in javadoc format. Add javadoc comments at the beginning of your classes indicating who the author of the code is and a giving a brief description of the class. Add javadoc comments to methods and instance variables. Read information about javadoc in the second lab for this course. Add comments to explain the meaning of potentially confusing parts of your code. You need to use your own judgment here. If the meaning of a fragment of code is obvious, you do not need to add a comment. If someone other than you reading a fragment of code might struggle to understand how the code works, then write a comment. However, try to avoid meaningless comments like these: i = 1; // initialize the value of i to 1 i = i + 1; // increase the value of i if (i == j) // compare i and j Use Java coding conventions and good programming techniques, for example: 1. Use meaningful variable and method names. A name should help understand what a variable is used for or what a method does. Avoid the use of variable names without any meaning, like xxy, or names, like flower, that do not relate to the intended purpose of the variable or method. 2. Use consistent conventions for naming variables, methods, and classes. For example, you might decide that names of classes should start with a capital letter, while names of variables and methods should start with a lower case letter. Names that consist of two or more words like symbol and table can be combined, for example, using camelcasing (the words are concatenated, but the second word starts with a capital letter: symboltable) or they can be combined using underscores: symbol table. However, you need to be consistent. 3. Use consistent notation for naming constants. For example, you can use capital letters to denote constants and constant names composed of several words can be joined by underscores: TABLE SIZE. 4. Use constants where appropriate. 5. Readability. Use indentation, tabs, and white spaces in a consistent manner to improve the readability of your code. The body of a for loop statement, for example, should have a larger indentation than the statement itself: for (int i = 0; i < TABLE SIZE; ++i) table[i] = 0; Also, positioning of brackets, { and } to delimit blocks of code should be consistent. For example if you put an opening bracket at the end of the header of a method: private int findposition() { int position; 7
8 then you should not put the bracket in a separate line for a method: private String getname() { return personname; 10 Submitting your Work You MUST SUBMIT ALL YOUR JAVA classes to OWL. Make sure you attach all your.java files to your assignment. DO NOT put the code inline in the text-box. DO NOT put a package line at the top of your java files. DO NOT submit a compressed file (.zip,.tar,.gzip,...); SUBMIT ONLY.java files. Do not submit your.class files. If you do this and do not attach your.java files, you will receive a mark of zero! 11 Marking What You Will Be Marked On: 1. Functional specifications: Does the program behave according to specifications? Does it run with the test programs provided? Does it correctly compress and decompress a file? Are your classes implemented properly? Are you using appropriate data structures? Is the output according to specifications? 2. Non-functional specifications: as described above 12 Handing In Your Program To submit your program, login to OWL and submit your java files from there. If you re-submit your program after February 5 please send your instructor an message to let him know. The instructor will inform the TAs so they take the latest program submitted as the final version, and will deduct marks accordingly if it is late. 8
ASCII American Standard Code for Information Interchange. Text file is a sequence of binary digits which represent the codes for each character.
Project 2 1 P2-0: Text Files All files are represented as binary digits including text files Each character is represented by an integer code ASCII American Standard Code for Information Interchange Text
More informationCS 152 Computer Programming Fundamentals Coding Standards
CS 152 Computer Programming Fundamentals Coding Standards Brooke Chenoweth University of New Mexico Fall 2018 CS-152 Coding Standards All projects and labs must follow the great and hallowed CS-152 coding
More informationCS 251 Intermediate Programming Coding Standards
CS 251 Intermediate Programming Coding Standards Brooke Chenoweth University of New Mexico Fall 2018 CS-251 Coding Standards All projects and labs must follow the great and hallowed CS-251 coding standards.
More informationData Structures and Algorithms
Data Structures and Algorithms CS245-2015S-P2 Huffman Codes Project 2 David Galles Department of Computer Science University of San Francisco P2-0: Text Files All files are represented as binary digits
More informationASCII American Standard Code for Information Interchange. Text file is a sequence of binary digits which represent the codes for each character.
Project 2 1 P2-0: Text Files All files are represented as binary digits including text files Each character is represented by an integer code ASCII American Standard Code for Information Interchange Text
More informationCSE 11 Style Guidelines
CSE 11 Style Guidelines These style guidelines are based off of Google s Java Style Guide and Oracle s Javadoc Guide. Overview: Your style will be graded on the following items: File Headers Class Headers
More informationReadings for This Lecture
Lecture 4 Classes Readings for This Lecture Section 1.4, 1.5 in text Section 3.1 in text Plive activities referenced in the text Please look at lecture summaries online Handouts are short version Presentation
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationCS 351 Design of Large Programs Coding Standards
CS 351 Design of Large Programs Coding Standards Brooke Chenoweth University of New Mexico Spring 2018 CS-351 Coding Standards All projects and labs must follow the great and hallowed CS-351 coding standards.
More informationAnnouncements for the Class
Lecture 2 Classes Announcements for the Class Readings Section 1.4, 1.5 in text Section 3.1 in text Optional: PLive CD that comes with text References in text Assignment Assignment 1 due next week Due
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;
More informationGetting started with Java
Getting started with Java Magic Lines public class MagicLines { public static void main(string[] args) { } } Comments Comments are lines in your code that get ignored during execution. Good for leaving
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationAssignment Marking Criteria
Assignment Marking Criteria Analysis Your analysis documentation must meet the following criteria: All program inputs, processing, and outputs. Each input and output must be given a name and description
More informationSoftware and Programming 1
Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon
More informationHomework 3 Huffman Coding. Due Thursday October 11
Homework 3 Huffman Coding Due Thursday October 11 Huffman Coding Implement Huffman Encoding and Decoding and the classes shown on the following slides. You will also need to use Java s stack class HuffmanEncode
More informationProject #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently.
Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple magazine data system. Milestones:
More informationCoding Standards for Java
Why have coding standards? Coding Standards for Java Version 1.3 It is a known fact that 80% of the lifetime cost of a piece of software goes to maintenance; therefore, it makes sense for all programs
More informationCompSci 125 Lecture 02
Assignments CompSci 125 Lecture 02 Java and Java Programming with Eclipse! Homework:! http://coen.boisestate.edu/jconrad/compsci-125-homework! hw1 due Jan 28 (MW), 29 (TuTh)! Programming:! http://coen.boisestate.edu/jconrad/cs125-programming-assignments!
More information1B1b Classes in Java Part I
1B1b Classes in Java Part I Agenda Defining simple classes. Instance variables and methods. Objects. Object references. 1 2 Reading You should be reading: Part I chapters 6,9,10 And browsing: Part IV chapter
More informationLecture 02, Fall 2018 Friday September 7
Anatomy of a class Oliver W. Layton CS231: Data Structures and Algorithms Lecture 02, Fall 2018 Friday September 7 Follow-up Python is also cross-platform. What s the advantage of Java? It s true: Python
More information12/22/11. Java How to Program, 9/e. public must be stored in a file that has the same name as the class and ends with the.java file-name extension.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Covered in this chapter Classes Objects Methods Parameters double primitive type } Create a new class (GradeBook) } Use it to create an object.
More informationACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1
ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 Due to CMS by Tuesday, February 14. Social networking has caused a return of the dot-com madness. You want in on the easy money, so you have decided to make
More informationSoftware and Programming 1
Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 11 January 2018 SP1-Lab1-2017-18.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon
More information5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.
Today! Build HelloWorld yourself in BlueJ and Eclipse. Look at all the Java keywords. Primitive Types. HelloWorld in BlueJ 1. Find BlueJ in the start menu, but start the Select VM program instead (you
More informationCS 2210a Data Structures and Algorithms Assignment 5 Solving a Labyrinth Due Date: December 6, 11:59 pm Total marks: 20
CS 2210a Data Structures and Algorithms Assignment 5 Solving a Labyrinth Due Date: December 6, 11:59 pm Total marks: 20 1 Overview For this assignment you will write a program for finding an exit to a
More informationJava Programming Style Guide
Java Programming Style Guide Computer Science Program Cedarville University Goal: Our goal is to produce well-written code that can be easily understood and will facilitate life-cycle maintenance. These
More informationCMSC 201 Fall 2018 Python Coding Standards
CMSC 201 Fall 2018 Python Coding Standards The purpose of these coding standards is to make programs readable and maintainable. In the real world you may need to update your own code more than 6 months
More informationLab Exercise 6: Abstract Classes and Interfaces CS 2334
Lab Exercise 6: Abstract Classes and Interfaces CS 2334 September 29, 2016 Introduction In this lab, you will experiment with using inheritance in Java through the use of abstract classes and interfaces.
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationIntroduction Basic elements of Java
Software and Programming I Introduction Basic elements of Java Roman Kontchakov / Carsten Fuhs Birkbeck, University of London Module Information Time: Thursdays in the Spring term Lectures: MAL B04: 2
More informationNote: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.
Com S 227 Fall 2018 Miniassignment 1 40 points Due Date: Friday, October 12, 11:59 pm (midnight) Late deadline (25% penalty): Monday, October 15, 11:59 pm General information This assignment is to be done
More informationCT 229 Fundamentals of Java Syntax
CT 229 Fundamentals of Java Syntax 19/09/2006 CT229 New Lab Assignment Monday 18 th Sept -> New Lab Assignment on CT 229 Website Two Weeks for Completion Due Date is Oct 1 st Assignment Submission is online
More informationCSCI 2101 Java Style Guide
CSCI 2101 Java Style Guide Fall 2017 This document describes the required style guidelines for writing Java code in CSCI 2101. Guidelines are provided for four areas of style: identifiers, indentation,
More informationProject 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently.
Project 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple movie data system. Milestones: 1. Use
More informationCS 6353 Compiler Construction Project Assignments
CS 6353 Compiler Construction Project Assignments In this project, you need to implement a compiler for a language defined in this handout. The programming language you need to use is C or C++ (and the
More informationCSE 142/143 Unofficial Style Guide
CSE 142/143 Unofficial Style Guide Below, things in GREEN are GOOD; things in RED are to be AVOIDED. Commenting Comment well. Follow the commenting rules for header, method, field, and inside-method comments
More informationDo this by creating on the m: drive (Accessed via start menu link Computer [The m: drive has your login id as name]) the subdirectory CI101.
Creating and running a Java program. This tutorial is an introduction to running a computer program written in the computer programming language Java using the BlueJ IDE (Integrated Development Environment).
More informationWeek 3 Classes and Objects
Week 3 Classes and Objects written by Alexandros Evangelidis, adapted from J. Gardiner et al. 13 October 2015 1 Last Week Last week, we looked at some of the different types available in Java, and the
More informationDocumentation Requirements Computer Science 2334 Spring 2016
Overview: Documentation Requirements Computer Science 2334 Spring 2016 These requirements are based on official Java coding conventions but have been adapted to be more appropriate to an academic environment.
More informationTips from the experts: How to waste a lot of time on this assignment
Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be
More informationASSIGNMENT 5 Objects, Files, and a Music Player
ASSIGNMENT 5 Objects, Files, and a Music Player COMP-202A, Fall 2009, All Sections Due: Thursday, December 3, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified, you
More informationBM214E Object Oriented Programming Lecture 8
BM214E Object Oriented Programming Lecture 8 Instance vs. Class Declarations Instance vs. Class Declarations Don t be fooled. Just because a variable might be declared as a field within a class that does
More informationCS 211 Programming Practicum Spring 2017
Due: Tuesday, 3/28/17 at 11:59 pm Infix Expression Evaluator Programming Project 5 For this lab, write a JAVA program that will evaluate an infix expression. The algorithm REQUIRED for this program will
More informationEE 422C HW 6 Multithreaded Programming
EE 422C HW 6 Multithreaded Programming 100 Points Due: Monday 4/16/18 at 11:59pm Problem A certain theater plays one show each night. The theater has multiple box office outlets to sell tickets, and the
More informationObjectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java
Introduction Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2 Problem Solving The purpose of writing a program is to solve a problem
More informationComp151 Lab Documentation using Doxygen
Comp151 Lab Documentation using Doxygen Supplementary Notes By Adam Information in this slide is extracted from Doxygen homepage: http://www.stack.nl/~dimitri/doxygen/ and Javadoc reference: http://java.sun.com/j2se/javadoc/writingdoccomments/
More informationProject #1 Computer Science 2334 Fall 2008
Project #1 Computer Science 2334 Fall 2008 User Request: Create a Word Verification System. Milestones: 1. Use program arguments to specify a file name. 10 points 2. Use simple File I/O to read a file.
More informationNote: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.
Com S 227 Spring 2018 Miniassignment 1 40 points Due Date: Thursday, March 8, 11:59 pm (midnight) Late deadline (25% penalty): Friday, March 9, 11:59 pm General information This assignment is to be done
More informationJava Style Guide. 1.0 General. 2.0 Visual Layout. Dr Caffeine
September 25, 2002 Java Style Guide Dr Caffeine This document defines the style convention the students must follow in submitting their programs. This document is a modified version of the document originally
More informationCE221 Programming in C++ Part 1 Introduction
CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab
More informationAssoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba Laboratory Session: Exercises on classes Analogy to help you understand classes and their contents. Suppose you want to drive a car and make it go faster by pressing down
More informationObject oriented programming. Instructor: Masoud Asghari Web page: Ch: 3
Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning
More informationDue: 9 February 2017 at 1159pm (2359, Pacific Standard Time)
CSE 11 Winter 2017 Program Assignment #2 (100 points) START EARLY! Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time) PROGRAM #2: DoubleArray11 READ THE ENTIRE ASSIGNMENT BEFORE STARTING In lecture,
More informationCS337 Project 1 : Compression
CS337 Project 1 : Compression TA: Yan Li (yanli@cs.utexas.edu) Due Date: Sept. 29, 2008 11:59PM 1 Part 1: Lower Bound of Lossless Compression 1.1 Description Given a text file, which contains only ASCII
More informationCS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM
CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM Objectives Defining a wellformed method to check class invariants Using assert statements to check preconditions,
More informationCS1114: Matlab Introduction
CS1114: Matlab Introduction 1 Introduction The purpose of this introduction is to provide you a brief introduction to the features of Matlab that will be most relevant to your work in this course. Even
More informationFall 2017 CISC124 9/16/2017
CISC124 Labs start this week in JEFF 155: Meet your TA. Check out the course web site, if you have not already done so. Watch lecture videos if you need to review anything we have already done. Problems
More informationASSIGNMENT 5 Objects, Files, and More Garage Management
ASSIGNMENT 5 Objects, Files, and More Garage Management COMP-202B, Winter 2010, All Sections Due: Wednesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified,
More informationCOMP-202 Unit 2: Java Basics. CONTENTS: Using Expressions and Variables Types Strings Methods
COMP-202 Unit 2: Java Basics CONTENTS: Using Expressions and Variables Types Strings Methods Assignment 1 Assignment 1 posted on WebCt and course website. It is due May 18th st at 23:30 Worth 6% Part programming,
More informationBASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I
BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment
More informationCS 152: Data Structures with Java Hello World with the IntelliJ IDE
CS 152: Data Structures with Java Hello World with the IntelliJ IDE Instructor: Joel Castellanos e-mail: joel.unm.edu Web: http://cs.unm.edu/~joel/ Office: Electrical and Computer Engineering building
More informationProject 1. Java Control Structures 1/17/2014. Project 1 and Java Intro. Project 1 (2) To familiarize with
Project 1 and Java Intro Sharma Chakravarthy Information Technology Laboratory (IT Lab) Computer Science and Engineering Department The University of Texas at Arlington, Arlington, TX 76019 Email: sharma@cse.uta.edu
More informationCIS 121 Data Structures and Algorithms with Java Spring 2018
CIS 121 Data Structures and Algorithms with Java Spring 2018 Homework 2 Thursday, January 18 Due Monday, January 29 by 11:59 PM 7 Required Problems (85 points), and Style and Tests (15 points) DO NOT modify
More informationCS 231 Data Structures and Algorithms, Fall 2016
CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard
More informationCS 6353 Compiler Construction Project Assignments
CS 6353 Compiler Construction Project Assignments In this project, you need to implement a compiler for a language defined in this handout. The programming language you need to use is C or C++ (and the
More informationNote : Your program must contain the following 6 functions :
Fall 2018 - CS1428 Programming Assignment 6 Due Date : Wednesday November 7 th - 2018 Sections 3 and 4 Write a menu driven C++ program that prints the day number of the year, given the date in the form
More informationAnnouncements. 1. Forms to return today after class:
Announcements Handouts (3) to pick up 1. Forms to return today after class: Pretest (take during class later) Laptop information form (fill out during class later) Academic honesty form (must sign) 2.
More informationLecture 10 Declarations and Scope
Lecture 10 Declarations and Scope Declarations and Scope We have seen numerous qualifiers when defining methods and variables public private static final (we'll talk about protected when formally addressing
More informationIdentifiers and Variables
Identifiers and Variables Lecture 4 Based on Slides of Dr. Norazah Yusof 1 Identifiers All the Java components classes, variables, and methods need names. In Java these names are called identifiers, and,
More informationMcGill University School of Computer Science COMP-202A Introduction to Computing 1
McGill University School of Computer Science COMP-202A Introduction to Computing 1 Midterm Exam Thursday, October 26, 2006, 18:00-20:00 (6:00 8:00 PM) Instructors: Mathieu Petitpas, Shah Asaduzzaman, Sherif
More informationProgramming Assignment 1: CS11TurtleGraphics
Programming Assignment 1: CS11TurtleGraphics Due: 11:59pm, Thursday, October 5 Overview You will use simple turtle graphics to create a three-line drawing consisting of the following text, where XXX should
More informationCS11 Java. Fall Lecture 1
CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon
More informationCircular Linked List Assignment
Page 1 of 6 Circular Linked List Assignment Overview A circular linked list is essentially a singly linked list in which the next pointer of the tail node is set to point to the head node of the linked
More informationECE 122 Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Introduction to Programming for ECE Lecture 1 Course Overview Welcome! What is this class about? Java programming somewhat software somewhat Solving engineering
More informationLab 5: Java IO 12:00 PM, Feb 21, 2018
CS18 Integrated Introduction to Computer Science Fisler, Nelson Contents Lab 5: Java IO 12:00 PM, Feb 21, 2018 1 The Java IO Library 1 2 Program Arguments 2 3 Readers, Writers, and Buffers 2 3.1 Buffering
More informationCS18000: Problem Solving And Object-Oriented Programming
CS18000: Problem Solving And Object-Oriented Programming Class (and Program) Structure 31 January 2011 Prof. Chris Clifton Classes and Objects Set of real or virtual objects Represent Template in Java
More informationC++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace
C++ Style Guide 1.0 General The purpose of the style guide is not to restrict your programming, but rather to establish a consistent format for your programs. This will help you debug and maintain your
More informationcoe318 Lab 1 Introduction to Netbeans and Java
coe318 Lab 1 Week of September 12, 2016 Objectives Lean how to use the Netbeans Integrated Development Environment (IDE). Learn how to generate and write formatted API documentation. Add a constructor,
More informationTips from the experts: How to waste a lot of time on this assignment
Com S 227 Spring 2017 Assignment 1 80 points Due Date: Thursday, February 2, 11:59 pm (midnight) Late deadline (25% penalty): Friday, February 3, 11:59 pm General information This assignment is to be done
More informationSection 2: Introduction to Java. Historical note
The only way to learn a new programming language is by writing programs in it. - B. Kernighan & D. Ritchie Section 2: Introduction to Java Objectives: Data Types Characters and Strings Operators and Precedence
More informationProgramming Assignment 8 ( 100 Points )
Programming Assignment 8 ( 100 Points ) Due: 11:59pm Wednesday, November 22 Start early Start often! README ( 10 points ) You are required to provide a text file named README, NOT Readme.txt, README.pdf,
More informationJava Program Coding Standards Programming for Information Technology
Java Program Coding Standards 4002-217-9 Programming for Information Technology Coding Standards: You are expected to follow the standards listed in this document when producing code for this class. Whether
More informationICOM 4015-Advanced Programming. Spring Instructor: Dr. Amir H. Chinaei. TAs: Hector Franqui, Jose Garcia, and Antonio Tapia. Reference: Big Java
ICOM 4015-Advanced Programming Spring 2014 Instructor: Dr. Amir H. Chinaei TAs: Hector Franqui, Jose Garcia, and Antonio Tapia Reference: Big Java By Hortsmann, Ed 4 Lab 7 Continuation of HTTP and Introduction
More informationSchool of Informatics, University of Edinburgh
CS1Bh Practical 1 Words and Sentences This is an individual practical exercise which requires you to submit some Java programs and some text files for assessment. A system which measures software similarity
More informationCS 211 Programming Practicum Fall 2018
Due: Wednesday, 11/7/18 at 11:59 pm Infix Expression Evaluator Programming Project 5 For this lab, write a C++ program that will evaluate an infix expression. The algorithm REQUIRED for this program will
More informationChapter 4 Defining Classes I
Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the
More informationAdvanced Object Oriented Programming EECS2030Z
Advanced Object Oriented Programming EECS2030Z 1 Academic Support Programs: Bethune having trouble with your FSC and LSE courses? consider using the Academic Support Programs at Bethune College PASS free,
More informationTips from the experts: How to waste a lot of time on this assignment
Com S 227 Spring 2018 Assignment 1 80 points Due Date: Friday, February 2, 11:59 pm (midnight) Late deadline (25% penalty): Monday, February 5, 11:59 pm General information This assignment is to be done
More informationICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit
ICOM 4015 Advanced Programming Laboratory Chapter 1 Introduction to Eclipse, Java and JUnit University of Puerto Rico Electrical and Computer Engineering Department by Juan E. Surís 1 Introduction This
More informationShell Interface Assignment
Page 1 of 9 Shell Interface Assignment Creating a Shell Interface Using Java This assignment consists of modifying a Java program so that it serves as a shell interface that accepts user commands and then
More informationEnums. In this article from my free Java 8 course, I will talk about the enum. Enums are constant values that can never be changed.
Enums Introduction In this article from my free Java 8 course, I will talk about the enum. Enums are constant values that can never be changed. The Final Tag To display why this is useful, I m going to
More informationLibSerial Documentation
LibSerial Documentation Release 1.0.0rc1 CrayzeeWulf Apr 05, 2018 Contents: 1 Feature Summary 3 2 Description 5 3 Download 7 4 Install 9 5 Tutorial 11 5.1 Opening a Serial Port I/O Stream....................................
More information16-Dec-10. Consider the following method:
Boaz Kantor Introduction to Computer Science IDC Herzliya Exception is a class. Java comes with many, we can write our own. The Exception objects, along with some Java-specific structures, allow us to
More informationChapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing
Introduction 1 Chapter 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design 2007 Pearson Addison-Wesley. All rights reserved Focus of the Course Object-Oriented Software Development
More informationJOSE LUIS JUAREZ VIVEROS com) has a. non-transferable license to use this Student Guide
Module 3 Identifiers, Keywords, and Types Objectives Upon completion of this module, you should be able to: Use comments in a source program Distinguish between valid and invalid identifiers Recognize
More informationOne of Mike s early tests cases involved the following code, which produced the error message about something being really wrong:
Problem 1 (3 points) While working on his solution to project 2, Mike Clancy encountered an interesting bug. His program includes a LineNumber class that supplies, among other methods, a constructor that
More informationOregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011
Oregon State University School of Electrical Engineering and Computer Science CS 261 Recitation 1 Spring 2011 Outline Using Secure Shell Clients GCC Some Examples Intro to C * * Windows File transfer client:
More informationCS 101 Fall 2006 Midterm 1 Name: ID:
You only need to write your name and e-mail ID on the first page. This exam is CLOSED text book, closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure
More informationChapter 15: Object Oriented Programming
Chapter 15: Object Oriented Programming Think Java: How to Think Like a Computer Scientist 5.1.2 by Allen B. Downey How do Software Developers use OOP? Defining classes to create objects UML diagrams to
More information