Questions
Use C++ for this program    Define a Line Class.    Constraint: Line must be in...

Use C++ for this program

   Define a Line Class.
   Constraint: Line must be in First Quadrant
               for X-Y Coordinate System.

   Create the following methods:
   1) Parameterized Constructor
   2) Horizontal Line Constructor
   3) Vertical Line Constructor
   4) Default Constructor  
   5) Compute Length of Line.

    TEST CASES: Find Length of Line

    (a) Point 1: (5,6) Point 2: (15,6)
  
    (b) Point 1: (7,8) Point 2: (7,20)

    (c) Point 1: (9,10) Point 2: (19,20)

    (d) Default Line of 10 units at (0,0).

A quick question, would this be put in a header file and called into a source file?

In: Computer Science

Given an original message, determine the cipher that will produce the encoded string that comes earliest...

Given an original message, determine the cipher that will produce the encoded string that comes earliest alphabetically. Return this encoded string. In the example below, the second cipher produces the alphabetically earliest encoded string ("abccd").

For example, if John's message is "hello" and his cipher maps 'h' to 'd', 'e' to 'i', 'l' to 'p' and 'o' to 'y', the encoded message will be "dippy". If the cipher maps 'h' to 'a', 'e' to 'b', 'l' to 'c' and 'o' to 'd', then the encoded message will be "abccd".

My code (bolded code is part of the question and cannot be changed):

string encrypt(string message){

// you write code here

string unEncryp;

for(int i = 0; i < message.length()){

char temp = message[i];

switch(temp){

default:

break;

}

}

return unEncryp;

}

In: Computer Science

For the past several weeks you have addressed several different areas of telecommunications and information technology...

For the past several weeks you have addressed several different areas of telecommunications and information technology in relation to different types of communication across the organizational footprint of Sunshine Health Corporation. Review the work you have done and formulate the Network Security Plan to be implemented across the network footprint. This is not to be an overly detailed report but to address different network concerns and recommendations for improving and securing organizational data, personnel records, intellectual property, and customer records.

Please address the narrative plan as well as a network diagram (no IP addresses, or circuit data required) and what is being done to secure the network at different levels of the OSI model and the organizational structure. Please make sure that you bring in a minimum of two external sources to strengthen and support your presentation.

The assignment should be 5-6 pages of content not counting title page, reference page or appendices (diagrams, budget sheet, equipment list, etc.). Please follow APA format.

In: Computer Science

Suppose your architectural/design style for the human resource management scenario is MVC, what would be the...

Suppose your architectural/design style for the human resource management scenario is MVC, what would be the best architectural evaluation technique to ensure that your choice of the selected architectural/design style is correct? Describe your answer with justification.

In: Computer Science

Your goal for this assignment is to create a tool that manages an equivalence relation that...

Your goal for this assignment is to create a tool that manages an equivalence relation that can be changed in a specific way by the program while the program runs. The assignment will involve creating two files, equiv.h and equiv.cpp.

For this assignment, the equivalence relation is always over a set of integers {1, 2, 3, …, n} for some positive integer n.

This tool is not a complete program. It is intended to be part of a larger program. File equiv.cpp must not contain a 'main' function.

Equiv.h will contain function prototypes, but it must not contain any full function definitions. (There must be no function bodies.) Equiv.cpp must contain line

  #include "equiv.h"

before any function definitions.

Interface

The interface tells exactly what this module provides for other modules to use. Other modules must not use anything that is not described here. Briefly, the interface includes a type, ER, which is the type of an equivalence relation, and the following functions.

  ER   newER(const int n);
  void destroyER(ER R);
  bool equivalent(ER R, const int x, const int y);
  void merge(ER R, const int x, const int y);

Additionally, there is one function that is solely for debugging.

  void showER(const ER R, const int n);

There is one more function that is part of the implementation but not part of the interface. You can use it for debugging, though.

  int  leader(ER R, const int x);

A module that uses this tool can create an equivalence relation called R by saying

  ER R = newER(n);

where n is a positive integer. Initially, each number is in its own equivalence class; the equivalence classes are {1}, {2}, …, {n}. There are two operations that can be performed.

  1. equivalent(R, x, y) returns a boolean value: true if x and y are currently in the same equivalence class in equivalence relation R, and false otherwise.

  2. merge(R, x, y) modifies equivalence relation R by making x and y equivalent. It combines the equivalence class that contains x with the equivalence class that contains y. The merge function does not return an answer.

Example

For example, suppose that n = 7. The following shows a sequence of operations and shows the equivalence classes after each merge operation.

Step Result
ER R = newER(7) R = {1} {2} {3} {4} {5} {6} {7}
merge(R, 1, 5) R = {1, 5} {2} {3} {4} {6} {7}
merge(R, 2, 7) R = {1, 5} {2, 7} {3} {4} {6}
equivalent(R, 1, 5) yields true
equivalent(R, 1, 7) yields false
merge(R, 5, 7) R = {1, 2, 5, 7} {3} {4} {6}
equivalent(R, 2, 5) yields true
equivalent(R, 2, 3) yields false yields false
merge(R, 2, 3) R = {1, 2, 3, 5, 7} {4} {6}
equivalent(R, 3, 7) yields true
equivalent(R, 4, 7) yields false
merge(R, 4, 6) R = {1, 2, 3, 5, 7} {4, 6}
merge(R, 2, 3) R = {1, 2, 3, 5, 7} {4, 6}

As you can see from the last step, it is allowed to merge two values that are already equivalent. That should cause no change.

An Algorithm for Managing an Equivalence Relation

You will not store the equivalence classes directly. Instead, you will store them implicitly, using the following ideas.  You are required to implement an equivalence manager in this way. You will receive no credit for a module that does not follow this algorithm.

  1. Each equivalence class has a leader, which is one of the members of that equivalence class. You will create a function leader(R, x) that returns the current leader of the equivalence class that contains x in equivalence relation R.

    Two values are equivalent if they have the same leader.

  2. There is another idea that is similar to a leader, but not exactly the same. Each value has a boss, which is a value in its equivalence class. For the purposes of describing the idea, let's write boss[x] for x's boss.

    1. If x is the leader of its equivalence class then boss[x] = 0, indicating that x has no boss.

    2. If x is not the leader of its equivalence class then boss[x] ≠ 0 and boss[x] is closer to the leader, in the following sense. If you look at the values x, boss[x], boss[boss[x]], boss[boss[boss[x]]], … then you will eventually encounter x's leader (just before you encounter 0).

Details on the algorithm

Use an array to store the bosses. Declaration

  typedef int* ER;

defines type ER to be the same as int*. Write the following functions.

  1. newER(n) returns an equivalence relation as an array of n+1 integers. Allocate the array in the heap. This array will be used to store the bosses. If R has type ER then R[x] is x's boss.

    In C++, arrays start at index 0. You will use indices 1, … n, so you need to allocate n+1 slots. (Index 0 will not be used.)

    Initialize the array so that each value is a leader of its own equivalence class. That is, R[x] = 0 for x = 1, …, n.

  2. leader(R, x) returns the leader of x in equivalence relation R. To compute x's leader, just follow the bosses up to the leader. Here is a sketch of a loop that finds the leader of x.

      y = x
      while(boss[y] != 0)
        y = boss[y]
      return y
    
    You can use a loop or recursion the leader function. Any function that wants to compute a leader must use the leader function to do that.
  3. equivalent(R, x, y) returns true if x and y have the same leader in R. Notice that is not the same as saying that they have the same boss.

  4. merge(R, x, y) merges the equivalence classes of x and y in R as follows. First, it finds the leaders x′ and y′ of x and y. If x′ and y′ are different (so x and y are not already in the same equivalence class) then y′ becomes the new boss of x′ and y′ becomes the leader of the combined equivalence class.

  5. destroyER(R) deallocates R.

  6. showER(R, n) prints the entire contents of array R (of size n) in a readable form for debugging. Be sure that showER shows both k and k's boss, for each k.

    Do not try to be too fancy here. Do not try to show the equivalence classes. ShowER is a debugging tool, and it should show the bosses.

Important Note.

It is crucial for your merge function never to change the boss of a nonleader. If you are not sure that x is a leader, do not change R[x].  Pay attention to this!

In the past, many students have ignored this requirement. Needless to say, their modules did not work and their scores were low.

Additional Requirements

It is important for you to follow the algorithms and design described here. Do not make up your own algorithm. Implement exactly the functions that are indicated. Keep the parameter order as shown here. If you change the parameter order, your module will not compile correctly with my tester. Do not add extra responsibilities to functions.

The definition of ER must only be in equiv.h. Do not duplicate that definition in equiv.cpp.

A Refinement Plan

Development plan

2. Create a file called equiv.cpp.

Copy and paste the module-template into it. Edit the file. Add your name and the assignment number. If you will use tabs, say how far apart the tab stops are. Add line

#include "equiv.h"

3. Write a comment telling what this module will provide when it is finished.

Equiv.cpp is not an application. It just provides a tool. Say that it is an equivalence relation manager and give an outline of the interface.

4. Create a file called equiv.h.

Copy the following into equiv.h, then edit it to add your name.

// CSCI 2530
// Assignment: 3
// Author:     ***
// File:       equiv.h
// Tab stops:  none

// These #ifndef and #define lines make it so that, if this file is
// read more than once by the compiler, its body is skipped on all
// but the first time it is read.

#ifndef EQUIV_H
#define EQUIV_H

// An equivalence relation is an array of integers.
// So ER abbreviates int*.  

typedef int* ER;

// Public function prototypes

ER   newER      (const int n);
void destroyER  (ER R);
bool equivalent (ER R, const int x, const int y);
void merge      (ER R, const int x, const int y);

// The following is advertised here solely for debugging.  These must
// only be used for debugging.

void showER(const ER R, const int n);
int  leader(ER R, const int x);

#endif

Note. In the types of equivalent and leader, parameter R is not marked const, even though it seems to make sense to do that. The reason is that improvements that can be done for extra credit need to make changes to R, even in equivalent and leader.

5. In equiv.cpp, write a heading and contract, then fill in the body, of the 'newER' function.

Notice that newER(n) returns an equivalence relation that can handle set {1, 2, …, n}. Say that. Don't say that it returns an array. Where possible, express things in conceptual terms rather than in physical terms.

6. In equiv.cpp, write a contract, then an implementation, of the 'showER' function.

Pay attention to what showER is supposed to do.

7. Create file test1.cpp for partial testing of equiv.cpp.

Add a main function to test1.cpp and make main create a new ER object (using newER) and use showER to show what it looks like. Testequiv.cpp should contain

#include "equiv.h"
to allow it to use what is described in equiv.h.

Compile test1.cpp and equiv.cpp together as follows.

  g++ -Wall -o test1 test1.cpp equiv.cpp
Then run test1 by
  ./test1

8. In equiv.cpp, write a heading and contract, then an implementation, of the 'leader' function.

Modify test1.cpp so that it tests leader by showing showing the leader of each value in the ER object that it creates. Note that, at this point, each number will be its own leader. Run test1.cpp.

9. In equiv.cpp, write a heading and contract, then an implementation, of the 'merge' function.

Modify test1.cpp by making it merge just a few values, then show what the equivalence relation looks like using showER. Does it look right?

10. In equiv.cpp, write a contract, then an implementation, of the 'equivalent' function.

Now you have enough to use the automated tester. Run it. If there are errors, fix them. You can read testequiv.cpp to see what it is doing, but only change equiv.cpp to fix errors; changing the tester will not help since I will not use your modified tester when I grade your submission.

11. In equiv.cpp, write a contract, then an implementation, of the 'destroyER' function.

In: Computer Science

What does RAID stand for and what are some commonly used RAID levels? Discuss these as...

What does RAID stand for and what are some commonly used RAID levels? Discuss these as they relate to a DBMS and provide your recommendations.

In: Computer Science

Give an example of a situation(scenario) where you need to use a database to store data....

Give an example of a situation(scenario) where you need to use a database to store data. Explain clearly. (Min 500 words)

Subject:Database System

urgent

In: Computer Science

Make a class whose objects each represent a box of bricks. Also, the class has to...

Make a class whose objects each represent a box of bricks. Also, the class has to include the following services for its objects:

show what's in the box

get the weight of the box

determine if two boxes are equal

In: Computer Science

$$$$$$$$$$$$$$ please write in C# $$$$$$$$$$$$$$$ Write a program to keep track of a hardware store’s...

$$$$$$$$$$$$$$ please write in C# $$$$$$$$$$$$$$$

Write a program to keep track of a hardware store’s inventory. You will need to create necessary classes for handling the data and a separate client class with the main method.

The store sells various items. For each item in the store, the following information is maintained: item ID, item name, number of pieces currently in the store, manufacturer’s price of the item and the store’s selling price. Create a class Item to store the information about the items. Provide appropriate setters and getters. Override the toString() method.

Create a class Inventory that contains a vector of items. This class will contain a bunch of methods to help build the application. Create a static variable to keep track of the total different items in inventory. Every time a new item is added to the inventory this variable has to be updated.

  1. A method to create 5 Item objects by initializing the following properties of Item and returning a vector of Item.

ItemID,itemName,pInstore,manufPrice,sellingPrice

  1. A method to check whether an item is in the store by doing a lookup in the vector.
  2. A method to update the quantity on hand for the item being sold
  3. A method to report the quantity on hand for any item requested during purchase
  4. A method to print the report for the manager in the following format

ItemID     itemName               pInstore        manufPrice     sellingPrice

12            Circular saw            150               45.00      125.00

235        Cooking Range          50                450.0             850.00

.

Total Inventory: $####.##

Total number of items in the store:

The total inventory is the total selling value of all the items currently in the store. The total number of items is the sum of the number of pieces of all items in the store.

Create a separate client class with the main method, display the menu and use switch case statement to execute appropriate method. The main method should display a menu with the following choices such as:

  1. Check whether an item is in the store
  2. Sell an item
  3. Print the report

For option 1, the user must also be prompted for the itemID. You will then call the method created in the Inventory class.

For option 2, verify if pInstore > qtyOrdered. You will invoke the method created in Inventory class.

For option 3, display the report. Again, this is nothing but executing method from Inventory class.

Also after an item is sold update the appropriate counts. Initially, the number of pieces in the store is the same as the number of pieces ordered and the number of pieces of an item sold is zero. You will use the utility method created as part of Inventory class.

In: Computer Science

Create an application named SalesLeader. Add a class to your project called SalesPerson. (The default class...

Create an application named SalesLeader.

Add a class to your project called SalesPerson. (The default class may be called Program. Do not change this)

The SalesPerson class contains the following Properties:

FirstName - The salesperson's firs name (as a string)

SalesAmount - The sales amount ( as a double)

SalesArea - The 3 areas are the enumeration West Coast, MidWest, and East Coast.

Add a constructor which sets FirstName to "None", SalesAmount to 0 and SalesArea to MidWest.

Add a method which checks if the SalesAmount is greater than $100,000. If so, add 10% to the SalesAmount.

In the main class (Program), create the following:

Create 3 objects from SalesPerson.

                salesperson1

                salesperson2

                salesperson3

Prompt the user to set the amount of sales, first name and sales area for each object.

Display the name, sales amount and area for each sales person. Display which sales person is the Sales Leader this month and their commission (15% of total sales) … but first, add a method SalesLeaderTie to Program class to check if there might be a tie for Sales Leader. (Write Code in C#).

In: Computer Science

This is a homework question. It has to be done using JAVA language. And PAY ATTENTION...

This is a homework question. It has to be done using JAVA language. And PAY ATTENTION TO WHAT YOU CAN USE AND WHAT I SPECIFICALLY ADDED THAT CANT BE USED TO COMPLETE THIS.

Objective:

Write a program that takes in two words, and then it recursively determines if the letters of the first word are contained, in any order, in the second word. If the size of the first word is larger than the second then it should automatically return false. Also if both strings are empty then return true.

You May NOT: ******************************************************************************************

Use any iterative loops. In other words, no for-loops, no while-loops, no do-while-loops, no for-each loops.

Use the string method .contains(String)

You May: ******************************************************************************************

Use the string method .charAt(Index)

Hints:

Recursive methods generally attempt to solve a smaller problem then return the results of those in order to solve the larger one.

Think of how to do this with a loop, and use that to guide what parameters you’ll need for your recursive method.

Example Dialog:

Enter 2 words. I will determine if the letters of one is contained in the other

elf

self

They are contained!

Example Dialog 2:

Enter 2 words. I will determine if the letters of one is contained in the other

jerky

turkey

They are not contained

Example Dialog 3:

Enter 2 words. I will determine if the letters of one is contained in the other

asdf

fasted

They are contained!

In: Computer Science

MATLAB: Write a function called problem2 that takes an at most two-dimensional matrix A as its...

MATLAB:

Write a function called problem2 that takes an at most two-dimensional matrix A as its sole input. The function uses a while-loop to return the largest element of A. You are not allowed to use the built-in max function and you are also not allowed to use for-loops.

In: Computer Science

Questions for Security Engineering: Why is security difficult? How does it compare to other objectives like...

Questions for Security Engineering:

  • Why is security difficult?
  • How does it compare to other objectives like cost, power, performance, reliability?

In: Computer Science

Please construct a nondeterministic, deterministic, and minimum deterministic finite state machine for the following regular expressions....

Please construct a nondeterministic, deterministic, and minimum deterministic finite state machine for the following regular expressions. You have to show the construction process, not just the final result.

1) acb*a | bba*b+

2) d*adc | (a)b*bc*d

In: Computer Science

IN PYTHON: Write a program that asks the user for a path to a directory, then...

IN PYTHON:

Write a program that asks the user for a path to a directory, then updates the names of all the files in the directory that contain the word draft to instead say final

     EX: "term paper (draft).txt" would be renamed "term paper (final).txt"

BONUS (5pts): for any .txt file that your program changes the name of, have your program add a line of text that states "Edited on " followed by the current date to the end of the text in the file that it is editing.

In: Computer Science