Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Challenge: Document Description: Save a text document to disk based on a name and content provided by the user. Purpose: This application provides experience with

Challenge: Document

Description: Save a text document to disk based on a name and content provided by the user.

Purpose: This application provides experience with user input and interaction in the Console, writing files to disk, working with exceptions, and writing programs in C#/.NET.

Requirements:

Project Name: Document Target Platform: Console Programming Language: C#

This program is to display the name of the app Document followed by a blank line, prompt the user for the name and content for a document, save the document to the current directory, and display a message if it was successful or unsuccessful based on a specification provided. The filename of the document is the name provided by the user with .txt appended to it.

When the program runs:

  1. Display Document followed by a blank line.
  2. Prompt the user for the name of the document.
  3. Prompt the user for the content that is to be in the document.
  4. Append .txt to the name and use it as the file name.
  5. Save the content to a file in the current directory.
  6. If an exception occurs, output the exception message and exit.
  7. If an exception does not occur, output [filename] was successfully saved. The document contains [count] characters. and exit. [filename] and [count] are placeholders for the filename of the document and the number of characters it contains.

Note that the requirements say the file is to be saved in the current directory. This means you can use just the file name as the path for the file. If you do that, the file will be saved in the current directory for the application. When I created the project and called it Document, a directory called Document was created that contains Document.sln and another directory called Document. The Document directory inside of the project is the current directory when the application runs and is where you will find the files that are saved.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

Suppose that t g(t) = 12. Show that g(t) exists and equals 4. im

Answered: 1 week ago

Question

Factors Affecting Conflict

Answered: 1 week ago

Question

Describe the factors that lead to productive conflict

Answered: 1 week ago

Question

Understanding Conflict Conflict Triggers

Answered: 1 week ago