Share
Explore BrainMass

C++

C++

IN C++ Write a program that allows the user to input the number of days worked in a 7 day workweek and, using a fixed hourly rate, calculates the week's wages and the average number of hours worked per day.

C++

In C++ Write an if else programe that given a state, return its capital? Maryland - Annapolis Massachusetts - Boston Michigan - Lansing Minnesota - St. Paul Mississippi - Jackson Missouri - Jefferson City Montana - Helena Nebraska - Lincoln Nevada - Carson City New Hampshire - Concord New Jersey - Trenton New Me

English to U.S. Currency Conversion Program in C++

Complete the following problem in C++. Repetition: Write a program that reads an exchange rate for converting English currency to U.S. currency and then reads several values in English currency and converts each amount to the equivalent U.S. currency. Display all amounts with appropriate labels. Use a sentinel-controlled or

Greatest Common Divisor (GCD) in C++

I need the following problem in C++ with a recursive function and a driver programe to test the function ? * A recursive program to calculate the Greatest Common Divisor of two integers using the Euclidean Method. The algorithm in non-recursive form is as follows: EuclidGCD(a,b) { while (b not 0) { swap(a,b) b = b

Buffer-overflow

Buffer-overflow is a common computer security concern. Write a simple program, in C, C++, and Java, to declare a simple one dimensional array and then attempt to access an array element that is not within its bounds. For example, what happens if I declare an array to be in studentNums[10] and then attempt to access studentNums[1

How to control variations in program

Since every program that is created is different from every other program, what are the variations that we look for and how do we control them?

Data Structures with C++ Using STL

See attached file for full problem description. - Advanced Associative Structures Please provide a complete program if it makes sense. Exercise 12.13 Assume that a hash function has the following characteristics: Keys 257 and 567 hash to 3. Keys 987 and 313 hash to 6. Keys 734, 189, and 575 hash to 5. Keys 122, 391

C++ Programming Language

Please modify the attached program so it will satisfy the below requirements: Write the program as a procedural C++ program. Allow the user to input the amount of a mortgage and then select from a menu of mortgage loans: - 7 year at 5.35% - 15 year at 5.5% - 30 year at 5.75% Use an array for the different loans. Displ

Data Structures and Tree-Traversal Function

Trace the following tree-traversal function, f(), and describe its action: int f(tnode<int> *t) { int sLeft, sRight; if (t != NULL) { sLeft = f(t->left); sRight = f(t->right); return t->nodeValue + sLeft + sRight; } else return 0; } Please provide a complete

Binary Trees and Tree-Traversal

Trace the following tree-traversal function, f(), and describe its action: template <typename T> int f(tnode<T> *t) { int n = 0, leftValue, rightValue; if (t != NULL) { if (t ->left != NULL || t->right != NULL) n++; leftValue = f(t->left); rightValue = f(t->right);

C++ Programming: Mortgage Payment

Please modify the attached program so it will satisfy and meet below requirements: Write the program as a procedural C++ program. Calculate and display the mortgage payment amount using the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage as input by the user. Allow the user to loop back

Moving Elements in C++ Queue Using Template

See attached file. Write a function template<typename T> void n2front (queue<T>& q, int n); that moves the nth element (counting from the front, which is element 1) of the queue to the front, leaving the order of all other elements unchanged. The function throws the rangeError exception if n < 1 or n> q.size(). The fig

Data Structures with C++ Using STL

Declare a stack, queue, and priority queue of integers, as follows: stack<int> s; queue<int> q; priority_queue<int> pq; Assume that you input the integer sequence 5 8 12 15 1 3 18 25 18 35 2 55 and insert each value into each container in the order given. What is the output of the following statements? while (

Data Structures with C++ Using STL

List the elements in the queue after each of the following operations: queue<int> intQueue; intQueue.push(18); intQueue.push(2); intQueue.push(intQueue.front()); intQueue.push(intQueue.front()); intQueue.pop(); Please provide a complete program if it makes sense.

Data Structures with C++ Using STL

What is the output from the following sequence of stack operations? stack<int> intStack; int x, y = 3; intStack.push(8); intStack.push(9); intStack.push(y); x = intStack.top(); intStack.pop(); intStack.push(18); x = intStack.top(); intStack.pop(); intStackpush(22); while (!intStack.empty()) { y = intStack.top();

isbns from two different tables

I have a query that starts with the line: SELECT books.isbn, order_lines.isbn ...why would I want to see isbns from two different tables? What sort of query would warrant that - an inner join or an outer join? Assume the table "books" contains books that the company stocks. Assume the table order_lines only

trace the codes and display the resulting elements in a list

Trace the following code, and display the resulting elements in the list: int arr[] = (1, 2, 3, 4); int arrSize = sizeof(arr)/sizeof(int); list intList(arr, arr+arrSize); list::iterator iter = intList.begin(); int i; for (i=1; i <= arrSize; i++) intList.insert(iter++, i); Please provide a complete program i

Tranfer an array to a list

Consider the C++ array int arr[] = (-15, 5, 35, -19, -12, 17, -4); int arrSize = sizeof(arr)/sizeof(int); (a) Declare the list object intList that holds the integers from the array arr. (b) Declare the iterator iter for an integer list. (c) Initialize the iterator iter to the beginning of the list intList. (d)

Procedural C++ Mortgage Program

Please help me write the program as a procedural C++ program and using a loan amount of $200,000, a term of 30 years, and an interest rate of 5.75%. Insert comments in the program to document the program.

Data Structures with C++ (STL)

Consider the class declaration class demoClass { public: // assign arguments as initial values for the data members demoClass(int a = 5, int b = 10); // function returns the maximum of itemA and itemB // int max() const; private: int itemA, itemB; }; (a) Give t

C++ Linked List Pointers

Given the attached code (see file), what is the values of the following expressions. They may be undefined or the boolean expression may be invalid a) firstptr->next->firstname b) firstptr->next-next->SSN c) firstptr->next==lastptr d) currptr->next->lastname e) currptr->next->lastname f) firstptr==lastptr->next g)fi

C++

Using the attached file all numbers class do the following: - write a template function for the class called Add15() that adds 15 to each of the two numbers and display the result - write a template function for the class called multiplybypoints5() that multiples 0.5 to each numbers in the parameter list and display result

C++ Problem

Program that does the following: delcale an integer (var1) declare a pointer (ptr1) that points to var1 declare a reference (ref1) to var1 assign the address of var1 to ptr1 print the value of var1 using the pointer use the ref1 to change the value of var1 to var15 print the value of var1 using the ref1

Visual C++

The following class uses composition to define a line object in terms of two point objects. class line { public: Point startingpoint(); point endingpoint(); float length(); line (int startX, int startY, int endX, int endY); private: point startPoint; point endPoint: }; 1) write a fucntin defintion for the Lin

Visual C++

Give the class declaration class point { public: int xcoordinate(); int ycoordinate(); point(in initializeX, in initialize Y); private: int x; int y; }; 1: Suppose we have a type declaration as follows: enum status {on, off}; declare a class Pixel that inherits from class Point. Class Pixel will have an ad

Visual C++ Classes

Write a program that read in an integer. If the integer is a negative number, catch the exception and print an error message "Invalid Integer: value negative" and prompt the user for another number. If the integer is zero, catch the exception and print a message, "Integer cannot be zero, and end the program. Otherwise, just pri

Write a C++ program to output the binary

Write a C++ program to output the binary (base-2) representation of a decimal integer. The algorithm for this conversion is to be repeated dividing the decimal number by 2 until it is 0. Each division produces a remainder of 0 or 1 which becomes a digit in the binary numbers. example the decimal number 25 25/2 = 12 rema

Visual C++

Write a C++ value returning function that implements the recursive formula F(n) = F(n-1) + F(n+2) with base cases F(0)=1 and F(1) =1

Priority Queues (C++ Programming)

I need a program that uses the structure of priority queues that implement the right way to take care of an emergency room. Priorities: 1. Respiratory failure 2. No circulation 3. Hemorrhages It should be taken in consideration that if exists two persons with the same level of priority the first one to arrive is the fir