Free Essay

Pt 1420 Homework

In:

Submitted By scho
Words 296
Pages 2
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 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 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...

Words: 291 - Pages: 2

Premium Essay

Pt 1420 Unit 2 Homework

...Unit 2 Homework Short Answer Pg. 71 (1-4) 1.) Work directly with and interview the customer. 2.) Pseudocode is an informal language that has no syntax rules, and is not meant to be compiled or executed. 3.) Input is received, some process is performed on the input, output is produced. 4.) User-friendly means that something is easy for anyone, regardless of their level of experience, to use. Algorithim Workbench Pg. 71 (1-2) 1.) Declare Height as Integer Display “ Enter Height “ Input “ Height “ 2.) Declare Color as String Display “ Enter Color” Input “ Color “ Please view Visio Attachments for flow charts Programming Exercises Pg. 72 (1&4) 1.) Sub Main() Console.WriteLine("Mark Gutierrez") Console.WriteLine("123 Bonehead Lane") Console.WriteLine("702-555-555") Console.WriteLine("NSA") Console.ReadLine() End Sub End Module 4.) Module Module1 Sub Main() Dim gtotal As Double Dim taxamount As Double Dim subtotal As Double Dim tax As Double = 0.06 Dim item1 As Double Dim item2 As Double Dim item3 As Double Dim item4 As Double Dim item5 As Double Console.WriteLine("enter item #1 price") item1 = Console.ReadLine() Console.WriteLine("enter item #2 price") item2 = Console.ReadLine() Console.WriteLine("enter item #3 price") item3 = Console.ReadLine() ...

Words: 270 - Pages: 2

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

Premium Essay

Assignment 1

...PT 1420 Unit Assignment 1: Homework 1. Describe the role of software for computers. computer software can be divided into Application software uses the computer system to perform useful work or provide entertainment functions beyond the basic operation of the computer itself. System software is designed to operate the computer hardware, to provide basic functionality, and to provide a platform for running application software. Malicious software computer software developed to harm and disrupt computers. As such, malware is undesirable. Software is essential to a computer because without software, a computer can do nothing. All of the software that we use to make out computers useful is created by individuals known as programmers or software developers. 2. Identify the hardware associated with a computer. The term hardware refers to all of the physical devices, or components, that a computer is made of. A computer is not one single device , but a system of devices that all work together. Like the different instruments in a symphony orchestra, each device in a computer plays its own part. These are the main components; The central processing (CPU), Main, memory, Secondary storage devices, Input devices, Output devices. 3. Describe how computers store data. A modern digital computer represents data using the binary numeral system. Text, numbers, pictures, audio, and nearly any other form of information can be converted into a string of bits, or binary...

Words: 549 - Pages: 3

Premium Essay

Unit 7 Homework

...Lab 7 Homework PT 1420 4/28/2016 Short Answers 1-5 1. Why should you indent the statements in the body of a loop? When indenting your statements, you can make them stand out from surrounding code. 2. Describe the difference between pretest loops and posttest loops? A pretest loop test the conditions before each iteration while a posttest loop test after each iteration. 3. What is a condition-controlled loop? A way for computer programs to repeat one or more various steps depending on conditions set either by the programmer initially or real time. 4. What is a count-controlled loop? A counter variable used to control or keep track of the number of times a loop iterates. Initialization, test and increment. 5. What three actions do count- controlled loops typically perform using the counter variable? While loop, do-while loop and for loop. Algorithm Questions 1,2,7 and 8 1. declare integer product declare integer number product =0 do while product < 100 display “enter number” input number product = number*10 2. do{ sum =0 print(“enter=a”) read a print(“enter=b”) read b sum = a*b print(“sum=”+sum) print(‘ do you wish to continue”) read Response } while (RESPONSE) 7. Declare integer x =1 Do { while x > 0 display “enter a number” input x } End while 8. Declare string sure Display “are you sure you want to quit?” While sure != "Y" AND sure != "y" End while Programming exercises 1,3, and 4 1. Module Module1 Sub Main() Dim day1...

Words: 483 - 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