Free Essay

Pt 1420 Unit 10 Homework

In:

Submitted By kwooden0626
Words 291
Pages 2
Introduction to Programming
Unit 10 Assignment 1

Short Answer
1.
* Open the file – Opening the file creates a connection between the file and a program; this allows the program to read data from the file. * Process the file – Data is either read from the file or written to the file * Closing the file – The file must be closed when a program is finished using it. Closing the file disconnects the file from the program.
2. The file must be closed so the program will force any unsaved data in the buffer to be written to the file.

4. The file will not be erased, and any new data will be written at the end of the file’s current contents. 5. The program will create a new file.

Algorithm Workbench

1.
Declare OutputFile myFile

Open myFile “my_name.dat”

Write myFile “fatima”

Close myFile

2.
Declare InputFile myFile
Declare String name1

Open myFile “my_name.dat”

Read myFile name1

Close myFile

Display ”Hello! My name is,”

3. Declare OutputFile numberList
Declare Integer counter = 1

Open numberList “number_list.dat”

For counter = 1 to 100
Write numberList, counter
Next counter
End For

Close numberList

4.

Declare InputFile number_list
Declare Integer myNumber
Open number_list ”number_list.dat"

Display "Here are the numbers: "

While NOT eof (number_list)
Read numberList myNumber
Display myNumber
End While

Close myName

Programming Exercise Pg. 410 1. Declare Integer number Declare InputFile numberFile Open numberFile “numbers.dat” Display “Here are the numbers: “ While NOT eof(numberFile) Read numberFile (number) Display number End While Close numberFile 2. Declare String name Declare Integer counter = 0 Declare InputFile nameFile Open nameFile (names.dat”) While NOT eof(nameFile) Read nameFile name Set counter = counter + 1 End While Close nameFile Display “The number of names in the file is “, counter

Similar Documents

Free Essay

Pt 1420

...PT 1420 Student Name:__________________ Introduction to Programming Winter 2014/2015 Instructor: Martin Remmele Unit 7 Homework Assignment Due by end of first break February 10, 2015 Learning Objectives and Outcomes NOTE: This section lists concepts and techniques to be understood from this unit. The actual assignment that you are to complete is found in the next section: “Assignment Requirements”. * Be able to Use pseudocode/flowcharts to represent repetition structures. * Be able to Create While, Do-While, and Do-Until conditional loops. * Be able to Describe the implications of an infinite loop. Assignment Requirements Complete the following exercises. An exercise that calls for an algorithm may be written in English as a series of steps. An exercise that calls for program statements may be written in a) the text’s pseudocode, b) your own preferred pseudocode notation or c) Visual Basic. (VB code can simply be typed into your Word document; it does not have to be created in the development environment.) The logic of the statements will be more important to the grade than the syntax. * Short Answer Review Questions 1-5, starting on page 213 (5 pts each) * Algorithm Workbench Review Questions 1, 2, 7, and 8, starting on page 213 (10 pts each) * Programming Exercises 1, 3, and 4, starting on page 214 (10 points each) Required Resources *...

Words: 310 - Pages: 2

Free Essay

Pt 1420 Homework

...Pt 1420 Unit 10 Homework Introduction to Programming Unit 10 Assignment 1 Short Answer 1. * Open the file – Opening the file creates a connection between the file and a program; this allows the program to read data from the file. * Process the file – Data is either read from the file or written to the file * Closing the file – The file must be closed when a program is finished using it. Closing the file disconnects the file from the program. 2. The file must be closed so the program will force any unsaved data in the buffer to be written to the file. 4. The file will not be erased, and any new data will be written at the end of the file’s current contents. 5. The program will create a new file. Algorithm Workbench 1. Declare OutputFile myFile Open myFile “my_name.dat” Write myFile “fatima” Close myFile 2. Declare InputFile myFile Declare String name1 Open myFile “my_name.dat” Read myFile name1 Close myFile Display ”Hello! My name is,” 3. Declare OutputFile numberList Declare Integer counter = 1 Open numberList “number_list.dat” For counter = 1 to 100 Write numberList, counter Next counter End For Close numberList 4. Declare InputFile number_list Declare Integer myNumber Open number_list ”number_list.dat" Display "Here are the numbers: " While NOT eof (number_list) Read numberList myNumber Display myNumber End While Close myName Programming Exercise Pg. 410 1. Declare Integer number Declare...

Words: 296 - Pages: 2

Free Essay

Working Capital

...Business Plans Handbook Business Plans A COMPILATION OF BUSINESS PLANS DEVELOPED BY INDIVIDUALS NORTH THROUGHOUT AMERICA Handbook VOLUME 16 Lynn M. Pearce, Project Editor Business Plans Handbook, Volume 16 Project Editor: Lynn M. Pearce Product Manager: Jenai Drouillard Product Design: Jennifer Wahi Composition and Electronic Prepress: Evi Seoud Manufacturing: Rita Wimberley Editorial: Erin Braun ª 2010 Gale, Cengage Learning ALL RIGHTS RESERVED. No part of this work covered by the copyright herein may be reproduced, transmitted, stored, or used in any form or by any means graphic, electronic, or mechanical, including but not limited to photocopying, recording, scanning, digitizing, taping, Web distribution, information networks, or information storage and retrieval systems, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the publisher. This publication is a creative work fully protected by all applicable copyright laws, as well as by misappropriation, trade secret, unfair competition, and other applicable laws. The authors and editors of this work have added value to the underlying factual material herein through one or more of the following: unique and original selection, coordination, expression, arrangement, and classification of the information. For product information and technology assistance, contact us at Gale Customer Support, 1-800-877-4253. For permission to use material...

Words: 121839 - Pages: 488

Free Essay

500 Extraordinary Islands

...500 extraordinary islands G R E E N L A N D Beaufort Sea Baffin Bay vi Da i tra sS t a nm De it Stra rk Hudson Bay Gulf of Alaska Vancouver Portland C A N A D A Calgary Winnipeg Newfoundland Quebec Minneapolis UNITED STATES San Francisco Los Angeles San Diego Phoenix Dallas Ottawa Montreal ChicagoDetroitToronto Boston New York OF AMERICA Philadelphia Washington DC St. Louis Atlanta New Orleans Houston Monterrey NORTH AT L A N T I C OCEAN MEXICO Guadalajara Mexico City Gulf of Mexico Miami Havana CUBA GUATEMALA HONDURAS b e a n Sea EL SALVADOR NICARAGUA Managua BAHAMAS DOMINICAN REPUBLIC JAMAICA San Juan HAITI BELIZE C a r PUERTO RICO ib TRINIDAD & Caracas N TOBAGO A COSTA RICA IA M PANAMA VENEZUELA UYANRINA H GU C U G Medellín A PAC I F I C OCEAN Galapagos Islands COLOMBIA ECUADOR Bogotá Cali S FR EN Belém Recife Lima BR A Z I L PERU La Paz Brasélia Salvador Belo Horizonte Rio de Janeiro ~ Sao Paulo BOLIVIA PARAGUAY CHILE Cordoba Santiago Pôrto Alegre URUGUAY Montevideo Buenos Aires ARGENTINA FALKLAND/MALVINAS ISLANDS South Georgia extraordinary islands 1st Edition 500 By Julie Duchaine, Holly Hughes, Alexis Lipsitz Flippin, and Sylvie Murphy Contents Chapter 1 Beachcomber Islands . . . . . . . . . . . . . . . 1 Aquatic Playgrounds 2 Island Hopping the Turks & Caicos: Barefoot Luxury 12 Life’s a Beach 14 Unvarnished & Unspoiled 21 Sailing...

Words: 249855 - Pages: 1000