Purchase Solution

Using libraries with functions and procedures

Not what you're looking for?

Ask Custom Question

As you were reviewing the different programming languages on the Internet, you found some libraries with functions and procedures that you could use rather than write the code from scratch on your own. However, some of the code needs some modification to fit into your program. Nevertheless, you find 3 sets of code that you can reuse and have an implementation of the code.

Here is my code. I don't know how to start
Program Name { //begin of program

Procedure TrackPayment {

if amount_received < billing_amount then
amount_owing = billing_amount - amount_received

if date_payment_received > thirty_days then
late_fee_amount = late_charge_rate * billing_amount

account_balance = account_balance + amount_owing + late_fee_amount

}

Procedure CalculateInvoice {

if client_type = regular then
billing_amount = regular_price
else
billing_amount = regular_price - (service_price * discount_rate)

billing_amount = billing_amount + account_balance
}

Procedure PrintInvoice {

print client_name
print client_mailing_address
print invoice_number
print invoice_date
print billing_date
print billing_amount
print billing_period
}

begin main ( ) {
do TrackPayment
do CalculateInvoice
do PrintInvoice
}

} //end of program

Purchase this Solution

Solution Summary

Code reuse and using library functions are demonstrated.

Solution Preview

Below is the code in C++.

See also attached project.

// invoice.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

const int thirty_days = 30 ; // days
const float late_charge_rate = 0.10 ; // 10% for instance

float amount_received ;
float billing_amount ;

int date_payment_received ; // in days

float account_balance ;

float amount_owing ;
float late_fee_amount ;

// client types
const int regular = 0 ;
const int premium = 1 ; ...

Purchase this Solution


Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

C# variables and classes

This quiz contains questions about C# classes and variables.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.