Create Pseudo-CODE for the following Problem. The Denver Urban Sports Technician
ID: 3687104 • Letter: C
Question
Create Pseudo-CODE for the following Problem.
The Denver Urban Sports Technicians (DUST) rent and sell recreational equipment including canoes, bikes, windsurfers, and trailers. The accountant for DUST requires a monthly supplier report. A number of suppliers are used and each sells equipment to DUST on a credit basis and charges DUST interest on the final monthly balance owed to the supplier. The transactions with each supplier are tracked over the month on a Supplier Transaction Sheet. The Supplier Transaction Sheet first lists the month the transactions occurred. Then for each supplier the Transaction Sheet lists the supplier name, the balance forward (balance owed to supplier for previous purchases) and the monthly interest rate. The supplier 's entry is followed by all the transactions related to the supplier for that month. Each transaction includes the transaction number, type and amount. DUST requires a monthly report to show all the information seen on the Supplier Transaction Sheet. Additionally at the end of each transaction record the report must display the current balance. And after each supplier 's last transaction the report must display the amount of monthly interest due and the ending balance owed to the supplier. Also after all suppliers are processed a report summary must show the overall balance, the average purchases per supplier for the month, the total monthly payments, the highest supplier final balance and the name of the supplier owed this balance. In the case of multiple instances of the highest only report the first instance. All numeric values listed in the summary are monetary values. The transactions are of two types. Either a B type which identifies that DUST bought (purchased on credit) items from the supplier, or a P type which identifies that DUST paid (made a payment to) the supplier. The transaction type value can be a single character (char type) or a String type. The current balance is a running balance calculated by starting with the balance forward amount and then undatin? hv each transaction record The monthly interest amount is the final current balance owed the supplier multiplied by the interest percentage. The ending balance is the final current balance owed the supplier plus the monthly interest amount. The overall balance is the sum of all supplier ending balances. The average purchases per supplier for the month is the total of all purchase transactions divided by the number of suppliers processed. All transaction & balance amounts should be displayed with decimal positions to ensure monetary values are expressed in dollars and cents. DUST is willing to enter the data from the Transaction Sheet in the order shown in the test data. A zero (0) will be entered for the transaction number to mdicate the end of entry for a supplier. The word "Done" will be entered for the supplier name to mdicate end of entry for the month.Explanation / Answer
Month
Supplier Name
Balance brought Forward
monthly interest rate
pseudo code:
create database dust;
use dust;
// String = char(30) or char(60)
create tables supplier, dust, accounts where each table has the structure as shown below:
create table supplier (supplier name string, supplierID String primary key , address string);
create table accounts(accountHead string, credit currency, debit currency, balance currency);
create table DUST (numberOfPendingSuppliers, AmountOnTill currency, supplierID Foreign key references Supplier Table, equipmentID String foreign key references equipment table)
In the table DUST numberOfPendingSuppliers means number of suppliers to whom DUST is owing some money
if all paid and zero dues then the numberOfPendingSuppliers will be = 0 – but it happens only during hot sales seasons
AmountOnTill = the petty cash or cash on hand in the shop to give change for customers in case of cash purchase instead of credit cards / debit cards etc ( this will be less than $5.- in notorious areas to keep the thieves away!)
create table equipment(equipmentID string, equipment name string, valuedAt currency, primary supplierID string, secondary supplier ID string );
The difference between the primary supplierID string, and the secondary supplier ID string is that
The primary supplier will offer the best price ( or bargain) say a sports shoe like Nike for $560.-
The secondary supplier will offer the next best price ( or bargain) for the same brand of sports shoe Nike for $570.-
While the factory outlet price may just be $450.-;
function purchaseFromSupplier() {
} // end function purchaseFromSupplier
function makeSalesToCustomers() {
} // end function makeSalesToCustomers
function main() {
// pro C = pre compiled C style
double salesAmt, loanAmt, intRate;
char supplierName[60], choice;
char supplierID[10], primarySupplierID[10], secondarySupplierID[10];
local variables are prefixed with a colon :
cout = output = print
cin = input = read
output “please enter supplier ID:”
input supplierID;
EXEC SQL
SELECT supplierID
FROM SupplierTable
WHERE supplierID = :supplierID;
averagePurchasesPerSupplierForTheMonth
SELECT count(supplierID) as count ,
sum(purchaseAmount)/count as averagePurchasesPerSupplierForTheMonth
FROM SupplierTable
WHERE supplierID = :supplierID
AND month = :givenMonth
AND purchaseMade = ‘true’;
SELECT balance
INTO :balanceBroughtForward
FROM DUST
WHERE supplierID = :supplierID;
// got the old balance for this supplier
if ( supplierID != NULL) output “Supplier exists”;
output “Enter choice : B = Borrow more from this supplier, P = Pay off existing loans to this supplier”;
input choice;
double balanceBroughtForward;
balance = balanceBroughtForward;
if (choice == “B” ) {
output “how much to borrow?”
input amt; // amt = amount type = double font = currency
balance = balanceBroughtForward + amt;
print “please beware interest has to be paid on borrows….!!”
} // end if choice == B
if (choice == “P” ) {
output “how much to Pay?”
input amt; // amt = amount type = double font = currency
balance = balanceBroughtForward - amt;
print “you rock!, you have reduced pending interest by paying off well done….!!”
} // end if choice == B
END EXEC
char transactionType; // B or P
double currentBalance , monthlyInterest, endingBalance, overallBalance, ;
double averagePurchasesPerSupplierForTheMonth;
double AllTransactions, BalanceAmount;
}
Month
Supplier Name
Balance brought Forward
monthly interest rate