You are on page 1of 4

DCIT22 2020: Practice

DEADLINE: JANUARY 22, 2021 11:00 am

SPECIFICATION FOR ALGORITHM


Font: Century Gothic Font Size: 11 Line Spacing: Single Page Size: A4 Margin: 0.75 all sides w/ page number (lower
right corner)
Header: Surname, First Name, MI / Student Number / Course Year Section / Date of Submission / Written Work#
Footer: DCIT22 Computer Programming 1 / Page Number
Font Color of Header & Footer:
BSIT 1-3 Orange
BSIT 1-5 Aqua
BSCS 1-2 Purple
BSCS 1-3 Olive Green

Print the following outputs using C++ & Python

*** *
*
*
*** *
*** **
*** ***
*** ***
** **
* *
123 1
2
3
123 1
123 12
123 123
123 1
12 12
1 123

1
Develop a program that will determine whether a department-store customer has exceeded the credit limit on a charge
account. For each customer, the following facts are available:

a. Account number (an integer)


b. Balance at the beginning of the month
c. Total of all items charged by this customer this month
d. Total of all credits applied to this customer's account this month
e. Allowed credit limit

The program should use a while statement to input each of these facts, calculate the new balance (= beginning balance +
charges credits) and determine whether the new balance exceeds the customer's credit limit. For those customers whose
credit limit is exceeded, the program should display the customer's account number, credit limit, new balance and the
message "Credit Limit Exceeded."

Sample Screen Output:

Enter account number (-1 to end): 100


Enter beginning balance: 5394.78

Enter total charges: 1000.00


Enter total credits: 500.00
Enter credit limit: 5500.00
New balance is 5894.78
Account: 100
Credit limit: 5500.00
Balance: 5894.78
Credit Limit Exceeded.

Enter Account Number (or -1 to quit): 200


Enter beginning balance: 1000.00
Enter total charges: 123.45
Enter total credits: 321.00
Enter credit limit: 1500.00
New balance is 802.45

Enter Account Number (or -1 to quit): 300


Enter beginning balance: 500.00
Enter total charges: 274.73
Enter total credits: 100.00
Enter credit limit: 800.00
New balance is 674.73

Enter Account Number (or -1 to quit): -1

An automobile repair shop wants you to write a payroll program for its employees. The program must calculate each
employee's net salary, that is, the salary after taxes. Prompt the user for the employee's pay rate, hours worked, employee
code (either 'A' for full time or 'B' for part-time), and location (either 'N' for NCR or 'P' for Province). Allow the user to enter
either uppercase or lowercase letters. The program should display the regular pay, the overtime pay, the gross pay, the tax,
and the net pay. Calculate the gross pay as follows. If the employee worked 40 hours or less, the regular pay is the pay rate
times the hours worked and overtime pay is zero. If the employee worked over 40 hours, the regular pay is the pay rate
times 40 and the overtime pay is 1.5 times the pay rate times the hours worked over 40. Calculate the tax as follows. If the
employee code is 'A' and the location is 'N', the tax is 7% of the gross pay. If the employee code is 'A' and the location is not
'N', the tax is 4.5% of the gross pay. If the employee code is not 'A', the tax is zero. The net pay is the gross pay minus the
tax. After the program processes the last employee, it should display the total number of employees it processed and the
total gross pay, tax, and net pay.

2
#include<iostream.h>
#include<conio.h>

void main()
{ clrscr();

float payRate, _________, overtimePay, regularPay, excessHours, grossPay,


netPay, tax,
totalEmp = ___, totalGP = ___, totalTax = ____, totalNetPay = ____;
char empCode, locationCode, option;

do
{
cout<<"PAY RATE: ";
cin>>______________________;

cout<<"NUMBER OF HOURS WORKED: ";


cin>>______________________;

cout<<"EMPLOYEE CODE: ";


cin>>______________________;

cout<<"LOCATION CODE: ";


cin>>______________________;

overtimePay = 0;

if (noOfHours <= 40)


regularPay = _______________ * __________________;

else
{ excessHours = noOfHours - 40;
regularPay = _________________ * 40;
overtimePay = _________________ * payRate * 1.5;
}

grossPay = _________________ + ______________________;

if ((empCode=='A' || empCode=='a') && (locationCode=='N' || locationCode ==


'n'))
tax = grossPay * ______________________;
else if ((empCode=='A' || empCode=='a') && (locationCode=='P' ||
locationCode=='p'))
tax = grossPay * ______________________;
else if (empCode=='B' || empCode=='b')
tax = 0;
else
cout<<"Invalid Code!!!\n";

netPay = grossPay - tax;

cout<<"\nRegular Pay: "<<regularPay;


cout<<"\nOvertime Pay: "<<overtimePay;
cout<<"\nTax: "<<tax;

3
cout<<"\nGross Pay: "<<grossPay;
cout<<"\nNet Pay: "<<netPay;

totalEmp++;
totalGP = ____________ + __________________;
totalTax = _________________ + tax;
totalNetPay = totalNetPay + netPay;

cout<<"\n\nDo you want to process another employee?(y/n): ";


cin>>option;
}while (option == ___________ || option == 'y');

cout<<"\n\nTotal number of employees processed: "<<________________;


cout<<"\nTotal gross pay: "<<_________________;
cout<<"\nTotal tax: "<<_________________________;
cout<<"\nTotal net pay: "<<_____________________<<"\n\n";
getch();
}

You might also like