Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Create a class called bMoney. It should store money amounts as long doubles. Use the
function mstold() to convert a money string entered as input into a long double, and
the function ldtoms() to convert the long double to a money string for display. (See
Exercises 6 and 10.) You can call the input and output member functions getmoney()
and putmoney(). Write another member function that adds two bMoney amounts; you can
call it madd(). Adding bMoney objects is easy: Just add the long double member data
amounts in two bMoney objects. Write a main() program that repeatedly asks the user to
enter two money strings, and then displays the sum as a money string. Here’s how the
class specifier might look:
class bMoney
{
private:
long double money;
public:
bMoney();
bMoney(char s[]);
void madd(bMoney m1, bMoney m2);
void getmoney();
void putmoney();
};
Start with a program that allows the user to input a number of integers, and then stores
them in an int array. Write a function called maxint() that goes through the array,
element by element, looking for the largest one. The function should take as arguments
the address of the array and the number of elements in it, and return the index number of
the largest element. The program should call this function and then display the largest
element and its index number.
Write a program that calculates the average of up to 100 English distances input by the
user. Create an array of objects of the Distance class, as in the ENGLARAY example . To calculate the average, you can borrow the add_dist() member function
from the ENGLCON example . You’ll also need a member function that divides
a Distance value by an integer. Here’s one possibility:
void Distance::div_dist(Distance d2, int divisor)
{
float fltfeet = d2.feet + d2.inches/12.0;
fltfeet /= divisor;
feet = int(fltfeet);
inches = (fltfeet-feet) * 12.0;
}
Create a class called employee that contains a name (an object of class string) and an
employee number (type long). Include a member function called getdata() to get data
from the user for insertion into the object, and another function called putdata() to
display the data. Assume the name has no embedded blanks.
Write a main() program to exercise this class. It should create an array of type employee,
and then invite the user to input data for up to 100 employees. Finally, it should print out
the data for all the employees.
Write a function called reversit() that reverses a C-string (an array of char). Use a for
loop that swaps the first and last characters, then the second and next-to-last characters,
and so on. The string should be passed to reversit() as an argument.
Write a program to exercise reversit(). The program should get a string from the user,
call reversit(), and print out the result. Use an input method that allows embedded
blanks. Test the program with Napoleon’s famous phrase, “Able was I ere I saw Elba.”

Section B (Design Works)

 Below is a nested MPLS network by MTN. With the assumption that Customer 6 (C6) is connected to Router 6 (R6), execute a Dijkstra Algorithm on a Link State routing to determine the shortest path for Customer 6 to transmit packets to every other Customer/Destination connected to the rest of the Routers on the network.

a. Tabulate the executed iteration for the Dijkstra Algorithm using the table below.

  Iteration

0 1 2 3 4 5 6 7 8 9

Nodes

[6]

[6,3]

[6,3,2] [6,3,2,1] [6,3,2,1,4] [6,3,2,1,4,5] [6,3,2,1,4,5,7] [6,3,2,1,4,5,7,8] [6,3,2,1,4,5,7,8,9] [6,3,2,1,4,5,7,8,9,10]

R1 R2 R3 R4 R5 R7 R8 R9 R10

                 –...2/3


b. Build/Sketch the new Dijkstra Shortest Path Tree.



Part 3

Describe your experience so far with peer assessment of Programming Assignments.

How do you feel about the aspect assessments and feedback you have received from your peers?
How do you think your peers feel about the aspect assessments and feedback you provided them?
Part 2

Provide your own examples of the following using Python lists. Create your own examples. Do not copy them from another source.

Nested lists
The “*” operator
List slices
The “+=” operator
A list filter
A list operation that is legal but does the "wrong" thing, not what the programmer expects
Provide the Python code and output for your program and all your examples
Part 1

Write a Python program that does the following.

Create a string that is a long series of words separated by spaces. The string is your own creative choice. It can be names, favorite foods, animals, anything. Just make it up yourself. Do not copy the string from another source.

Turn the string into a list of words using split.

Delete three words from the list, but delete each one using a different kind of Python operation.

Sort the list.

Add new words to the list (three or more) using three different kinds of Python operation.

Turn the list of words back into a single string using join.

Print the string.
Describe the difference between objects and values using the terms “equivalent” and “identical”. Illustrate the difference using your own examples with Python lists and the “is” operator.

Describe the relationship between objects, references, and aliasing. Again, create your own examples with Python lists.

Finally, create your own example of a function that modifies a list passed in as an argument. Describe what your function does in terms of arguments, parameters, objects, and references.

Create your own unique examples for this assignment. Do not copy them from the textbook or any other source.
LATEST TUTORIALS
APPROVED BY CLIENTS