In this task, you will build a calculator program that will perform the following
Ask Expert

Be Prepared For The Toughest Questions

Practice Problems

In this task, you will build a calculator program that will perform the following

Q3. Programming Task

In this task, you will build a calculator program that will perform the following operations:

• Basic addition (+), subtraction (-), multiplication (*), and division (/) operations

• Calculate the sum of N integers (N < 5)

• Calculate the factorial of the first N integer (N < 10)

The calculator will interface with the end users as follow:

After the program starts, print the following menu:

Welcome to PROG5001 calculator:

*****************************************************************

* Type 1 and press enter to perform basic calculation

* Type 2 and press enter to calculate the sum of N integers (N < 5)

* Type 3 and press enter to calculate the factorial of the first N integers (N < 10)

******************************************************************

Your choice:

After user select option 1 (type 1, press enter), the menu will appear as follow:

Welcome to PROG5001 calculator:

*****************************************************************

* Type 1 and press enter to perform basic calculation

* Type 2 and press enter to calculate the sum of N integers (N < 5)

* Type 3 and press enter to calculate the factorial of the first N integers (N < 10)

******************************************************************

Your choice:1

Input your operator [+.-,*,/] and press enter:+

Input your numbers and press enter:1 2

The result is: 3

Press enter to continue …

After user select option 2 (type 2, press enter), the menu will appear as follow:

Welcome to PROG5001 calculator:

*****************************************************************

* Type 1 and press enter to perform basic calculation

* Type 2 and press enter to calculate the sum of N integers (N < 5)

* Type 3 and press enter to calculate the factorial of the first N integers (N < 10)

******************************************************************

Your choice:2

Input N and press enter:4

Input your first number and press enter:1

Input your second number and press enter:2

Input your third number and press enter:3

Input your fourth number and press enter:4

The result is: 10

Press enter to continue …

After user select option 3 (type 3, press enter), the menu will appear as follow:

Welcome to PROG5001 calculator:

*****************************************************************

* Type 1 and press enter to perform basic calculation

* Type 2 and press enter to calculate the sum of N integers (N < 5)

* Type 3 and press enter to calculate the factorial of the first N integers (N < 10)

******************************************************************

Your choice:3

Input N and press enter:3

The factorial of 3 is: 18

Press enter to continue …

In completion this task, you will demonstrate:

• How to modify the basic calculator class given to you in the first 6 weeks to build this more advanced calculator program.

• How to use Scanner class to handle user input

• How to use basic control structure (condition, loop) to handle the menu system

• How to use array or collection class to store data

Hint
ManagementArrays are incredibly powerful data structures for storing similar components. When you build an array, the type of items and the size of the array are fixed and defined. Memory is allocated as soon as the array is constructed, and it remains empty until the values are assigned. Construct a List object, add components to it, create an empty array with the same size as the produced array ...

Know the process

Students succeed in their courses by connecting and communicating with
an expert until they receive help on their questions

1
img

Submit Question

Post project within your desired price and deadline.

2
img

Tutor Is Assigned

A quality expert with the ability to solve your project will be assigned.

3
img

Receive Help

Check order history for updates. An email as a notification will be sent.

img
Unable to find what you’re looking for?

Consult our trusted tutors.

Developed by Versioning Solutions.