Q1.Write suitable if statements for the following conditions: a) If the number is positive, add the number to the variable positivesum; else, add the number to the variable negativesum. b) If the slope is less than 0.5, set the variable flag to 0; else, set flag to 1.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.7: Do While Loops
Problem 3E: (Misc. application) a. Write a program to reverse the digits of a positive integer number. For...
icon
Related questions
icon
Concept explainers
Question
65
O Homework4.pdf >
Lecturer Ibtisam Alsari
Computer Programming1: Homework 4
Q1.Write suitable if statements for the following conditions:
a) If the number is positive, add the number to the variable positivesum;
else, add the number to the variable negativesum.
b) If the slope is less than 0.5, set the variable flag to 0; else, set flag to
1.
Q2.A senior salesperson is paid $800 a week, and a junior salesperson, $500
a week. Write a C++ program that accepts as input a salesperson's status in
the character variable status. If status cquals s, the senior salesperson's
salary should be displayed; otherwise, the junior salesperson's salary should
be displayed.
Q3.Write a program that input the month and the day. If the month entered
isn't between 1 and 12, display a message informing the user that an invalid
month has been entered. If the day entered isn't between I and 31, display
a message informing the user that an invalid day has been entered.
Q4.Write a C++ program that accepts a character as input data and
determines whether the character is a lowercase letter. A lowercase letter is
any character that's greater than or equal to "a" and less than or equal to "z"
If the entered character is a lowercase letter, display the message "The
character just entered is a lowercase letter." If the entered letter isn't
lowercase, display the message "The character just entered is not a
lowercase letter."
Q5.Write C++ program to compute and display a person's weekly salary
as determined by the following conditions: If the hours worked are less than
or equal to 40, the person receives $12.00 per hour; otherwise, the person
receives $480.00 plus $18.00 for each hour worked over 40 hours. The
Lecturer Ibtisam Alsari
program should request the hours worked as input and display the salary as
output.
Transcribed Image Text:65 O Homework4.pdf > Lecturer Ibtisam Alsari Computer Programming1: Homework 4 Q1.Write suitable if statements for the following conditions: a) If the number is positive, add the number to the variable positivesum; else, add the number to the variable negativesum. b) If the slope is less than 0.5, set the variable flag to 0; else, set flag to 1. Q2.A senior salesperson is paid $800 a week, and a junior salesperson, $500 a week. Write a C++ program that accepts as input a salesperson's status in the character variable status. If status cquals s, the senior salesperson's salary should be displayed; otherwise, the junior salesperson's salary should be displayed. Q3.Write a program that input the month and the day. If the month entered isn't between 1 and 12, display a message informing the user that an invalid month has been entered. If the day entered isn't between I and 31, display a message informing the user that an invalid day has been entered. Q4.Write a C++ program that accepts a character as input data and determines whether the character is a lowercase letter. A lowercase letter is any character that's greater than or equal to "a" and less than or equal to "z" If the entered character is a lowercase letter, display the message "The character just entered is a lowercase letter." If the entered letter isn't lowercase, display the message "The character just entered is not a lowercase letter." Q5.Write C++ program to compute and display a person's weekly salary as determined by the following conditions: If the hours worked are less than or equal to 40, the person receives $12.00 per hour; otherwise, the person receives $480.00 plus $18.00 for each hour worked over 40 hours. The Lecturer Ibtisam Alsari program should request the hours worked as input and display the salary as output.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning