Need help with C++ programming work

Hi, I'm new to programming and I'm doing a course in uni. I'm currently using "Dev-C++". I've been away on holidays and haven't been able to grasp the work we're doing now. I would really appreciate it if any of you C++ programming geniuses helped me with my work as I'm in a troubling situation with no idea what to do. If anyone is so helpful enough to help me with some of the questions or as much as you can then I will be so grateful. I will use this help to learn and understand more about C++ but for now I just need help on these questions.
Thanks.


Q.1

Option A
Using parentheses, rewrite the following expression to indicate the correct order of evaluation. Then evaluate the expression, assuming a=5, b=2, and c=4.

a % b * c && c % b * a

Option B
Determine the value of the following expression, assuming a=5, b=2, c=4, and d=5.

d % b * c > 5 || c % b * d < 7

Option C
Using parentheses, rewrite the following expression to indicate the correct order of evaluation. Then evaluate the expression, assuming a=5, b=2, and c=4.

b % c * a || a % c * b


Q.2
Option A
Write a C++ program to compute and display a person's weekly salary as determined by the following expressions:

If the number of hours worked is less than or equal to 40, the person receives $8.00 per hour; otherwise, the person receives $320.00, plus $12.00 for each hour worked over 40 hours.

The program should request the hours worked as input and should display the salary as output.

Option B
Write a C++ program that accepts a character using the cin object and determines whether the character is a lowercase letter. A lowercase letter is any character that is greater than or equal to 'a' and less than or equal to 'z'. If the entered character is a lowercase letter, display the mssage The character just entered is a lowercase letter. If the entered letter is not lowercase, display the message The character just entered is not a lowercase letter.


Q.3

This question is in regard to the C++ program

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
double monthlySales, income;

cout << "Enter the value of monthly sales: ";
cin >> monthlySales;
if (monthlySales >= 50000.00)
income = 375.00 + .16 * monthlySales;
if (monthlySales >= 40000.00 && monthlySales < 50000.00)
income = 350.00 + .14 * monthlySales;

// simplified here from the one in the textbook
if (monthlySales < 40000.00)
income = 200.00 + .03 * monthlySales;

cout << "\n\n\The income is $" << income << endl;

return 0;
}

and the C++ program

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
double monthlySales, income;

cout << "Enter the value of monthly sales: ";
cin >> monthlySales;

if (monthlySales >= 50000.00)
income = 375.00 + .16 * monthlySales;
else if (monthlySales >= 40000.00)
income = 350.00 + .14 * monthlySales;

// simplified here from the one in the textbook
else
income = 200.00 + .03 * monthlySales;

cout << "The income is $" << income << endl;

return 0;
}

Option A

Will these two programs produce the same output?
Which program is better? Why?
Draw the flow chart for the first C++ program.

Option B

Will these two program produce the same output?
Which program is better? Why?
Draw the flow chart for the second C++ program.


Q.4

Option A, B
For the following C++ program

#include <iostream>
using namespace std;

int main()
{
int num = 0;
while (num <= 20)
{
num++;
cout << num << " ";
}

return 0;
}

determine the total number of items displayed, and the first and last numbers printed. Draw the flow chart for the C++ program, and then desk-check the program for the first 5 steps and the last 3.
Please do not double post.
http://cplusplus.com/forum/beginner/40535/
Topic archived. No new replies allowed.