"Restmod creates objects that you can use from within Angular to interact with your RESTful API."
This is an english version of my presentation about Angular Restmod module.
What are windows object? Are global variable some way part of window object? What are window timer methods? What is the difference in setTimeOut and SetInterval? Which is better? Things which we all should know before using `setTimeout` and `setInterval`.
If you have all these question then you are at right place :)
#kiprosh
"Restmod creates objects that you can use from within Angular to interact with your RESTful API."
This is an english version of my presentation about Angular Restmod module.
What are windows object? Are global variable some way part of window object? What are window timer methods? What is the difference in setTimeOut and SetInterval? Which is better? Things which we all should know before using `setTimeout` and `setInterval`.
If you have all these question then you are at right place :)
#kiprosh
This what Im suppose to do and this is what I have so far.In thi.pdfkavithaarp
This what I\'m suppose to do and this is what I have so far.
In this assignment you are to create an interactive line command driven C++ program that allows
a user to do the following:
Create a bank account by supplying a user id and password
Login using this id and password
Quit the program
Upon successful login, the user will be presented with a menu to do one or more of the following
actions:
Withdraw money
Deposit money
Request balance
Quit the program
Ensure that you remove any unnecessary punctuation from monetary input (for example, all $ or
other currency symbols should be removed prior to processing, do NOT display an error message
to the user for characters which can be removed from the input string without changing the
intended value).
Format all monetary outputs on the display Currency (e.g. $ 25,928.43) with all decimal places
containing digits.
The User ID and password fields may be any combination of characters which are:
Visible when displayed on the screen (no control characters0
Normally accessible from a standard US keyboard
#include
#include
#include
using namespace std;
class Howard_COP2513_F1601 {
public:
char userInput = \'?\';
char userInput2 = \'?\';
string id = \"carl\";
string password = \"jones\";
string ID = \"?\";
string PASSWORD = \"?\";
double DEPOSIT = 0.00;
double WITHDRAW = 0.00;
double OLDBALANCE = 0.00;
double NEWBALANCE = 0.00;
void bankOption() {
cout << \"Please select an option: \" << endl;
cout << \"l -> Login \" << endl;
cout << \"c -> Create New Account \" << endl;
cout << \"q -> Quit \" << endl;
cin >> userInput;
if (userInput == \'l\' || \'L\') {
login();
}
else if (userInput == \'c\' || \'C\') {
createAcnt();
}
else if (userInput == \'q\' || \'Q\') {
quit();
}
}
void moneyOption() {
cout << \"d -> Deposit Money \" << endl;
cout << \"w -> Withdraw Money \" << endl;
cout << \"r -> Request Balance\" << endl;
cin >> userInput2;
if (userInput2 == \'d\' || \'D\') {
dMoney();
}
else if (userInput2 == \'w\' || \'W\') {
wMoney();
}
else if (userInput2 == \'r\' || \'R\') {
rBalance();
}
}
int login() {
cout << \"Please enter your user id: \" << endl;
cin >> ID;
cout << \"Please enter your password: \" << endl;
cin >> PASSWORD;
if (id != ID && password != PASSWORD) {
cout << \"Access Granted - \" << ID << endl;
}
else {
cout << \"******** \" << \"LOGIN FAILED! \" << \"********\" << endl;
bankOption();
}
moneyOption();
return 0;
}
int createAcnt() {
cout << \"Please enter your user name: \" << endl;
cin >> ID;
cout << \"Please enter your password: \" << endl;
cin >> PASSWORD;
bankOption();
return 0;
}
int quit() {
cout << \"Thanks for banking with COP2513.F16,\";
system(\"pause\");
return 0;
}
int dMoney() {
cout << \"Amount of deposit: \" << endl;
cin >> DEPOSIT;
OLDBALANCE = NEWBALANCE;
NEWBALANCE = OLDBALANCE + DEPOSIT;
moneyOption();
return 0;
}
int wMoney() {
cout << \"Amount of withdrawal: \" << endl;
cin >> WITHDRAW;
OLDBALANCE = NEWBALANCE;
NEWBALANCE = OLDBALANCE - WITHDRAW;
moneyOption();
return 0;.
DFiant HDL is a dataflow HDL that enables simpler yet powerful hardware description with correctness guarantees.
These slides belong to the talk given during the CIRCT weekly discussions https://docs.google.com/document/d/1fOSRdyZR2w75D87yU2Ma9h2-_lEPL4NxvhJGJd-s5pk
C++ and OOPS Crash Course by ACM DBIT | Grejo JobyGrejoJoby1
The slides from the C++ and OOPS Crash Course conducted for ACM DBIT by Grejo Joby.
Learn the concepts of OOPS and C++ Programming in the shortest time with these notes.
files/Heap.h
#ifndef HEAP_H
#define HEAP_H
#include <vector>
#include <stdexcept> // std::out_of_range
#include <math.h> // pow()
using namespace std;
template<typename T>
class Heap
{
private:
vector<T> _items; // Main vector of elements for heap storage
/**
* Used to take unsorted data and heapify it
*/
void buildHeap()
{
for (int i = _items.size() / 2; i >= 0; i--)
{
percolateDown(i);
}
}
/*********************************************************************/
/********************* Microassignment zone *************************/
/**
* Percolates the item specified at by index down
* into its proper location within a heap.
* Used for dequeue operations and array to heap conversions
* MA TODO: Implement percolateDown!
*/
void percolateDown(int index)
{
}
/**
* Percolate up from a given index to fix heap property
* Used in inserting new nodes into the heap
* MA TODO: Implement percolateUp
*/
void percolateUp( int current_position )
{
}
/************************** Microassigment zone DONE *********************/
public:
/**
* Default empty constructor
*/
Heap()
{
}
/**
* Constructor with a vector of elements
*/
Heap(const vector<T> &unsorted)
{
for (int i = 0; i < unsorted.size(); i++)
{
_items.push_back(unsorted[i]);
}
buildHeap();
}
/**
* Adds a new item to the heap
*/
void insert(T item)
{
int current_position = size(); // Get index location
_items.push_back(item); // Add data to end
percolateUp( current_position ); // Adjust up, as needed
}
/**
* Returns the top-most item in our heap without
* actually removing the item from the heap
*/
T& getFirst()
{
if( size() > 0 )
return _items[0];
else
throw std::out_of_range("No elements in Heap.");
}
/**
* Removes minimum value from heap and returns it to the caller
*/
T deleteMin()
{
int last_index = size() - 1; // Calc last item index
int root_index = 0; // Root index (for readability)
T min_item = _items[root_index]; // Keep item to return
_items[root_index] = _items[last_index]; // Move last item to root
_items.erase(_items.end() - 1); // Erase last element entry
percolateDown(0); // Fix heap property
return min_item;
}
/**
* Returns true if heap is empty, else false
*/
bool isEmpty() const
{
return _items.size() == 0;
}
/**
* Returns current quantity of elements in heap (N)
*/
int size() const
{
return _items.size();
}
/**
* Return heap data in order from the _items vector
*/
string to_s() const
{
string ret = "";
for(int i = 0; i < _items.size(); i++)
{
ret += to_string(_items[i]) + " ";
}
return ret;
}
/**
...
1. // Richard Rafalko Jr.
// Capstone Project for Change Due Customer
// November 16, 2014
#include "stdafx.h"
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <cstring>
using namespace std;
//Function prototype declarations
void moreMoney(double cash, double sale);
void printChange(double cash, double sale, double &changeDue);
int moneyConvert(double changeDue);
void calcChangeDue(int change);
void error();
void spacer();
int _tmain(int argc, _TCHAR* argv[])
{
double sale = 0.0;
double cash = 0.0;
double changeDue = 0.0;
int change = 0;
//Asks for sale amount and cash tendered
cout << "Amount of Sale: $";
cin >> sale;
cout << endl << "Amount tendered: $";
cin >> cash;
spacer();
//Checks for cash payment and sale equivalence
if (cash == sale)
{
cout << "There is no change."; spacer();
}
//Checks to see if payment was less than owed
else if (sale > cash)
moreMoney(cash, sale);
/*Checks to see if payment was more than owed. If so,
then 3 function calls for calculating change.*/
else if (sale < cash)
{
printChange(cash, sale, changeDue); //prints out the change due
change = moneyConvert(changeDue); //returns integer units for denoms
calcChangeDue(change); //main function for finding each denom
}
2. //For invalid data entry
else
{
error();
}
system("pause");
return 0;
}
//******************************************
//FUNCTIONS FOR CALCULATIONS AND CONVERSIONS
//******************************************
//Prints out when user still owes money
void moreMoney(double cash, double sale)
{
cout << "You still owe $" << sale - cash; spacer();
}
//Prints out the precise amount of money that is owed.
void printChange(double cash, double sale, double &changeDue)
{
changeDue = cash - sale;
cout << "The change is ... $" << fixed << setprecision(2) << changeDue; spacer();
}
//Converts double value, retuns integer units
int moneyConvert(double change)
{
return((change + .00000001) * 100); //The addition here adds precision
}
//****************************************************************
//MAIN FUNCTION THAT FINDS DENOMINATION UNITS AND PRINTS THE UNITS
//****************************************************************
void calcChangeDue(int change)
{
int breakdown[8] = { 0 };
string singleDenoms[8] = { " twenty dollar bill", " ten dollar bill",
" five dollar bill", " one dollar bill", " quarter",
" dime", " nickel", " penny" };
string multipleDenoms[8] = { " twenty dollar bills", " ten dollar bills",
" five dollar bills", " one dollar bills", " quarters",
" dimes", " nickels", " pennies" };
//Calculates the amount of each denomination of bills and coin for return to customer in units
breakdown[0] = change / 2000; change = change - (breakdown[0] * 2000);
breakdown[1] = change / 1000; change = change - (breakdown[1] * 1000);
breakdown[2] = change / 500; change = change - (breakdown[2] * 500);
breakdown[3] = change / 100; change = change - (breakdown[3] * 100);
3. breakdown[4] = change / 25; change = change - (breakdown[4] * 25);
breakdown[5] = change / 10; change = change - (breakdown[5] * 10);
breakdown[6] = change / 5; change = change - (breakdown[6] * 5);
breakdown[7] = change / 1; change = change - (breakdown[7] * 1);
//Loop for printing out exactly what is owed. Loop does not print out when array quadrant is null.
for (int x = 0; x < 8; x++)
{
if (breakdown[x] == 1)
{
cout << breakdown[x] << singleDenoms[x] << endl;
}
else if (breakdown[x] > 1)
{
cout << breakdown[x] << multipleDenoms[x] << endl;
}
}
spacer();
}
//Failsafe for improper data entry
void error()
{
cout << "Improper data entered."; spacer();
}
//Quick function for spacing on output
void spacer()
{
cout << endl << endl;
}