use c++
A right-angle triangle with integer sides a, b, c, such as 3, 4,
5, is called a Pythagorean triple. The condition is that hypotenuse
to power of 2 is equal to adding of square of the 2 other sides. In
this example 25 = 16 + 9. Use brute force approach to find all the
triples such that no side is bigger than 50.
For this you should first implement the following Triangle class
and its methods. Then use it in main() to find all pythagorean
triples and put then in a std::vector. Finally print them out as
triples, like
(3, 4, 5)
.....
Make sure your output contains a triple only once, and not any
reordered ones, this means (3, 4, 5) is the same as (4, 3, 5) and
so only the increasing order triple should be printed out. This
means only (3, 4, 5) shoud be printed.
You program should print out all possible pythogorean triples with
sides <= 50.
*/
class Triangle
{
public:
Triangle(int a, int b, int c) // constructor.
Implement this
{}
bool isPythagorean() const // implement this
properly
{
return false;
}
private: // what do you put in private section?
}
int main()
{
}
In: Computer Science
I am a student taking an introductory Unix / LInux shell programming course and need some help with an assignment.
Using the file CISED as input, write the sed command to do the following:
Change 2 or more occurrences of g to a single g
Add > to beginning of any line that begins with CIS132
Add < to the end of any line that ends in Tux or tux
Replace any five to eight digit number with XX
For every line that begins with CIS132, place the first 6 characters in the line at the end of the line and the last three characters at the beginning of the line. Leave the characters in between these characters as they were.
Change any non alphanumeric character to &
For any line that begins with CIS132 place the entire line inside of double quotes.
Thanks for your help.
In: Computer Science
1) How large are the blocks that get fed through the AES Encryption algorithm?
2) What are the three possible key sizes for AES? How many rounds are there for each key size? How large is the keyspace?
3) List five distinct differences between the AES and DES algorithms.
4) List the 16 elements of GF(16) as polynomials. What is 3x^2+6x+1 equal to in GF(16), when the coefficients are reduced appropriately?
5) Use the table on slide 17 of the Chapter 4 slides to compute the inverse of x^4+x^3+1 in GF(256). Then verify that the product of x^4+x^3+1 and the inverse you computed is, in fact, 1 modulo the polynomial indicated in red on slide 17.
6) List three separate known attacks on AES. Include the weakness(es) of AES that they exploit and include the year in which the attack was first discovered
#understanding cryptography
#asap
In: Computer Science
Write a function with the following prototype: int add_ok (int s, unsigned x, unsigned y); This function should return 1 if arguments x and y can be added without causing overflow, otherwise return 0. If s is 0, x and y are unsigned numbers. If s is 1, x and y are treated as signed numbers. I tried this code but it doesn't work. Does anyone help me please?
#include int add_ok(int s, unsigned x, unsigned y) {
s=x+y;
if ((s<x) || (s<y)) {
return 0; }
return 1;
}
int main()
{
int nums = new int[(sizeof(int))];
unsigned x = 3357162450;
unsigned y = 40;
printf("%d\n",add_ok(s, x, y));
scanf("%d\n", &nums);
return 0;
}
In: Computer Science
Consider the following scenario:
Your manufacturing company has operated with a mainframe IBM computer for more than 20 years. Recent technological advances have brought opportunities to replace that mainframe-based computing environment with a client/server environment. You have been tasked with responding to the senior management group about the security issues involved with replacing the existing mainframe computer environment with a client/server platform. The salespeople you deal with from each vendor believe that the current mainframe environment costs about $500K a year to maintain from a security standpoint, while a client/server environment would cost about $325K a year. But cost is not the only consideration. No PII or SPII data is contained in this manufacturing platform. It is strictly a final product for sale application.
Outline and review a typical mainframe enterprise security footprint. Do the same for a possible client/server environment. This could include the use of the cloud for distributed computing, but that would also include unique security concerns.
Discuss the following:
Respond to the following in a minimum of 175 words:
In: Computer Science
Convert the following C function to the corresponding MIPS
assembly procedure:
int count(int a[], int n, int x)
{
int res = 0;
int i = 0;
int j = 0;
int loc[];
for(i = 0; i != n; i++)
if(a[i] == x) {
res = res + 1;
loc [j] = i;
j = j+1}
return res, loc;
}
In: Computer Science
What is DNS Poisoning, Spoofing, Pharming and the differences and examples of each
In: Computer Science
C++ Chapter 4/5 Lab Assignment Using concepts from chapters 1 – 5 only. Grading will be based on chapter 4 concepts more. Design a menu driven program that can keep track of five player’s scores. Your program must have the following documentation: A. Your name B. The program name C. Program Description D. The date the exe file was created E. The code: a. Use a menu approach do the following: i. to Add a player information ii. to Search for any player based on their name. iii. to Display all the information at any time (Hint : Use value and reference parameters as necessary).. b. Organize the main program to call input and output functions. Use static variables to keep track of player’s information. c. Input the names of five players and their highest scores on three games they ever played. Do Not Hard-Code the players’ names and their scores. d. Create an average function to compute the average highest score of each player i.e. ( john: g1 100 g2 200 g3 300. Average highest score will be 200.00).
In: Computer Science
Convert the following C function to the corresponding MIPS
assembly procedure:
int count(int a[], int n, int x)
{
int res = 0;
int i = 0;
int j = 0;
int loc[];
for(i = 0; i != n; i++)
if(a[i] == x) {
res = res + 1;
loc [j] = i;
j = j+1}
return res, loc;
}
In: Computer Science
implement the algorithm described in this chapter to convert a prefix expression to postfix form. involve the classes that programming problems 4 and 5 describe
This is to be written in C++. I cannot provide anymore information, I cannot provide any class information, etc. This is all the problem that book gave me. This is for Data Structures and algorithms.
In: Computer Science
Convert the following C function to the corresponding MIPS
assembly procedure:
int count(int a[], int n, int x)
{
int res = 0;
int i = 0;
int j = 0;
int loc[];
for(i = 0; i != n; i++)
if(a[i] == x) {
res = res + 1;
loc [j] = i;
j = j+1}
return res, loc;
}
In: Computer Science
Write a value returning function named CountLower that counts the number of lower case letters on one line of standard input and returns that number. Document the dataflow of the function and show how it would be called from main().
In: Computer Science
Registry Java Programming
3) Planner
Create a class called Planner. A Planner is a data structure for storing events. The maximum capacity of the planner (physical size) is specified by the formal parameter of the constructor of the class.
Instance methods
int size(); returns the number of events that are currently stored in this Planner (logical size);
boolean addEvent( AbstractEvent event ); adds an event to the
last position of
this Planner. It returns true if the insertion was a success, and
false if this Planner was already full;
AbstractEvent eventAt( int pos ); returns the event at the
specified position in
this Planner. This operation must not change this state of this
Planner. The first event of the Planner is at position 0;
AbstractEvent remove( int pos ); removes the event at the
specified position of
this Planner. Shifts any subsequent items to the left (start of the
array). Returns the event that was removed from this Planner;
void display( Date date ); the method display prints all the events that have a recurrence on the specified date;
void sort( Comparator< AbstractEvent > c ), the method passes the array of events and the comparator object to the method java.util.Arrays.sort;
The class overrides the method String toString(). An example of the expected format is given below.
4) Notifications:
Create a class called notifications that is sensitive to changes in the planner. Every time an item shows up in planner, the notifications class will display some kind of notification automatically on the screen. You need to use the observer design pattern.
These are the abstract classes:
// AbstractEvent.java : Java class to represent the
AbstractEvent
import java.util.Date;
public abstract class AbstractEvent {
// data fields
private String description;
private Date start_time;
private Date end_time;
// method to set the description of the
AbstractEvent
public void setDescription(String description)
{
this.description =
description;
}
// method to set the start date for the
AbstractEvent
public void setStartTime(Date start)
{
this.start_time = start;
}
// method to set the end date for the
AbstractEvent
public void setEndTime(Date end)
{
this.end_time = end;
}
// method to return the description of the
AbstractEvent
public String getDescription()
{
return description;
}
// method to return the start date of
AbstractEvent
public Date getStartTime()
{
return start_time;
}
// method to return the end date of the
AbstractEvent
public Date getEndTime()
{
return end_time;
}
// The below 3 methods must be define by the concrete
subclass of AbstractEvent
// abstract method hasMoreOccurrences() whose
implementation depends on the kind of event
public abstract boolean hasMoreOccurrences();
// abstract method nextOccurrence() whose
implementation depends on the kind of event
public abstract Date nextOccurrence();
// abstract method init() whose implementation depends
on the kind of event
public abstract void init();
}
//end of AbstractEvent.java
1.2
//DailyEvent.java
import java.util.Calendar;
import java.util.Date;
public class DailyEvent extends AbstractEvent{
// data field to store the number of recurrences
private int num_consecutive_days;
// helper field to return the next occurrence
private int days_occurred = 0;
// method to set the number of recurrences
public void setNumberOfConsecutiveDays(int
num_days)
{
this.num_consecutive_days =
num_days;
}
// method to get the number of recurrences
public int getNumberOfConsecutiveDays()
{
return num_consecutive_days;
}
// method to return if the event has more occurrences
or not
@Override
public boolean hasMoreOccurrences() {
// if days occurred < number of
consecutive days , then next occurrence is valid
if(days_occurred <
num_consecutive_days)
return
true;
return false;
}
// method to return the date of next
occurrence
@Override
public Date nextOccurrence() {
// if days_occurred >= number of
recurrences, return null (as it exceeds number of
recurrences)
if(days_occurred >=
num_consecutive_days)
return
null;
// return the next occurrence
date
Calendar cal =
Calendar.getInstance();
cal.setTime(getStartTime());
cal.add(Calendar.DATE,
days_occurred);
days_occurred++; // increment the
number of days by a day
return cal.getTime();
}
// method to re-initialize the state of the object
so that a call to the method nextOccurrence() returns the date of
the first occurrence of this event
@Override
public void init() {
days_occurred = 0;
}
public String toString()
{
return("Start Date:
"+getStartTime()+" End Date : "+getEndTime()+" Consecutive days of
occurrence : "+num_consecutive_days);
}
}
//end of DailyEvent.java
1.3
//WeeklyEvent.java
import java.util.Calendar;
import java.util.Date;
public class WeeklyEvent extends AbstractEvent{
// data field to store the limit date
private Date limit;
// helper field to return the next occurrence
private int num_days = 0;
// method to set the limit date
public void setLimit(Date limit)
{
this.limit = limit;
}
// method to return the limit date
public Date getLimit()
{
return limit;
}
// method to return if the event has more occurrences
or not
@Override
public boolean hasMoreOccurrences() {
// check if the call to
nextOccurrence will return a date within the limit
Calendar cal =
Calendar.getInstance();
cal.setTime(getStartTime());
cal.add(Calendar.DATE,
num_days);
if(cal.getTime().compareTo(limit)
< 0)
return
true;
return false;
}
// method to return the next occurrence date
@Override
public Date nextOccurrence() {
Calendar cal =
Calendar.getInstance();
cal.setTime(getStartTime());
cal.add(Calendar.DATE,
num_days);
// if next occurrence date >
limit , return null, else return the next occurrence date
if(cal.getTime().compareTo(limit)
>= 0)
return
null;
num_days += 7; // increment the
number of days by 1 week
return cal.getTime();
}
// method to re-initialize the state of the object
so that a call to the method nextOccurrence() returns the date of
the first occurrence of this event
@Override
public void init() {
num_days = 0;
}
public String toString()
{
return("Start Date:
"+getStartTime()+" End Date : "+getEndTime()+" Limit Date :
"+limit);
}
}
//end of WeeklyEvent.java
In: Computer Science
Discuss the process of folder and file auditing and the benefits thereof.
In: Computer Science
Design an activities page to make this web site complete. a.Use your imagination to create at least four activities. b.Organize these activities in a table. c.Some activities are free but some may charge some fee. d.Once again, the correct resort title and navigation menu bar shall be included.e.Include an image for each activity. Make sure the images’ size are the same.f.When mouse hovers on any image, its size will be enlarged.
In: Computer Science