Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function which takes a filename as input. 1)If the file exist, it will display the content of the file. 2)Next use the case

Write a function which takes a filename as input. 1)If the file exist, it will display the content of the file. 2)Next use the case structure to display a command menu, and prompt the user for selection. Depending on the users selection, the user is allowed to write, append, edit the file, or exit the menu. 3)In case the users selection is invalid, prompt the user no valid selection is made. 4)If the file doesnt exist it will open the file in vi or vim. So you can write in the file and save it. 5)The program should complete all 3 Task examples below.

COMMAND MENU

Enter 1 write to file (Using cat) Enter 2 append to file (Using cat) Enter 3 edit file (Open vi) Enter 4 exit menu (show Bye and exit from program)

Task(1) Enter a filname. fruits

Displaying the file: banana apple orange

COMMAND MENU

Enter 1 to write to file Enter 2 to append to file Enter 3 to edit file Enter 4 to exit menu Enter an option: 4 BYE BYE

Task(2)

Enter a filename. newFile Creating a new file called newFile :

Task(3) Enter a filename. country

Displaying the file: USA Canada Brazil, Lets continue writing.

COMMAND MENU

Enter 1 to write to file Enter 2 to append to file Enter 3 to edit file Enter 4 to exit menu Enter an option: 6 You did not enter valid option.

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

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions

Question

How does a metallic crystal respond to low applied loads?

Answered: 1 week ago

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago