Free Essay

Pt1420 Lab 10

In:

Submitted By mmzoller
Words 347
Pages 2
Lab 10: File Access
This lab accompanies Chapter 10 of Starting Out with Programming Logic & Design.

Lab 10.1 – File Access and Visual Basic

This lab examines how to work with a file by writing Visual Basic code. Read the following programming problem prior to completing the lab.

Write and design a simple program that will take 3 pieces of data and write it to a file. Create variables and set them equal to the appropriate values:

Declare string firstName = “xxx”
Declare string lastName = “xxx”
Declare integer age = your age

Write this information to a file called myRecords.txt. Next, read this information from the file and print it to the screen.

Step 1: Create a new Visual Basic workspace and add the following code:

Module Module1

Sub Main()

Dim firstName As String = "XXXX" Dim lastName As String = "XXX" Dim age As Integer = ####

Dim writer As System.IO.StreamWriter = System.IO.File.CreateText("myRecords.txt") writer.WriteLine(firstName & " " & lastName & " " & age) writer.Close()

Dim reader As System.IO.StreamReader = System.IO.File.OpenText("myRecords.txt") Dim myInfo As String = reader.ReadLine() Console.WriteLine(myInfo) reader.Close()

'this causes a pause so you can see your program Console.Write("Press enter to continue...") Console.ReadLine() End Sub

End Module

Step 2: Change the values of the variables to your records.

Step 3: Run the program so that it works, and view your .txt file.

Copy and paste your Visual Basic code into a Word document.
Copy and paste your text file contents into the same Word document.

Module Module1

Sub Main() Dim firstName As String = "Brian" Dim lastName As String = "Melson" Dim age As Integer = 39 Dim writer As System.IO.StreamWriter = System.IO.File.CreateText("myRecords.text") writer.WriteLine(firstName & " " & lastName & " " & age) writer.Close() Dim reader As System.IO.StreamReader = System.IO.File.OpenText("myRecords.text") Dim myInfo As String = reader.ReadLine() Console.WriteLine(myInfo) reader.Close() 'this causes a pause so you can see your program Console.Write("Press enter to continue...") Console.ReadLine() End Sub

End Module

Similar Documents

Premium Essay

Nt1230 Syllabus

...ITT Technical Institute NT1230 Client-Server Networking I Onsite Course SYLLABUS Credit hours: 4.5 Contact/Instructional hours: 56 (34 Theory Hours, 22 Lab Hours) Prerequisite(s) and/or Corequisite(s): Prerequisite or Corerequisite: NT1210 Introduction to Networking or equivalent Course Description: This course introduces operating principles for the client-server based networking systems. Students will examine processes and procedures involving the installation, configuration, maintanence, troublshooting and routine adminstrative tasks of popular desktop operating system(s) for standalone and network client computers, and related aspects of typical network server functions. Client-Server Networking I Syllabus Where Does This Course Belong? 1st QTR GS1140 NT1110 GS1145 Problem Solving Theory Computer Structure and Logic Strategies for the Technical Professional 2nd QTR NT1210 Introduction to Networking NT1230 Client-Server Networking I MA1210 College Mathematics I 3rd QTR NT1310 NT1330 MA1310 4th QTR PT1420 NT1430 EN1320 5th QTR PT2520 NT2580 EN1420 6th QTR NT2640 NT2670 CO2520 7th QTR NT2799 SP2750 Physical Networking Client-Server Networking II College Mathematics II Introduction to Programming Linux Networking Composition I Database Concepts Introduction to Information Security Composition II IP Networking Email and Web Services Communications Network Systems Administration Capstone Project Group Theory The follow diagram indicates how this course...

Words: 1834 - Pages: 8

Premium Essay

Test

...ITT Technical Institute IS3340 Windows Security Onsite Course SYLLABUS Credit hours: 4.5 Contact/Instructional hours: 60 (30 Theory Hours, 30 Lab Hours) Prerequisite(s) and/or Corequisite(s): Prerequisite: NT2580 Introduction to Information Security or equivalent Course Description: This course examines security implementations for a variety of Windows platforms and applications. Areas of study include analysis of the security architecture of Windows systems. Students will identify and examine security risks and apply tools and methods to address security issues in the Windows environment. Windows Security Syllabus Where Does This Course Belong? This course is required for the Bachelor of Science in Information Systems Security program. This program covers the following core areas:    Foundational Courses Technical Courses BSISS Project The following diagram demonstrates how this course fits in the program:    IS4799 NT2799 IS4670 ISC Capstone Project Capstone ProjectCybercrime Forensics NSA    NT2580 NT2670  Introduction to  Information Security IS4680 IS4560 NT2580 NT2670 Email and Web Services Hacking and Introduction to  Security Auditing for Compliance Countermeasures Information Security Email and Web Services      NT1230 NT1330 Client-Server Client-Server  Networking I Networking II  IS3230 IS3350 NT1230 NT1330  Issues Client-Server Client-Server  SecurityContext in Legal Access Security Networking I Networking II   NT1110...

Words: 2305 - Pages: 10

Premium Essay

Week 5 Sd1340

...EXPLORE Activity 3: Designing Objects with Visio In-Class Activity Ungraded Course Support Tools/Resources required for this activity: Visio Description: Demonstrate creating an object in Visio. Create a UML diagram and show how to define attributes (properties) and operations (methods). Create the UML for the Card object used in the example. The result should look like this: [pic] Estimated Time: 10 minutes PRACTICE Activity 1: Designing Objects In-Class Activity Ungraded Course Support Tools/Resources required for this activity: None Description: Divide the class into groups of three or four students. Assign each group one of the following objects: Product MusicDownload User TakeoutItem ElectronicBook Video Ask each group to identify at least three properties and one method for each object and write the JavaScript code they would use to define the object. Have a member of each group write their code on the whiteboard. Built-In Objects EXPLORE ACTIVITY 4: BUILT-IN OBJECTS In-Class Activity Ungraded Course Support Tools/Resources required for this activity: Unit 5 PowerPoint Presentation (SD1340.U5.PP1) Unit5Sample2.html (SD1340.U5.AF2) Description: Use Slides 22 through 32 to discuss built-in objects. Students have already been introduced to the Array, String, and Math built-in objects. Use Slides 22 and 23 to show how a built-in object can be extended. Use Slides 24-26 to explore the Math object. Unit5Sample2.html (SD1340.U5.AF2)...

Words: 1297 - Pages: 6

Premium Essay

Nt2640

...ITT Technical Institute NT2640 IP Networking Onsite Course SYLLABUS Credit hours: 4.5 Contact/Instructional hours: 56 (34 Theory Hours, 22 Lab Hours) Prerequisite(s) and/or Corequisite(s): Prerequisites: NT1210 Introduction to Networking or equivalent Course Description: This course explores network design and implementation by applying the TCP/IP protocols to provide connectivity and associated services. Planning and deployment of network addressing structures, as well as router and switch configurations, are also examined. IP Networking Syllabus Where Does This Course Belong? This course is required in the associate degree program in Network Systems Administration and associate degree in Mobile Communications Technology. The following diagrams indicate how this course relates to other courses in respective programs: Network Systems Administration NT2799 NSA Capstone Project NT2580 Introduction to Information Security NT2670 Email and Web Services NT2640 IP Networking PT2520 Database Concepts NT1330 Client-Server Networking II NT1230 Client-Server Networking I NT1430 Linux Networking PT1420 Introduction to Programming NT1110 Computer Structure and Logic NT1201 Introduction to Networking NT1310 Physical Networking CO2520 Communications SP2750 Group Theories EN1420 Composition II EN1320 Composition I GS1140 Problem Solving Theory GS1145 Strategies for the Technical Professional MA1210 College Mathematics...

Words: 2573 - Pages: 11

Premium Essay

Its Making Put Something Here

...PT1420 Introduction to Programming Week-2 Lesson Plan TUE 6:00 PM to 10:30 PM Instructor: Tushar Patel (tspatel02@yahoo.com, tpatel@itt-tech.edu) CLASS: Topic: Unit 2: Software Program Design I Course Objectives Covered by This Unit CO2: Design programs by using flowcharts and pseudo code. CO3: Write programs that perform input, processing, and output. Unit Learning Outcomes LO8: Determine program input, processing, and output stages. LO9: Create the necessary flowcharts to describe a program’s structure. LO10: Use pseudocode to define a program’s structure. LO11: Formulate solution algorithms for calculations by properly following the order of operations. Key Concepts ▪ Determining input, process, and output ▪ Creating flowcharts and pseudocode ▪ Formulating algorithms Reading ▪ Gaddis, Chapter 2: “Introduction to Computers and Programming,” pages 29-55 Resources: • Data Projector • ITT Virtual Library • Text Books • Visual Studio • Lab Computers • Student Removable Hard Drive • VM Ware Player Methods: • Lecture • Group Discussion • Lab Work • Review exercise / Research Papers • Quiz Brief Lesson Overview: Today’s lecture we would be discussing the following topics. • Discuss how all programs basically consist of a three-step process: input, process, and output. Use the payroll calculation program...

Words: 895 - Pages: 4

Premium Essay

Nt1210 Introduction to Networking Onsite Course

...Onsite Course SYLLABUS Credit hours: 4.5 Contact/Instructional hours: 56 (34 Theory Hours, 22 Lab Hours) Prerequisite(s) and/or Corequisite(s): Prerequisites: NT1110 Computer Structure and Logic or equivalent Course Description: This course serves as a foundation for the study of computer networking technologies. Concepts in data communications, such as signaling, coding and decoding, multiplexing, circuit switching and packet switching, OSI and TCP/IP models, LAN/WAN protocols, network devices and their functions, topologies and capabilities are discussed. Industry standards and the development of networking technologies are surveyed in conjunction with a basic awareness of software and hardware components used in typical networking and internetworking environments Introduction to Networking Syllabus Where Does This Course Belong? This course is required for the associate program in Network System Administration and the associate program in Electrical Engineering Technology. The following diagrams demonstrate how this course fits in each program. Associate Program in Network Systems Administration NT2799 NSA Capstone Project NT2580 Introduction to Information Security NT2670 Email and Web Services NT2640 IP Networking PT2520 Database Concepts NT1330 Client-Server Networking II NT1230 Client-Server Networking I NT1430 Linux Networking PT1420 Introduction to Programming NT1110 Computer Structure and Logic NT1210 Introduction to Networking ...

Words: 4400 - Pages: 18

Premium Essay

Nt 1210

...Onsite Course SYLLABUS Credit hours: 4.5 Contact/Instructional hours: 56 (34 Theory Hours, 22 Lab Hours) Prerequisite(s) and/or Corequisite(s): Prerequisites: NT1110 Computer Structure and Logic or equivalent Course Description: This course serves as a foundation for the study of computer networking technologies. Concepts in data communications, such as signaling, coding and decoding, multiplexing, circuit switching and packet switching, OSI and TCP/IP models, LAN/WAN protocols, network devices and their functions, topologies and capabilities are discussed. Industry standards and the development of networking technologies are surveyed in conjunction with a basic awareness of software and hardware components used in typical networking and internetworking environments Introduction to Networking Syllabus Where Does This Course Belong? This course is required for the associate program in Network System Administration and the associate program in Electrical Engineering Technology. The following diagrams demonstrate how this course fits in each program. Associate Program in Network Systems Administration NT2799 NSA Capstone Project NT2580 Introduction to Information Security NT2670 Email and Web Services NT2640 IP Networking PT2520 Database Concepts NT1330 Client-Server Networking II NT1230 Client-Server Networking I NT1430 Linux Networking PT1420 Introduction to Programming NT1110 Computer Structure and Logic NT1210 Introduction to Networking ...

Words: 4400 - Pages: 18

Premium Essay

Nothing

...ITT Technical Institute NT1310 Physical Networking Student Course Package Bring this document with you each week Students are required to complete each assignment and lab in this course package on time whether or not they are in class. Late penalties will be assessed for any assignments or labs handed in past the due date. The student is responsible for replacement of the package if lost. Table of Contents Syllabus 2 Student Professional Experience 19 Graded Assignments and Exercises 23 Labs 47 Documenting your Student Professional Experience 57 ITT Technical Institute NT1310 Physical Networking Onsite Course SYLLABUS Credit hours: 4.5 Contact/Instructional hours: 56 (34 Theory Hours, 22 Lab Hours) Prerequisite(s) and/or Corequisite(s): Prerequisites: NT1210 Introduction to Networking or equivalent Course Description: This course examines industry standards and practices involving the physical components of networking technologies (such as wiring standards and practices, various media and interconnection components), networking devices and their specifications and functions. Students will practice designing physical network solutions based on appropriate capacity planning and implementing various installation, testing and troubleshooting techniques for a computer network. Where Does This Course Belong? | | | NT2799 | | | | | | | | NSA Capstone | | | | | | | Project | | | | | NT2580...

Words: 10839 - Pages: 44