Console if the contacts file is not found Contact Manager Could not find contacts file! Starting new contacts file... COMMAND MENU 1 - Display all contacts v - View a contact a - Add a contact d - Delete a contact x - Exit program Command: 1 There are no contacts in the list. Command: a Name: Mike Murach Email: mike@murach.com Phone: 559-123-4567 Mike Murach was added. Command: 1 1. Mike Murach Command: v Number: 2 Invalid contact number. Command: v Number: 1 Name: Mike Murach Email: mike@murach.com Phone: 559-123-4567 Command: x Bye!
Added by Montserrat W.
Close
Step 1
.." and then shows the command menu. Show more…
Show all steps
Your feedback will help us improve your experience
Aishwarya Krishnakumar and 57 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
In C++, Using classes, design an online address book to keep track of the names, addresses, phone numbers, and dates of birth of family members, close friends, and certain business associates. Your program should be able to handle a maximum of 500 entries. a. Define a class, addressType, that can store a street address, city, state, and zip code. Use the appropriate functions to print and store the address. Also, use constructors to automatically initialize the data members. b. Define a class extPersonType using the class personType (as defined in Example 1-12, Chapter 1), the class dateType (as designed in Programming Exercise 2 of Chapter 2), and the class addressType. Add a data member to this class to classify the person as a family member, friend, or business associate. Also, add a data member to store the phone number. Add (or override) the functions to print and store the appropriate information. Use constructors to automatically initialize the data members. c. Derive the class addressBookType from the class arrayListType, as defined in this chapter, so that an object of type addressBookType can store objects of type extPersonType. An object of type addressBookType should be able to process a maximum of 500 entries. Add necessary operations to the class addressBookType so that the program should perform the following operations: i. Load the data into the address book from a disk. ii. Search for a person by last name. iii. Print the address, phone number, and date of birth (if it exists) of a given person. iv. Print the names of the people whose birthdays are in a given month or between two given dates. v. Print the names of all the people having the same status, such as family, friend, or business. vi. Print the names of all the people between two last names.
Akash M.
Create a package named "reading_with_exceptions". Write a class named ReadingWithExceptions with the following method: void process(String inputFilename) Your program will encounter errors, and we want you to gracefully handle them in such a way that you print out informative information and continue executing. 1. Your process routine will try to open a file with the name of inputFilename for input. If there is any problem (i.e. the file doesn't exist), then you should catch the exception, give an appropriate error, and then return. Otherwise, your program reads the file for instructions. 2. Your process routine will read the first line of the file looking for an outputFilename String followed by an integer. i.e.: outputFilename number_to_read. Your program will want to write output to a file having the name outputFilename. Your program will try to read from "inputFilename" the number of integers found in "number_to_read". 3. Your process method will copy the integers read from inputFilename and write them to your output file (i.e. outputFilename). There should be 10 numbers per line of output in your output file. 4. If you encounter bad input, your program should not die with an exception. For example: - If the count of the numbers to be read is bad or < 0, you will print out a complaint message and then read as many integers as you find. - If any of the other numbers are bad, print a complaint message and skip over the data. - If you don't have enough input numbers, complain but do not abort. 5. After you have processed inputFilename, I would like your program to then close the output file and tell the user that the file is created. Then open up the output file and copy it to the screen. For example, if inputFilename contained: MyOutput.txt 23 20 1 4 5 7 45 1 2 3 4 5 6 7 8 9 77 88 99 23 34 56 66 77 88 99 100 110 120 We would expect the output of your program to be (Note that after 23 numbers we stop printing numbers): MyOutput.txt created with the following output: 20 1 4 5 7 45 1 2 3 4 5 6 7 8 9 77 88 99 23 34 56 66 77 88 99 100 110 120 The main program will access the command line to obtain the list of filenames to call your process routine with.
Supreeta N.
Write a C++ program that acts like a simple counting tool for collecting information from textual files of documents prepared for a simple word processing software. An input file for the simple word processor includes three types of data, commented lines, command lines and general text of the document to be formatted. A command line is recognized by the '%' at the beginning of the line and followed by a formatting command. The simple word processor software includes three commands only for formatting textual documents. These are "bold", "italic", and "regular", which would affect formatting the following text of the document. A commented line is recognized by "#" at the beginning of the line, and would be skipped by the word processor. The simple counting tool should collect data about the total number of lines read from the file, the number of commented lines, the number of command lines, and the number of bold, italic, and regular commands. Write a C++ program for the simple counting tool that reads lines from a file until the end of file. The program should prompt the user for the file name to read from. The program should open the file for reading, and if the file cannot be opened, it should print the message "File cannot be opened ", followed by the filename, and exit. The program should consider the first word following the '%' character of a command line as a command name. If no word is found, or a word is not recognized as one of the three commands, an error message should be printed out followed by the line number. See the example below for the format of the error message. After reading the contents of the input file, the program should print out the total number of lines, the number of commented lines, the number of command lines, and the number of bold, italic, and regular commands in the file. An example of an input file and the expected results after processing the file are shown below.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD