Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ou are creating a console-based program that allows the user to view a list of numbers and do a few calculations. This program will be

ou are creating a console-based program that allows the user to view a list of numbers and do a

few calculations. This program will be shown as a menu with

three (3) options

.

The menu should be

created with a do loop.

Use numbers or letter to represent each option.

Option 1 (total 5 marks)

The first option is to display a list of 25 numbers starting at 1:

All the values should be displayed on the screen as follows:

[2 marks]

User a for loop

to increment through the numbers (beginning with the starting

number - 1)

[1 mark] For each number: multiply the even ones by 4 and add seven to the odd numbers.

[1 mark] For the numbers 3, 11 and 21 subtract three from the final value calculated before

displaying.

[1 mark] Note all values must be displayed to the screen.

Option 2 (total 5 marks)

[2 marks] This option should be created using a while loop.

[1 mark] It must ask the user for two numbers and then display the result of the first number

divided by the second number.

[2 marks] This process must be repeated until the user types

END when prompted for any of

the two numbers.

This must return the program to the original menu.

Further explanation

When the user enters both numbers, the result of the first number divided by the second must be

printed to the screen. The user will then be asked for inputs again. This continues until the user

wishes to end the sequence by entering

END when prompted for the first or the second number

.

Option 3

[1 mark] The third option is to exit the program.

Before exiting the program must display the message Thank you

Any invalid option entered by the user should prompt the menu to reappear and ask the same

three options.

Any string entry by the user, in place of the expected numeric value must not crash the program

(note END for option 2 is the only string value accepted.

You must use the appropriate loop for each segment as stated for each question

Your program must:

a.

[2 marks] Create two separate methods to handle the logic of options 1 and 2.

b.

[1 mark] The menu must function correctly as described.

c.

[3 marks] Proper error handling.

d.

Adhere to coding standards as described by the course. Marks will be taken off wherever

coding standards are not followed.

2.

In this part of the assignment, you are required to create a separate C# Console Application

project.

[1 Mark] The project name must be A3

P2. For example, a

student with first name John and Last name Smith would name the project A3JohnSmith3P2.

Write a C# (console) program to create an interface that gives the user the option to perform one of

three specific calculations.

[1 Mark] Your program should continue to give the option to calculate until it is closed or exited.

This program must use console input to accept the three numbers to be used.

The following inputs will need to be prompted:

1.

[1 mark] The selected mathematical option - the user can enter a, b or c to choose the

following:

a.

Calculate working percentage > (first number / second number) *100

b.

Multiply > first number * second number * third number

c.

Add > add all three numbers.

2.

[1 Mark] one for the first number input,

3.

[1 Mark] one for the second number input,

4.

[1 Mark] one for the third number input.

[2 Marks]

The output must be displayed after the mathematical option is selected, and the three inputs

(numbers) are entered.

If the user selects option a calculate the percentage as shown above

If the user selects option b perform the calculation as shown above

If the user selects option c add all three inputs as shown above.

[1 Mark] The program must only run once then exit

[3 Marks] This calculator must handle all errors using try/catch statements.

The error

message output must display at least 3 different types of error (or status) messages,

depending on what the user has done incorrectly.

o

Note: Your program must be able to catch all possible errors; it must not cras

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

8. Managers are not trained to be innovation leaders.

Answered: 1 week ago