For Monday Read 10.1-10.2 WebCT quiz 18.

Slides:



Advertisements
Similar presentations
1 9/29/06CS150 Introduction to Computer Science 1 Loops Section Page 255.
Advertisements

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie July 5, 2005.
1 9/28/07CS150 Introduction to Computer Science 1 Loops section 5.2, 5.4, 5.7.
1 10/29/07CS150 Introduction to Computer Science 1 Reading from and Writing to Files Section 3.12 & 13.1 & 13.5.
COMP 14 Introduction to Programming Miguel A. Otaduy May 20, 2004.
1 Lab Session-6 CSIT-121 Spring 2005 Structured Choice The do~While Loop Lab Exercises.
1 10/25/06CS150 Introduction to Computer Science 1 Reading from and Writing to Files.
COMP 110 Introduction to Programming Mr. Joshua Stough September 24, 2007.
Presented by Joaquin Vila Prepared by Sally Scott ACS 168 Problem Solving Using the Computer Week 12 Boolean Expressions, Switches, For-Loops Chapter 7.
Chapter 13 Sequential File Processing. Master Files Set of files used to store companies data in areas like payroll, inventory Usually processed by batch.
Looping While-continue.
Array Processing Simple Program Design Third Edition A Step-by-Step Approach 7.
Program 6 Any questions?. System.in Does the opposite of System.out.
Array Processing.
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
More While Loop Examples CS303E: Elements of Computers and Programming.
Nested LOOPS.
Function Problems. Write Functions Asks users whether the user wants to continue of not, then returns the answer. Takes two integers and returns 1 if.
CSCI N341: Client-Side Web Programming Copyright ©2004  Department of Computer & Information Science Writing JavaScript Functions.
1 09/20/04CS150 Introduction to Computer Science 1 Let ’ s all Repeat Together.
Lecture 4: Calculating by Iterating. The while Repetition Statement Repetition structure Programmer specifies an action to be repeated while some condition.
Writing JavaScript Functions. Goals By the end of this unit, you should understand … How to breakdown applications into individual, re-usable modules.
Logic Our programs will have to make decisions in terms of what to do next –we refer to the decision making aspect as logic Logic goes beyond simple if.
Pseudocode Algorithms Using Sequence, Selection, and Repetition
CS 100 Introduction to Computing Seminar
Chapter 3: Assignment, Formatting, and Interactive Input.
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
C++ for Engineers and Scientists Second Edition Chapter 3 Assignment, Formatting, and Interactive Input.
13-1 Sequential File Processing Chapter Chapter Contents Overview of Sequential File Processing Sequential File Updating - Creating a New Master.
13- 1 Chapter 13.  Overview of Sequential File Processing  Sequential File Updating - Creating a New Master File  Validity Checking in Update Procedures.
COMP Loop Statements Yi Hong May 21, 2015.
For Friday Read No quiz Program 6 due. Program 6 Any questions?
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 9: Arrays; Revision Session.
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
Computer Programming 12 Lesson 6 – Loop structure By: Dan Lunney.
Loops ( while and for ) CSE 1310 – Introduction to Computers and Programming Alexandra Stefan 1.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Flow Control (while) Outline 3.7The While Repetition.
For Friday Finish reading chapter 9 WebCT quiz 17.
CHAPTER 6: REPETITION AND LOOP STATEMENTS Learning outcomes  Define the concept of repetition structure.  Specify.
CIS 115 All Exercises Devry University (Devry) FOR MORE CLASSES VISIT CIS 115 All Exercises Devry University.
CIS 115 ALL EXERCISES DEVRY UNIVERSITY (DEVRY)  CIS 115 All Exercises Devry University CIS 115 ALL ILABS DEVRY UNIVERSITY (DEVRY)  CIS 115 All iLabs.
CIS 115 AID Teaching Effectively/cis115aid.com FOR MORE CLASSES VISIT
CIS 115 Slingshot Academy / cis115.com
Building Java Programs
CSC111 Quick Revision.
Exercise : Write a program that print the final price of purchase at a store where everything costs exactly one dollar. Ask for the number of items purchased.
Databases.
while Repetition Structure
EKT120 COMPUTER PROGRAMMING
EKT150 INTRODUCTION TO COMPUTER PROGRAMMING
CHAPTER 6: REPETITION AND LOOP STATEMENTS
CHAPTER 5A Loop Structure
Basic operations in Matlab
Keyboard Input and Screen Display ––––––––––– Interactive Programming
CIS115 Education for Service-- snaptutorial.com
CIS 115 Teaching Effectively-- snaptutorial.com
The while Looping Structure
Yong Choi School of Business CSU, Bakersfield
For Wednesday No new reading No quiz.
The while Looping Structure
Let’s all Repeat Together
Data Groupings: File File: a group of related records
Process Exchange Transactions Activity
Control Statements Loops.
Why are arrays useful? We can use arrays to store a large amount of data without declaring many variables. Example: Read in a file of 1000 numbers, then.
Hint idea 2 Split into shorter tasks like this.
The while Looping Structure
Incremental Programming
The while Looping Structure
Module 4 Loops and Repetition 9/19/2019 CSE 1321 Module 4.
Presentation transcript:

For Monday Read 10.1-10.2 WebCT quiz 18

Program 6 Any questions?

File Practice Write code to read a file of integers and write a new file with one integer per line of the new file.

File Practice The files input1.txt and input2.txt each contain a list of numbers of type int in ascending order. Write a program to create a new file, output.txt, that contains all of the numbers from both input files in sorted order. Use a function that will accept as parameters any two open input streams and an open output stream.

Objects and Records Approaches to reading objects Approaches to writing objects Issues to deal with New lines Multiple word fields

The File Class Contains a number of methods Useful for answering questions about files

Interacting with the User How is this similar to files? How is it different?

System.in

Practice Problem Write Java code to ask for a student’s exam score out of 100. Your program is then to match the exam score to a letter grade and print the grade to the screen. The letter grade is to be calculated as follows: 90 and above A 80-89 B 70-79 C 60-69 D below 60 F

Switch Practice A program is required to read a customer’s name, a purchase amount and a tax code. The tax has been validated and will be one of the following: 0 tax exempt (0%) 1 state sales tax only (3%) 2 federal and state sales tax (5%) 3 special sales tax (7%) The program must then compute the sales tax and the total amount due and print the customer’s name, purchase amount, sales tax and total amount due.

Practice Design and write a program that will prompt for, receive, and total a collection of payroll amounts entered by the user until a sentinel amount of -99 is entered. After the sentinel has been entered, display the total payroll amount on the screen.

Problem 3 Write a program that sums a sequence of integers. Assume that the first integer read specifies the number of values remaining to be entered. Your program should read only one value at a time. A typical input sequence might be 5 100 200 300 400 500

Problem 4 Write a program that finds the smallest of several integers. Assume that input will end when a sentinel value of –999 is read. Do not count –999 as one of the integers to consider.

JFileChooser