Getting Data from a File

Make a record to store information about a dog. It should contain fields for:

Using Notepad or the text editor of your choice, create a text file containing six pieces of information. Save this file in your home directory.

Create two Dog objects (not in an array).

Ask the user for the name of a file to open, and open that file and read in a breed, age, weight, and breed, age, weight from the file.

Display the values you read in.

Which file to open: dogs.txt
Reading data from dogs.txt

First dog: Yorkie, 4, 14
Second dog: Great_Dane, 7, 93


©2013 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License