Question: Methods and File Output with Exceptions assignment Outcome: Demonstrate the ability to write, use and call methods Demonstrate the ability to pass values to and

Methods and File Output with Exceptions assignment

Outcome:

Demonstrate the ability to write, use and call methods

Demonstrate the ability to pass values to and from methods

Demonstrate the ability to catch exceptions

Demonstrate the ability to create a text file

Demonstrate the ability to validate input data

Program Specifications:

Write a menu driven program. The program will use a switch statement. The MENU and cases will be as follows:

1. Users Name

2. Users Age

3. Teenager or not Teenager

4. Triangle

5. Quit

Option 1: Ask the user for his or her name and then display that name 20 times as shown below:

Dennis Dennis Dennis Dennis Dennis

Dennis Dennis Dennis Dennis Dennis

Dennis Dennis Dennis Dennis Dennis

Dennis Dennis Dennis Dennis Dennis

Option 2: For example: if the user enters 25, then you would display the following:

You are 25 years old. Your age doubled is 50.

Option 3: You will display the following

If they never entered an age in option #2, then you would advise them they need to go back and enter a value for age using option #2.

If the user entered 25 in option #2 then you would display

Since you are 25 years old, you are NOT a teenager.

If the user enters 13 in option #2 then you would display

Since you are 13 years old, you are a teenager

Option 4: For example: if the user enters 5, then you would display the following to the screen and to a text document:

X

XX

XXX

XXXX

XXXXX

The triangle needs to be displayed on the screen and in a text document named triangle.txt.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!