### Free Educational Resources

• > PRG 410 WEEK 2 ASSIGNMENT
+

# PRG 410 WEEK 2 ASSIGNMENT

(0)
Author: un quite
##### Description:

http://unquite.com/question-details/PRG-410-WEEK-2-ASSIGNMENT/765

or email us at:

query@unquite.com

PRG 410 WEEK 2 ASSIGNMENT

Problem 01 (20 Marks)

(Basic Input Output, Arithmetic Operators)

Write a C++ program, which can calculate Slope of a line ‘m’, by using formula. Ask from user values of y, x and b. You program calculate and print value of m.

Problem 02 (50 Marks)

(Basic Input Output, Arithmetic Operators)

‘math.h’ is a library, which contains different mathematical functions like cos, sin, tan, raise to power. You have to write a program, which can calculate following functions. Every equation has left side and right side. Your program must calculate both sides of following equation.

Problem 03 (30 Marks)

(Basic I/O, Nested If/Else)

Design a calculator that performs 4 basic operations (add, subtract, divide and multiply). When your program executes, it should ask the user to enter a simple expression of the format;

Operand1 Operator Operand2

e.g: 3 + 5, 7 / 5, 8 * 9, 10 – 4

You should use the data type ‘int’ for operands and the data type ‘char’ for the operator symbol. Your program should check the value of character variable using selection statement (if/else) and perform the operation accordingly. If user inputs “+” in character variable, you will add two numbers and do same for rest of the operations.

The output of your program must appear as shown in Fig-1 below;

(more)
##### Try a College Course Free

Sophia’s self-paced online courses are a great way to save time and money as you earn credits eligible for transfer to over 2,000 colleges and universities.*

No credit card required

26 Sophia partners guarantee credit transfer.

226 Institutions have accepted or given pre-approval for credit transfer.

* The American Council on Education's College Credit Recommendation Service (ACE Credit®) has evaluated and recommended college credit for 21 of Sophia’s online courses. More than 2,000 colleges and universities consider ACE CREDIT recommendations in determining the applicability to their course and degree programs.

Tutorial