0% found this document useful (0 votes)
48 views

Oop Assignment

This document contains three programming assignments related to object oriented programming in C++. The first asks students to write a program that calculates and displays the earnings of salespeople paid a $200 weekly base salary plus 9% commission on gross sales. The second asks students to write a program that calculates the gross pay for employees paid straight time for the first 40 hours and time-and-a-half for additional hours, given their hourly rates and hours worked. The third provides partial problems for calculating the integer quotient and remainder of division, and using those to write a function that prints an integer as digits separated by two spaces.

Uploaded by

Highlights Mania
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Oop Assignment

This document contains three programming assignments related to object oriented programming in C++. The first asks students to write a program that calculates and displays the earnings of salespeople paid a $200 weekly base salary plus 9% commission on gross sales. The second asks students to write a program that calculates the gross pay for employees paid straight time for the first 40 hours and time-and-a-half for additional hours, given their hourly rates and hours worked. The third provides partial problems for calculating the integer quotient and remainder of division, and using those to write a function that prints an integer as digits separated by two spaces.

Uploaded by

Highlights Mania
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

University of Central Punjab

(Faisalabad Campus)
Assignment # 02
Total Marks: 10
Name: ___________ Reg #: ___________
Subject: Object Oriented Paradigm
Class: BSCS 3rd Semester
Instructor: Habib Ur Rahman

Q:1 One large chemical company pays its salespeople on a commission basis. The salespeople receive $200 per
week plus 9 percent of their gross sales for that week. For example, a salesperson who sells $5000 worth of
chemicals in a week receives $200 plus 9 percent of $5000, or a total of $650. Develop a C++ program that will
input each salesperson's gross sales for last week and calculate and display that salesperson's earnings. Process
one salesperson's figures at a time.
Enter sales in dollars (-1 to end): 5000.00
Salary is: $650.00
Enter sales in dollars (-1 to end): 6000.00
Salary is: $740.00
Enter sales in dollars (-1 to end): 7000.00
Salary is: $830.00
Enter sales in dollars (-1 to end): -1
Q:2 Develop a C++ program that will determine the gross pay for each of several employees. The company
pays “straight-time” for the first 40 hours worked by each employee and pays “time-and-a-half” for all hours
worked in excess of 40 hours. You are given a list of the employees of the company, the number of hours each
employee worked last week and the hourly rate of eachemployee. Your program should input this information
for each employee and should determine and display the employee's gross pay.
Enter hours worked (-1 to end): 39
Enter hourly rate of the worker ($00.00): 10.00
Salary is $390.00
Enter hours worked (-1 to end): 40
Enter hourly rate of the worker ($00.00): 10.00
Salary is $400.00
Enter hours worked (-1 to end): 41
Enter hourly rate of the worker ($00.00): 10.00
Salary is $415.00
Enter hours worked (-1 to end): -1

Q:3 Write program segments that accomplish each of the following:


a) Calculate the integer part of the quotient when integer a is divided by integer b.
b) Calculate the integer remainder when integer a is divided by integer b.
c) Use the program pieces developed in a) and b) to write a function that inputs an integer between 1 and
32767 and prints it as a series of digits, each pair of which is separated by two spaces. For example, the
integer 4562 should be printed as
4562

You might also like