Repetition Using the End of File Condition

Size: px
Start display at page:

Download "Repetition Using the End of File Condition"

Transcription

1 Repetition Using the End of File Condition Quick Start Compile step once always javac Scan4.java mkdir labs cd labs Execute step mkdir 4 java Scan4 cd 4 cp /samples/csc/156/labs/4/*. Submit step emacs Scan4.java & submit csc156abc 4 Problem Statement and Specifications This assignment continues our study of String and double objects as well as the use of input files. This program will use repetition, but not selection. Files come in two varieties: sequential access files and direct access files. Basically, the files used in this course (for input, output or source code) are sequential access files. These files have their data separated into records or lines and we process the records (lines) in the order in which they are stored. Databases use direct access files. These files have their data separated into records, but we access the records in a random order. Think of the database that contains student data for enrollment at our school. The staff member at the registration window has no knowledge of how registrants will approach the window, and so the records in the database are accessed in an unpredictable order. The means by which we implement these features into our files is that with direct access files, we require that every record be the same size. Since this must be large enough to accommodate the largest record, each record must be the same size as the largest record regardless of how much or how little data is stored in that record. Sequential access files do not require this feature, so every line in our input or source files can have a different length than every other line. Direct access files are beyond the scope of our course, but databases are the original computer application and they have continued to play an important role in computing from its earliest days to the present. Assignment 4 Statement: Write a program in a file named Scan4.java that reads the inventory for a hardware store from a sequential access file named scan.txt. Each line of the input file contains a String and a double separated by a blank character (you are guaranteed that the String has no embedded blanks). The String value should be interpreted as the name of a tool and the double value should be interpreted as the price of that tool. Your program should display each line of the file on the monitor using appropriate formatting. When all of the lines of the file have been processed, display the total number of tools in the file and the sum of all of the costs for all of the tools that were stored in the file. All output for this program should be displayed on the monitor. Since the input String will not contain embedded blanks, we can use the methods of the Scanner class for input from scan.txt. Associated with this solution is the use of a List Reduction Algorithm that takes a list of 1

2 CSC Assignment 4 Scan numbers and accumulates them one at a time. The algorithm requires a repetition structure so that we can visit every element in the list. It can be described in the following steps. I. initialize an accumulator to 0 II. loop to visit each list element III. update the accumulator as you visit each list element We ll use this algorithm to accumulate the double value that is stored on each line. Assignment 4 Specifications: Input Read a tool name and a tool cost from the input file scan.txt Output Display on the monitor the tool name and tool cost for each input line Output Display on the monitor the total number of tools and the total costs of all the tools Object Analysis and Algorithmic Development We ll need at least a String and a double object to read the data in from the file. In addition, we ll need a Scanner wrapped around a FileReader to connect to our input file. Finally, we ll need another double to accumulate the tool prices that are stored in the file as well as an int to accumulate the number of tools in the file. Let s start our algorithmic development at the usual place. 1. Input 2. Process 3. Output We ll need to do some preparation for the input in that we ll need to connect to the file and we ll also need to initialize our accumulators for the List Reduction Algorithm described above. In order to process every line within the file without knowing how many lines are in the file, we ll need to implement an end-of-file loop. This is accommodated by entering a loop that is controlled by the Scanner wrapped around a FileReader.hasNext() method. Within that loop, we ll need to read the first line of the file, and then update our accumulators and display the current input line before we attempt to read another line from the file. After the loop, we simply display our accumulators with appropriate labels. Our algorithm is looking like the following sequence. 1. process declare and initialize file variables 2. process declare and initialize input and accumulator variables 3. output display a descriptive message about the program and the output headings 4. process determine if the Scanner.hasNext() condition is true (a) input read the String item and the double cost from the current input line (b) process to update the total cost of the tools (c) process to update the total number of tools (d) output display the tool item and the tool cost for the current input line 5. output the total cost and the total number of tools in the file 2

3 6. process disconnect from the input file CSC Assignment 4 Scan Steps 4.(a), through 4.(d) are indented since they will be repeated for each line of input in the file scan.txt. Our final algorithm, with some renumbering, will look like the following. Note that lines in blue represent areas of code that require you to modify or write code to complete the assignment. Statement Data objects 1) connect the input file object to scan.txt Scanner wrapped around a FileReader objects and String constants 2) declare variables and initialize accumulators to 0 String, double and int objects and constants 3) display a descriptive message and headings String constants 4) test the Scanner wrapped around a boolean method and Scanner wrapped FileReader.hasNext() condition around a FileReader object 5) input the item and cost from the file Scanner wrapped around a FileReader, String and double objects 6) update the total cost double objects 7) update the total number of tools int object and constant 8) display the current tool and its cost Scanner wrapped around a FileReader, String and double objects and String constants 9) display the total number of tool costs and the total double and int objects and String constants number of tools 10) disconnect from the input file Scanner wrapped around a FileReader object and close() method Just to clarify matters, Step 5 through Step 8 are in the while loop determined at Step 4. Coding for Compilation Logon to your csc.oakton.edu account and create a new subdirectory of the labs directory called 4 to work on your assignment. cd labs mkdir 4 cd 4 The documentation for this algorithm has already been included in the file /samples/csc/156/labs/4/scan4.java that you can copy over to your local directory by issuing the following cp command. cp /samples/csc/156/labs/4/scan4.java. emacs Scan4.java & Declaration of Variables The declarations of the String, double and int variables is pretty straight forward. When it comes to the Scanner wrapped around a FileReader objects, we ll delve into that as we discuss the pseudo-code. 3

4 Follow the Pseudo Code Step 1 // connect the input file object to scan.txt CSC Assignment 4 Scan In order to use the Scanner methods for input, we ll need to use the "scan.txt" to initialize a FileReader object and we ll then wrap a Scanner object around that object. The following code will do the job for us. Scanner fin = new Scanner(new FileReader("scan.txt"); Step 2 // declare variables and initialize accumulators to 0 These are variable declarations for the input values and accumulators and two assignment statements, one of which initializes the double accumulator to 0.0 and the other initializes the int accumulator to 0. Code these statements before continuing. Step 3 // display a descriptive message and the headings These are simply output statements that describe the program as is displayed in the sample output. You should also include the headings for the data that will be printed out in the input loop at Step 4. Code these statements before continuing. Step 4 // test the end of file condition The style of loop that we re interested in using at this point in our algorithm is referred to as a while statement and it has some features that are particularly attractive for this exercise. It s general format is the following. while ( boolean expression ) { statement 1 ; statement 2 ; }. statement m ; It is assumed that the boolean expression is initialized before the loop (in our algorithm, this is Step 4) and is updated somewhere within the middle of the loop (in our algorithm, this is Step 9). This statement will continue to loop as long as the value returned from fin.hasnext() is true. The next 4 steps of the algorithm should be embedded within this loop. Step 5 // input the first tool item and cost from the file Each line of the input file scan.txt separates the String tool name from the double tool cost with the char value of a blank, ( ). There is a guarantee in this program that the tool s item name will not contain any embedded blanks. Anything after the blank ( ) is then guaranteed to be the cost of the item. So, our goal is to read either character data until we reach the char value of assuming that everything that was read represents the tool item. We can follow that input with the input of the cost. The means by which we can do this from the file is with the usual input method fin.next() as this will not read blanks and will stop an input operation whenever it encounters white space (i.e. a blank ( ), tab ( \t ) or newline ( \n )). Following this operation with an invocation of fin.nextdouble() will provide appropriate support for our input needs. 4

5 Steps 6-7 // update the total cost // update the total number of tools CSC Assignment 4 Scan These update operations simply increase the double accumulator by the cost of the current tool and increase the int accumulator by 1. Code these assignment statements before continuing. Step 8 // display the current tool and its cost This is simply a formatted output statement that displays the current tool and the current tool s cost. Code this statement before continuing. Step 9 // display the total number of tools and the total of the costs of the tools This is a formatted output statement that displays the accumulators that were updated at Steps 6-7. Examine the sample output to inspect a full credit solution. Step 10 // disconnect from the input file The Scanner wrapped around a FileReader objects support a method that represents the correct means to disconnect from a file. This is more important for output files as we often need to flush data from the logical buffer into the physical file before we disconnect. However, it is good form to do so when we are done with our files. The following statement should be coded before the end of your program. fin.close() Checkpoint We re done, at this point, so save your program to disk by choosing the Save command from the Files menu of your emacs session. Then, compile your program by choosing the Compile... command from the Tools menu and change the make -k that is displayed to javac Scan4.java. Compiler errors can be parsed with the keystroke C-x and need to be repaired before your program can execute. When your program has compiled, click on your xterm window to access your command line prompt, and issue the command java Scan4. Once again, your output should be identical to the sample output. Testing for errors The types of errors that can occur in this program have to do with either the input or the updates to the accumulators. The most common type of error is misspelling the name of the input file scan.txt when the Scanner wrapped around a FileReader object fin is initialized. You might also want to use the ls command to make sure that scan.txt is in the directory that your working in. This should have happened when you issued the following command. cp /samples/csc/156/labs/4/*. We ve displayed this statement in red to indicate that you do not want to issue it more than one time. If your input file scan.txt is not in your current directory, issue the following command. 5

6 CSC Assignment 4 Scan cp /samples/csc/156/labs/4/scan.txt. Other areas where errors can occur have to do with the inappropriate placement of the input statements or the incorrect updates to the accumulator variables. Make sure that your code follows the algorithm that we ve discussed to correct any logic errors. Printing and submitting Once you are satisfied with the correctness of your program, print it as you did with previous assignments by using the following command that assumes that you are working in the room 1234 at Oakton. Retrieve your copy from the printer. printer 1234 Scan4.java Finally, submit your program with the following command that assumes that you are registered in section abc of CSC 156. submit csc156abc 4 6

Repetitive Program Execution

Repetitive Program Execution Repetitive Program Execution Quick Start Compile step once always mkdir labs javac Vowel3java cd labs mkdir 3 Execute step cd 3 java Vowel3 cp /samples/csc/156/labs/3/* Submit step emacs Vowel3java & submit

More information

Arrays & Classes. Problem Statement and Specifications

Arrays & Classes. Problem Statement and Specifications Arrays & Classes Quick Start Compile step once always make -k baseball8 mkdir labs cd labs Execute step mkdir 8 java Baseball8 cd 8 cp /samples/csc/156/labs/8/*. Submit step emacs Player.java & submit

More information

Graphics User Defined Forms, Part I

Graphics User Defined Forms, Part I Graphics User Defined Forms, Part I Quick Start Compile step once always mkdir labs javac PropertyTax5.java cd labs mkdir 5 Execute step cd 5 java PropertyTax5 cp /samples/csc/156/labs/5/*. cp PropertyTax1.java

More information

GUI Forms and Events, Part II

GUI Forms and Events, Part II GUI Forms and Events, Part II Quick Start Compile step once always mkdir labs javac PropertyTax6.java cd labs Execute step mkdir 6 java PropertyTax6 cd 6 cp../5/propertytax5.java PropertyTax6.java Submit

More information

GUI, Events and Applets from Applications, Part III

GUI, Events and Applets from Applications, Part III GUI, Events and Applets from Applications, Part III Quick Start Compile step once always javac PropertyTax6.java mkdir labs cd labs Execute step mkdir 6 appletviewer PropertyTax6.htm cd 6 emacs PropertyTax6.htm

More information

Sequential Program Execution

Sequential Program Execution Sequential Program Execution Quick Start Compile step once always g++ -o Realtor1 Realtor1.cpp mkdir labs cd labs Execute step mkdir 1 Realtor1 cd 1 cp../0/realtor.cpp Realtor1.cpp Submit step cp /samples/csc/155/labs/1/*.

More information

Editing, Compiling, Executing and Submitting Programs

Editing, Compiling, Executing and Submitting Programs Editing, Compiling, Executing and Submitting Programs Quick Start Compile step once always mkdir labs javac Realtor.java cd labs mkdir 0 Execute step java Realtor cd 0 Submit step emacs Realtor.java &

More information

This is a combination of a programming assignment and ungraded exercises

This is a combination of a programming assignment and ungraded exercises CSE 11 Winter 2017 Programming Assignment #1 Covers Chapters: ZY 1-3 START EARLY! 100 Pts Due: 25 JAN 2017 at 11:59pm (2359) This is a combination of a programming assignment and ungraded exercises Exercises

More information

Using the Zoo Workstations

Using the Zoo Workstations Using the Zoo Workstations Version 1.86: January 16, 2014 If you ve used Linux before, you can probably skip many of these instructions, but skim just in case. Please direct corrections and suggestions

More information

CMPSC 111 Introduction to Computer Science I Fall 2016 Lab 2 Assigned: September 7, 2016 Due: Wednesday, September 14, 2016 by 2:30 pm

CMPSC 111 Introduction to Computer Science I Fall 2016 Lab 2 Assigned: September 7, 2016 Due: Wednesday, September 14, 2016 by 2:30 pm 1 Objectives CMPSC 111 Introduction to Computer Science I Fall 2016 Lab 2 Assigned: September 7, 2016 Due: Wednesday, September 14, 2016 by 2:30 pm To develop a template for a Java program to use during

More information

COMP 110 Project 1 Programming Project Warm-Up Exercise

COMP 110 Project 1 Programming Project Warm-Up Exercise COMP 110 Project 1 Programming Project Warm-Up Exercise Creating Java Source Files Over the semester, several text editors will be suggested for students to try out. Initially, I suggest you use JGrasp,

More information

First Java Program - Output to the Screen

First Java Program - Output to the Screen First Java Program - Output to the Screen These notes are written assuming that the reader has never programmed in Java, but has programmed in another language in the past. In any language, one of the

More information

Project 1: Scheme Pretty-Printer

Project 1: Scheme Pretty-Printer Project 1: Scheme Pretty-Printer CSC 4101, Fall 2017 Due: 7 October 2017 For this programming assignment, you will implement a pretty-printer for a subset of Scheme in either C++ or Java. The code should

More information

Introduction to Java. Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords

Introduction to Java. Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords Introduction to Java Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords Program Errors Syntax Runtime Logic Procedural Decomposition Methods Flow of Control

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. 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 information

Once you login, you are taken to your User Profile Page with a few tabs at the top of the page

Once you login, you are taken to your User Profile Page with a few tabs at the top of the page To Launch into a Class and Lab Login Login at the web address: https://centriq.learnondemand.net Enter -- Username: firstname.lastname 1 Password: Premier12 Once you login, you are taken to your User Profile

More information

LAB K Basic Verilog Programming

LAB K Basic Verilog Programming LAB K Basic Verilog Programming Perform the following groups of tasks: LabK1.v 1. Create a directory to hold the files of this lab. 2. Launch your favourite editor and a command-prompt console; you will

More information

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments. Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started

More information

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

Lesson 10: Quiz #1 and Getting User Input (W03D2) Lesson 10: Quiz #1 and Getting User Input (W03D2) Balboa High School Michael Ferraro September 1, 2015 1 / 13 Do Now: Prep GitHub Repo for PS #1 You ll need to submit the 5.2 solution on the paper form

More information

Programming Assignment 2 ( 100 Points )

Programming Assignment 2 ( 100 Points ) Programming Assignment 2 ( 100 Points ) Due: Thursday, October 16 by 11:59pm This assignment has two programs: one a Java application that reads user input from the command line (TwoLargest) and one a

More information

2.8. Decision Making: Equality and Relational Operators

2.8. Decision Making: Equality and Relational Operators Page 1 of 6 [Page 56] 2.8. Decision Making: Equality and Relational Operators A condition is an expression that can be either true or false. This section introduces a simple version of Java's if statement

More information

Temple University Computer Science Programming Under the Linux Operating System January 2017

Temple University Computer Science Programming Under the Linux Operating System January 2017 Temple University Computer Science Programming Under the Linux Operating System January 2017 Here are the Linux commands you need to know to get started with Lab 1, and all subsequent labs as well. These

More information

Full file at

Full 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 information

CS 6353 Compiler Construction Project Assignments

CS 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 information

November 5th and 6th, Creating Custom Screens & Fields

November 5th and 6th, Creating Custom Screens & Fields November 5th and 6th, 2007 Creating Custom Screens & Fields A quick preview of what we ll cover. 2 What information do you need to keep track of? Immunization New Student Enrollments Storm Home Data A

More information

Check out how to use the random number generator (introduced in section 4.11 of the text) to get a number between 1 and 6 to create the simulation.

Check out how to use the random number generator (introduced in section 4.11 of the text) to get a number between 1 and 6 to create the simulation. Chapter 4 Lab Loops and Files Lab Objectives Be able to convert an algorithm using control structures into Java Be able to write a while loop Be able to write an do-while loop Be able to write a for loop

More information

CMSC 201 Fall 2018 Lab 04 While Loops

CMSC 201 Fall 2018 Lab 04 While Loops CMSC 201 Fall 2018 Lab 04 While Loops Assignment: Lab 04 While Loops Due Date: During discussion, September 24 th through September 27 th Value: 10 points (8 points during lab, 2 points for Pre Lab quiz)

More information

12/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.

12/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 information

When you first start OneNote, it creates a sample notebook for you. You can use this notebook or quickly create your own.

When you first start OneNote, it creates a sample notebook for you. You can use this notebook or quickly create your own. Basic tasks in Microsoft OneNote 2013 OneNote is a digital notebook that provides a single place for all of your notes and information everything you need to remember and manage in your life at home, at

More information

last time in cs recitations. computer commands. today s topics.

last time in cs recitations. computer commands. today s topics. last time in cs1007... recitations. course objectives policies academic integrity resources WEB PAGE: http://www.columbia.edu/ cs1007 NOTE CHANGES IN ASSESSMENT 5 EXTRA CREDIT POINTS ADDED sign up for

More information

Intermediate Programming, Spring Misha Kazhdan

Intermediate Programming, Spring Misha Kazhdan 600.120 Intermediate Programming, Spring 2017 Misha Kazhdan Outline Unix/Linux command line Basics of the Emacs editor Compiling and running a simple C program Cloning a repository Connecting to ugrad

More information

Getting started with Hugs on Linux

Getting started with Hugs on Linux Getting started with Hugs on Linux CS190 Functional Programming Techniques Dr Hans Georg Schaathun University of Surrey Autumn 2008 Week 1 Dr Hans Georg Schaathun Getting started with Hugs on Linux Autumn

More information

Introduction to Java Applications

Introduction to Java Applications 2 Introduction to Java Applications OBJECTIVES In this chapter you will learn: To write simple Java applications. To use input and output statements. Java s primitive types. Basic memory concepts. To use

More information

IT 374 C# and Applications/ IT695 C# Data Structures

IT 374 C# and Applications/ IT695 C# Data Structures IT 374 C# and Applications/ IT695 C# Data Structures Module 2.1: Introduction to C# App Programming Xianrong (Shawn) Zheng Spring 2017 1 Outline Introduction Creating a Simple App String Interpolation

More information

Programming Assignment 3 ( 100 Points ) START EARLY!

Programming Assignment 3 ( 100 Points ) START EARLY! Programming Assignment 3 ( 100 Points ) Due: 11:59pm Thursday, October 19 START EARLY! This programming assignment has two programs: 1) a Java application (HourGlass) that displays an hourglass shape on

More information

CS 6353 Compiler Construction Project Assignments

CS 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 information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All rights reserved. Java application A computer program that executes when you use the java command to launch the Java Virtual Machine

More information

Computer lab information. TAOP24, Advanced course on optimization

Computer lab information. TAOP24, Advanced course on optimization Linkping University April 26, 2017 Department of Mathematics Division of Optimization Oleg Burdakov Computer lab information TAOP24, Advanced course on optimization 1 General information Three computer

More information

TLMC SHORT CLASS: THESIS FORMATTING

TLMC SHORT CLASS: THESIS FORMATTING Table of Contents Introduction... 2 Getting Help... 2 Tips... 2 Working with Styles... 3 Applying a Style... 3 Creating A New Style... 3 Setting Margins... 4 Adding Page Numbers... 5 Step 1: Using Sections

More information

Programming and Data Structure Laboratory (CS13002)

Programming and Data Structure Laboratory (CS13002) Programming and Data Structure Laboratory (CS13002) Dr. Sudeshna Sarkar Dr. Indranil Sengupta Dept. of Computer Science & Engg., IIT Kharagpur 1 Some Rules to be Followed Attendance is mandatory. Regular

More information

CSC 112 Lab 1: Introduction to Unix and C++ Fall 2009

CSC 112 Lab 1: Introduction to Unix and C++ Fall 2009 CSC 112 Lab 1: Introduction to Unix and C++ Fall 2009 Due: Friday, September 4 th, 9:00am Introduction The operating system of a computer is the coordinator of all of the computer s activities, including

More information

Lec 3. Compilers, Debugging, Hello World, and Variables

Lec 3. Compilers, Debugging, Hello World, and Variables Lec 3 Compilers, Debugging, Hello World, and Variables Announcements First book reading due tonight at midnight Complete 80% of all activities to get 100% HW1 due Saturday at midnight Lab hours posted

More information

CS4023 Week04 Lab Exercise

CS4023 Week04 Lab Exercise CS4023 Week04 Lab Exercise Lab Objective: We will use this lab to log in to our Linux accounts and to look at some simple programs that perform a few elementary system calls. By the end of the lab we will

More information

Deliverables. Problem Description

Deliverables. Problem Description Deliverables Programming Project: GridWorld Due dates: Part I: June 28 at the beginning of class (hardcopy) Part II: Jun 5 at the beginning of class (electronic submission) In this project you will design

More information

Lesson 04: Our First Java Program (W01D4

Lesson 04: Our First Java Program (W01D4 Lesson 04: Our First Java Program (W01D4) Balboa High School Michael Ferraro Lesson 04: Our First Java Program (W01D4 Do Now Start a terminal shell. From there, issue these commands

More information

Introduction. Overview of 201 Lab and Linux Tutorials. Stef Nychka. September 10, Department of Computing Science University of Alberta

Introduction. Overview of 201 Lab and Linux Tutorials. Stef Nychka. September 10, Department of Computing Science University of Alberta 1 / 12 Introduction Overview of 201 Lab and Linux Tutorials Stef Nychka Department of Computing Science University of Alberta September 10, 2007 2 / 12 Can you Log In? Should be same login and password

More information

Use C++, not C for all work in this course. The biggest difference is how one does input

Use C++, not C for all work in this course. The biggest difference is how one does input Chapter 1: Preamble 1.1 Commandments A nationally-known expert has said that C++ is a coding monster that forces us to use a disciplined style in order to tame it. This leads to a fundamental rule for

More information

Check the entries in the home directory again with an ls command and then change to the java directory:

Check the entries in the home directory again with an ls command and then change to the java directory: MODULE 1p - A Directory for Java Files FIRST TASK Log in to PWF Linux and check the files in your home directory with an ls command. Create a directory for your Java files: c207@pccl504:~> mkdir java Move

More information

SFU CMPT 379 Compilers Spring 2018 Milestone 1. Milestone due Friday, January 26, by 11:59 pm.

SFU CMPT 379 Compilers Spring 2018 Milestone 1. Milestone due Friday, January 26, by 11:59 pm. SFU CMPT 379 Compilers Spring 2018 Milestone 1 Milestone due Friday, January 26, by 11:59 pm. For this assignment, you are to convert a compiler I have provided into a compiler that works for an expanded

More information

Operating System Interaction via bash

Operating System Interaction via bash Operating System Interaction via bash bash, or the Bourne-Again Shell, is a popular operating system shell that is used by many platforms bash uses the command line interaction style generally accepted

More information

LAB #5 Intro to Linux and Python on ENGR

LAB #5 Intro to Linux and Python on ENGR LAB #5 Intro to Linux and Python on ENGR 1. Pre-Lab: In this lab, we are going to download some useful tools needed throughout your CS career. First, you need to download a secure shell (ssh) client for

More information

CMSC 201 Spring 2017 Lab 01 Hello World

CMSC 201 Spring 2017 Lab 01 Hello World CMSC 201 Spring 2017 Lab 01 Hello World Assignment: Lab 01 Hello World Due Date: Sunday, February 5th by 8:59:59 PM Value: 10 points At UMBC, our General Lab (GL) system is designed to grant students the

More information

CS4023 Week06 Lab Exercise

CS4023 Week06 Lab Exercise CS4023 Week06 Lab Exercise Lab Objective: In this week s lab we will look at writing a program that reads a large matrix of numbers and then reports all numbers that are equal to a reference value (or

More information

Once you have installed MobaXterm, open MobaXterm. Go to Sessions -> New Session, and click on the SSH icon.

Once you have installed MobaXterm, open MobaXterm. Go to Sessions -> New Session, and click on the SSH icon. Lab 1 In order to get credit for the lab, you need to be checked off by the end of lab. For nonzero labs, you can earn a maximum of 3 points for lab work completed outside of lab time, but you must finish

More information

COMP26120 Academic Session: Lab Exercise 2: Input/Output; Strings and Program Parameters; Error Handling

COMP26120 Academic Session: Lab Exercise 2: Input/Output; Strings and Program Parameters; Error Handling COMP26120 Academic Session: 2018-19 Lab Exercise 2: Input/Output; Strings and Program Parameters; Error Handling Duration: 1 lab session For this lab exercise you should do all your work in your COMP26120/ex2

More information

If your company doesn t have a Handshake profile yet, you ll first need to create one. To learn more, read How do I create an account?

If your company doesn t have a Handshake profile yet, you ll first need to create one. To learn more, read How do I create an account? How do I post a job? If your company doesn t have a Handshake profile yet, you ll first need to create one. To learn more, read How do I create an account? To post a job on behalf of your company, click

More information

CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis

CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis Handout written by Julie Zelenski with edits by Keith Schwarz. The Goal In the first programming project, you will get

More information

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209 CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System

More information

Problem Set 1 Due: 11:59pm Wednesday, February 7

Problem Set 1 Due: 11:59pm Wednesday, February 7 CS251 Programming Languages Handout # 13 Prof. Lyn Turbak January 31, 2007 Wellesley College Reading: Problem Set 1 Due: 11:59pm Wednesday, February 7 Handouts #1 #12 (only Chapters 1 5 of Handout #9 =

More information

Assignment 4: Trees CS102: Data Structures, Fall 2013 Eric Koskinen and Daniel Schwartz-Narbonne New York University

Assignment 4: Trees CS102: Data Structures, Fall 2013 Eric Koskinen and Daniel Schwartz-Narbonne New York University 1 of 5 10/30/2013 12:09 PM Assignment 4 Assignment 4: Trees CS102: Data Structures, Fall 2013 Eric Koskinen and Daniel Schwartz-Narbonne New York University Context Due: 11:55PM (23:55:00), Thursday November

More information

CSC116: Introduction to Computing - Java

CSC116: Introduction to Computing - Java CSC116: Introduction to Computing - Java Course Information Introductions Website Syllabus Computers First Java Program Text Editor Helpful Commands Java Download Intro to CSC116 Instructors Course Instructor:

More information

Intro to HPC Exercise

Intro to HPC Exercise Intro to HPC Exercise Lab Exercise: Introduction to HPC The assumption is that you have already tested your Amazon Web Service Elastic Compute Cloud (EC2) virtual machines chosen for the LCI hands on exercises.

More information

York University Faculty Science and Engineering Fall 2008

York University Faculty Science and Engineering Fall 2008 York University Faculty Science and Engineering Fall 2008 CSE2031 Final Software Tools Friday, Feb..26 th, 2008 Last Name 08:30 10:30am First name ID Instructions to students: Answer all questions. Marks

More information

Project 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. 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 information

CS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style

CS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style CS125 : Introduction to Computer Science Lecture Notes #4 Type Checking, Input/Output, and Programming Style c 2005, 2004, 2002, 2001, 2000 Jason Zych 1 Lecture 4 : Type Checking, Input/Output, and Programming

More information

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

ENCM 339 Fall 2017: Editing and Running Programs in the Lab page 1 of 8 ENCM 339 Fall 2017: Editing and Running Programs in the Lab Steve Norman Department of Electrical & Computer Engineering University of Calgary September 2017 Introduction This document is a

More information

, has the form T i1i 2 i m. = κ i1i 2 i m. x i1. 1 xi2 2 xim m (2)

, has the form T i1i 2 i m. = κ i1i 2 i m. x i1. 1 xi2 2 xim m (2) CS61B, Fall 2002 Project #1 P. N. Hilfinger Due: Friday, 4 October 2002 at 2400 This first project involves writing a calculator program that can perform polynomial arithmetic. We ll do only a very limited

More information

Repetition Structures

Repetition Structures Repetition Structures Chapter 5 Fall 2016, CSUS Introduction to Repetition Structures Chapter 5.1 1 Introduction to Repetition Structures A repetition structure causes a statement or set of statements

More information

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution.

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution. Repetition Structures Introduction to Repetition Structures Chapter 5 Spring 2016, CSUS Chapter 5.1 Introduction to Repetition Structures The Problems with Duplicate Code A repetition structure causes

More information

Introduction to Programming COIT 20245

Introduction to Programming COIT 20245 Introduction to Programming COIT 20245 Assessment item 1 Java Console Program Due date: Weighting: Length: Week 7 T318 24 December 2018 Refer below for complete assessment item 1 requirements (Assignment

More information

CSC116: Introduction to Computing - Java

CSC116: Introduction to Computing - Java CSC116: Introduction to Computing - Java Intro to CSC116 Course Information Introductions Website Syllabus Computers First Java Program Text Editor Helpful Commands Java Download Course Instructor: Instructors

More information

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and

More information

Department of Computer Science University of Pretoria. Introduction to Computer Science COS 151

Department of Computer Science University of Pretoria. Introduction to Computer Science COS 151 Department of Computer Science University of Pretoria Introduction to Computer Science COS 151 Practical 1 16 February 2018 1 Plagiarism Policy The Department of Computer Science considers plagiarism as

More information

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Java 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 information

In this introduction to UNIX, only the dumb terminal (also known as the command line ) interface is discussed.

In this introduction to UNIX, only the dumb terminal (also known as the command line ) interface is discussed. COE808 Lab1: C programming lab Prelab preparation Before coming to the lab you should: 1. Read the lab. The most recent version can be found at the URL: www.ee.ryerson.ca/~courses/coe808 2. Try to prepare

More information

Controls Structure for Repetition

Controls Structure for Repetition Controls Structure for Repetition So far we have looked at the if statement, a control structure that allows us to execute different pieces of code based on certain conditions. However, the true power

More information

CS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/

CS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/ CS61C Machine Structures Lecture 4 C Pointers and Arrays 1/25/2006 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS 61C L04 C Pointers (1) Common C Error There is a difference

More information

Lab Exercise #1 Project Compilation, Javadoc Generation, and Submission Computer Science 2334

Lab Exercise #1 Project Compilation, Javadoc Generation, and Submission Computer Science 2334 Lab Exercise #1 Project Compilation, Javadoc Generation, and Submission Computer Science 2334 Name: Learning Objectives (Milestones): 1. Install Java Development Kit and SSH Secure Shell Software 2. Successfully

More information

Università degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M

Università degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M tutor Isam M. Al Jawarneh, PhD student isam.aljawarneh3@unibo.it Mobile Middleware

More information

Java Bytecode (binary file)

Java Bytecode (binary file) Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.

More information

You should see something like this, called the prompt :

You should see something like this, called the prompt : CSE 1030 Lab 1 Basic Use of the Command Line PLEASE NOTE this lab will not be graded and does not count towards your final grade. However, all of these techniques are considered testable in a labtest.

More information

1 DOMjudge Overview Scoreboard... 2

1 DOMjudge Overview Scoreboard... 2 Contents 1 DOMjudge 2 1.1 Overview................................................. 2 1.2 Scoreboard................................................ 2 2 Solving a Problem 3 2.1 Reading the Problem Statement....................................

More information

CS 541 Spring Programming Assignment 2 CSX Scanner

CS 541 Spring Programming Assignment 2 CSX Scanner CS 541 Spring 2017 Programming Assignment 2 CSX Scanner Your next project step is to write a scanner module for the programming language CSX (Computer Science experimental). Use the JFlex scanner-generation

More information

CISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts)

CISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts) CISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts) For this lab you may work with a partner, or you may choose to work alone. If you choose to work with a partner, you are still responsible for the lab

More information

Programming Assignment 2 (PA2) - DraggingEmoji & ShortLongWords

Programming Assignment 2 (PA2) - DraggingEmoji & ShortLongWords Programming Assignment 2 (PA2) - DraggingEmoji & ShortLongWords Due Date: Wednesday, October 10 @ 11:59 pm Assignment Overview Grading Gathering Starter Files Program 1: DraggingEmoji Program 2: ShortLongWords

More information

Lab 5: Java IO 12:00 PM, Feb 21, 2018

Lab 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 information

IDE: Integrated Development Environment

IDE: Integrated Development Environment Name: Student ID: Lab Instructor: Borja Sotomayor Do not write in this area 1 2 3 TOTAL Maximum possible points: 30 One of the goals of this lab is to introduce the Eclipse IDE, a software environment

More information

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group.

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group. CMPS 12L Introduction to Programming Lab Assignment 2 We have three goals in this assignment: to learn about file permissions in Unix, to get a basic introduction to the Andrew File System and it s directory

More information

PearsonAccess next User Guide for ACT WorkKeys

PearsonAccess next User Guide for ACT WorkKeys In this Document This document contains information about using PearsonAccess nexttm for administrative and other various testrelated activities. It includes the following sections: System basics Managing

More information

COP4530 Data Structures, Algorithms and Generic Programming Recitation 3 Date: January 20 & 22, 2009

COP4530 Data Structures, Algorithms and Generic Programming Recitation 3 Date: January 20 & 22, 2009 COP4530 Data Structures, Algorithms and Generic Programming Recitation 3 Date: January 20 & 22, 2009 Lab objectives: 1) Quiz 2) Set up SSH to run external programs. 3) Learn how to use the DDD debuger.

More information

CPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment.

CPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment. CPS109 Lab 1 Source: Partly from Big Java lab1, by Cay Horstmann. Objective: i. To become familiar with the Ryerson Computer Science laboratory environment. ii. To obtain your login id and to set your

More information

CS 1110, LAB 03: STRINGS; TESTING First Name: Last Name: NetID:

CS 1110, LAB 03: STRINGS; TESTING  First Name: Last Name: NetID: CS 1110, LAB 03: STRINGS; TESTING http://www.cs.cornell.edu/courses/cs1110/2018sp/labs/lab03/lab03.pdf First Name: Last Name: NetID: Correction on pg 2 made Tue Feb 13, 3:15pm Getting Credit: As always,

More information

PearsonAccess next User Guide for the ACT Test

PearsonAccess next User Guide for the ACT Test In this Document This document contains information about using PearsonAccess nexttm for administrative and other various testrelated activities. It includes the following sections: System basics Managing

More information

CS 209 Sec. 52 Spring, 2006 Lab 4-A: Arrays Instructor: J.G. Neal Objectives: Lab Instructions: Obtain file ArrayDemoConsole.java

CS 209 Sec. 52 Spring, 2006 Lab 4-A: Arrays Instructor: J.G. Neal Objectives: Lab Instructions: Obtain file ArrayDemoConsole.java CS 209 Sec. 52 Spring, 2006 Lab 4-A: Arrays Instructor: J.G. Neal Objectives: To gain experience with: 1. The declaration, creation, and use of arrays. 2. Inserting/removing items into/from an array. 3.

More information

ASSIGNMENT 1 First Java Assignment

ASSIGNMENT 1 First Java Assignment ASSIGNMENT 1 First Java Assignment COMP-202B, Winter 2012, All Sections Due: Sunday January 29th, 2012 (23:30) Please read the entire pdf before starting. You must do this assignment individually and,

More information

Lab 1: Setup 12:00 PM, Sep 10, 2017

Lab 1: Setup 12:00 PM, Sep 10, 2017 CS17 Integrated Introduction to Computer Science Hughes Lab 1: Setup 12:00 PM, Sep 10, 2017 Contents 1 Your friendly lab TAs 1 2 Pair programming 1 3 Welcome to lab 2 4 The file system 2 5 Intro to terminal

More information

This assignment requires that you complete the following tasks (in no particular order).

This assignment requires that you complete the following tasks (in no particular order). Construction Objectives The objectives of this assignment are: (1) Implement your FCS design with high-quality code and thorough unit tests (2) Gain experience doing a task breakdown (3) Gain experience

More information

CITS1001 week 4 Grouping objects

CITS1001 week 4 Grouping objects CITS1001 week 4 Grouping objects Arran Stewart March 20, 2018 1 / 31 Overview In this lecture, we look at how can group objects together into collections. Main concepts: The ArrayList collection Processing

More information

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209 CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System

More information

Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time)

Due: 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 information